Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Max Mecklin
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 48ec93c2
authored
Apr 08, 2012
by
Juho Juopperi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of dev.insomnia.fi:/data/bortal
2 parents
b8c333b4
81e0bba8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
541 additions
and
264 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/ActionLogBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PermissionBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/VotingBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/ActionLogFacade.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/ActionLogBeanLocal.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/VotingBeanLocal.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/ActionLogMessage.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/ActionLogMessageResponse.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Compo.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/CompoEntry.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/CompoEntryFile.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/CompoEntryParticipant.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Vote.java
code/LanBortalUtilities/src/fi/insomnia/bortal/enums/ActionLogMessageState.java
code/LanBortalUtilities/src/fi/insomnia/bortal/enums/apps/ContentPermission.java
code/LanBortalWeb/WebContent/actionlog/messagelist.xhtml
code/LanBortalWeb/WebContent/actionlog/taskview.xhtml
code/LanBortalWeb/WebContent/resources/style/insomnia2/css/actionlog.css
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/actionlog/ActionLogCreateView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/actionlog/TaskModificationView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserCardView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/converter/GenericIntegerEntityConverter.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/ActionLogBean.java
View file @
48ec93c
...
@@ -3,14 +3,17 @@ package fi.insomnia.bortal.beans;
...
@@ -3,14 +3,17 @@ package fi.insomnia.bortal.beans;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
javax.annotation.security.DeclareRoles
;
import
javax.annotation.security.RolesAllowed
;
import
javax.annotation.security.RolesAllowed
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
import
javax.ejb.Stateless
;
import
javax.ejb.Stateless
;
import
fi.insomnia.bortal.enums.ActionLogMessageState
;
import
fi.insomnia.bortal.enums.ActionLogMessageState
;
import
fi.insomnia.bortal.enums.apps.ContentPermission
;
import
fi.insomnia.bortal.enums.apps.UserPermission
;
import
fi.insomnia.bortal.enums.apps.UserPermission
;
import
fi.insomnia.bortal.facade.ActionLogFacade
;
import
fi.insomnia.bortal.facade.ActionLogFacade
;
import
fi.insomnia.bortal.model.ActionLogMessage
;
import
fi.insomnia.bortal.model.ActionLogMessage
;
import
fi.insomnia.bortal.model.ActionLogMessageResponse
;
import
fi.insomnia.bortal.model.Role
;
import
fi.insomnia.bortal.model.Role
;
/**
/**
...
@@ -21,6 +24,7 @@ import fi.insomnia.bortal.model.Role;
...
@@ -21,6 +24,7 @@ import fi.insomnia.bortal.model.Role;
* - deletointi
* - deletointi
*/
*/
@Stateless
@Stateless
@DeclareRoles
(
ContentPermission
.
S_MANAGE_ACTIONLOG
)
public
class
ActionLogBean
implements
ActionLogBeanLocal
{
public
class
ActionLogBean
implements
ActionLogBeanLocal
{
// TODO: Permissions
// TODO: Permissions
...
@@ -37,11 +41,12 @@ public class ActionLogBean implements ActionLogBeanLocal {
...
@@ -37,11 +41,12 @@ public class ActionLogBean implements ActionLogBeanLocal {
// TODO Auto-generated constructor stub
// TODO Auto-generated constructor stub
}
}
@RolesAllowed
(
ContentPermission
.
S_MANAGE_ACTIONLOG
)
public
void
createActionLogEvent
(
String
message
,
Role
crew
,
boolean
isTask
)
{
public
void
createActionLogEvent
(
String
message
,
Role
crew
,
boolean
isTask
)
{
ActionLogMessage
alm
=
new
ActionLogMessage
();
ActionLogMessage
alm
=
new
ActionLogMessage
();
alm
.
setCrew
(
crew
);
alm
.
setCrew
(
crew
);
if
(
isTask
)
{
if
(
isTask
)
{
alm
.
setState
(
ActionLogMessageState
.
PENDING
);
alm
.
setState
(
ActionLogMessageState
.
NEW
);
}
else
{
}
else
{
alm
.
setState
(
null
);
alm
.
setState
(
null
);
}
}
...
@@ -52,15 +57,38 @@ public class ActionLogBean implements ActionLogBeanLocal {
...
@@ -52,15 +57,38 @@ public class ActionLogBean implements ActionLogBeanLocal {
actionLogFacade
.
saveToActionLog
(
alm
);
actionLogFacade
.
saveToActionLog
(
alm
);
}
}
@RolesAllowed
(
ContentPermission
.
S_MANAGE_ACTIONLOG
)
public
List
<
ActionLogMessage
>
getAllActionLogEvents
()
{
public
List
<
ActionLogMessage
>
getAllActionLogEvents
()
{
return
actionLogFacade
.
getAllSortedByTimestamp
();
return
actionLogFacade
.
getAllSortedByTimestamp
();
}
}
@RolesAllowed
(
ContentPermission
.
S_MANAGE_ACTIONLOG
)
public
List
<
Role
>
getAssignableRoles
()
{
public
List
<
Role
>
getAssignableRoles
()
{
return
roleBean
.
listRoles
();
return
roleBean
.
listRoles
();
}
}
@RolesAllowed
(
ContentPermission
.
S_MANAGE_ACTIONLOG
)
public
List
<
ActionLogMessageResponse
>
getActionLogMessageResponses
(
ActionLogMessage
alm
)
{
return
actionLogFacade
.
getActionLogMessageResponses
(
alm
);
}
@RolesAllowed
(
ContentPermission
.
S_MANAGE_ACTIONLOG
)
public
void
addActionLogMessageResponse
(
ActionLogMessage
alm
,
String
message
,
ActionLogMessageState
state
)
{
if
(
alm
.
getState
()
!=
state
&&
state
!=
null
)
{
alm
.
setState
(
state
);
}
ActionLogMessageResponse
almr
=
new
ActionLogMessageResponse
();
almr
.
setMessage
(
message
);
almr
.
setActionLogMessage
(
alm
);
almr
.
setStateChange
(
state
);
almr
.
setUser
(
permissionBean
.
getCurrentUser
());
actionLogFacade
.
saveActionLogResponse
(
almr
);
}
@Override
@Override
@RolesAllowed
(
ContentPermission
.
S_MANAGE_ACTIONLOG
)
public
ActionLogMessage
find
(
Integer
id
)
{
public
ActionLogMessage
find
(
Integer
id
)
{
return
actionLogFacade
.
find
(
id
);
return
actionLogFacade
.
find
(
id
);
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PermissionBean.java
View file @
48ec93c
package
fi
.
insomnia
.
bortal
.
beans
;
package
fi
.
insomnia
.
bortal
.
beans
;
import
java.security.Principal
;
import
java.security.Principal
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.annotation.security.DeclareRoles
;
import
javax.annotation.security.DeclareRoles
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
import
javax.ejb.SessionContext
;
import
javax.ejb.SessionContext
;
import
javax.ejb.Stateless
;
import
javax.ejb.Stateless
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
fi.insomnia.bortal.enums.apps.BillPermission
;
import
fi.insomnia.bortal.enums.apps.BillPermission
;
import
fi.insomnia.bortal.enums.apps.ContentPermission
;
import
fi.insomnia.bortal.enums.apps.ContentPermission
;
import
fi.insomnia.bortal.enums.apps.IAppPermission
;
import
fi.insomnia.bortal.enums.apps.IAppPermission
;
import
fi.insomnia.bortal.enums.apps.MapPermission
;
import
fi.insomnia.bortal.enums.apps.MapPermission
;
import
fi.insomnia.bortal.enums.apps.PollPermission
;
import
fi.insomnia.bortal.enums.apps.PollPermission
;
import
fi.insomnia.bortal.enums.apps.ShopPermission
;
import
fi.insomnia.bortal.enums.apps.ShopPermission
;
import
fi.insomnia.bortal.enums.apps.SpecialPermission
;
import
fi.insomnia.bortal.enums.apps.SpecialPermission
;
import
fi.insomnia.bortal.enums.apps.UserPermission
;
import
fi.insomnia.bortal.enums.apps.UserPermission
;
import
fi.insomnia.bortal.facade.UserFacade
;
import
fi.insomnia.bortal.facade.UserFacade
;
import
fi.insomnia.bortal.model.User
;
import
fi.insomnia.bortal.model.User
;
@Stateless
@Stateless
@DeclareRoles
({
@DeclareRoles
({
UserPermission
.
S_CREATE_NEW
,
UserPermission
.
S_CREATE_NEW
,
UserPermission
.
S_LOGIN
,
UserPermission
.
S_LOGIN
,
UserPermission
.
S_LOGOUT
,
UserPermission
.
S_LOGOUT
,
UserPermission
.
S_MODIFY
,
UserPermission
.
S_MODIFY
,
UserPermission
.
S_MODIFY_ACCOUNTEVENTS
,
UserPermission
.
S_MODIFY_ACCOUNTEVENTS
,
UserPermission
.
S_VIEW_ACCOUNTEVENTS
,
UserPermission
.
S_VIEW_ACCOUNTEVENTS
,
UserPermission
.
S_VIEW_ALL
,
UserPermission
.
S_VIEW_ALL
,
UserPermission
.
S_VIEW_SELF
,
UserPermission
.
S_VIEW_SELF
,
UserPermission
.
S_WRITE_ROLES
,
UserPermission
.
S_WRITE_ROLES
,
UserPermission
.
S_READ_ROLES
,
UserPermission
.
S_READ_ROLES
,
UserPermission
.
S_ANYUSER
,
UserPermission
.
S_ANYUSER
,
UserPermission
.
S_MANAGE_HTTP_SESSION
,
UserPermission
.
S_MANAGE_HTTP_SESSION
,
MapPermission
.
S_VIEW
,
MapPermission
.
S_VIEW
,
MapPermission
.
S_MANAGE_MAPS
,
MapPermission
.
S_MANAGE_MAPS
,
MapPermission
.
S_MANAGE_OTHERS
,
MapPermission
.
S_MANAGE_OTHERS
,
MapPermission
.
S_BUY_PLACES
,
MapPermission
.
S_BUY_PLACES
,
ShopPermission
.
S_LIST_ALL_PRODUCTS
,
ShopPermission
.
S_LIST_ALL_PRODUCTS
,
ShopPermission
.
S_LIST_USERPRODUCTS
,
ShopPermission
.
S_LIST_USERPRODUCTS
,
ShopPermission
.
S_SHOP_TO_OTHERS
,
ShopPermission
.
S_SHOP_TO_OTHERS
,
ShopPermission
.
S_MANAGE_PRODUCTS
,
ShopPermission
.
S_MANAGE_PRODUCTS
,
ShopPermission
.
S_SHOP_PRODUCTS
,
ShopPermission
.
S_SHOP_PRODUCTS
,
BillPermission
.
S_CREATE_BILL
,
BillPermission
.
S_CREATE_BILL
,
BillPermission
.
S_READ_ALL
,
BillPermission
.
S_READ_ALL
,
BillPermission
.
S_WRITE_ALL
,
BillPermission
.
S_WRITE_ALL
,
BillPermission
.
S_VIEW_OWN
,
BillPermission
.
S_VIEW_OWN
,
ContentPermission
.
S_MANAGE_NEWS
,
ContentPermission
.
S_MANAGE_NEWS
,
ContentPermission
.
S_MANAGE_PAGES
,
ContentPermission
.
S_MANAGE_PAGES
,
ContentPermission
.
S_MANAGE_ACTIONLOG
,
PollPermission
.
S_ANSWER
,
PollPermission
.
S_VIEW_RESULTS
,
PollPermission
.
S_ANSWER
,
PollPermission
.
S_CREATE
,
PollPermission
.
S_VIEW_RESULTS
,
PollPermission
.
S_CREATE
,
SpecialPermission
.
S_SUPERADMIN
,
SpecialPermission
.
S_USER
,
SpecialPermission
.
S_SUPERADMIN
,
SpecialPermission
.
S_ANONYMOUS
SpecialPermission
.
S_USER
,
})
SpecialPermission
.
S_ANONYMOUS
public
class
PermissionBean
implements
PermissionBeanLocal
{
})
public
class
PermissionBean
implements
PermissionBeanLocal
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
PermissionBean
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
PermissionBean
.
class
);
@Resource
private
SessionContext
context
;
@Resource
private
SessionContext
context
;
@EJB
private
LoggingBeanLocal
loggingbean
;
@EJB
private
LoggingBeanLocal
loggingbean
;
@EJB
private
UserFacade
userfacade
;
@EJB
private
UserFacade
userfacade
;
//
// @Override
//
// public boolean hasPermission(String perm) {
// @Override
// return context.isCallerInRole(perm);
// public boolean hasPermission(String perm) {
// }
// return context.isCallerInRole(perm);
// }
@Override
public
boolean
hasPermission
(
IAppPermission
perm
)
{
@Override
public
boolean
hasPermission
(
IAppPermission
perm
)
{
if
(
perm
==
null
)
{
if
(
perm
==
null
)
return
false
;
{
}
return
false
;
return
context
.
isCallerInRole
(
perm
.
getFullName
());
}
return
context
.
isCallerInRole
(
perm
.
getFullName
());
}
}
@Override
public
boolean
fatalPermission
(
IAppPermission
permission
,
Object
...
failmessage
)
throws
PermissionDeniedException
{
@Override
boolean
ret
=
hasPermission
(
permission
);
public
boolean
fatalPermission
(
IAppPermission
permission
,
Object
...
failmessage
)
throws
PermissionDeniedException
{
if
(!
ret
)
{
boolean
ret
=
hasPermission
(
permission
);
StringBuilder
message
=
new
StringBuilder
().
append
(
" permission: "
).
append
(
permission
);
if
(!
ret
)
{
if
(
failmessage
==
null
||
failmessage
.
length
==
0
)
{
StringBuilder
message
=
new
StringBuilder
().
append
(
" permission: "
).
append
(
permission
);
message
.
append
(
" MSG: SessionHandler mbean permission exception: Permission: "
)
if
(
failmessage
==
null
||
failmessage
.
length
==
0
)
{
.
append
(
permission
);
message
.
append
(
" MSG: SessionHandler mbean permission exception: Permission: "
)
}
else
{
.
append
(
permission
);
for
(
Object
part
:
failmessage
)
{
}
else
{
message
.
append
(
part
==
null
?
"NULL"
:
part
.
toString
());
for
(
Object
part
:
failmessage
)
{
}
message
.
append
(
part
==
null
?
"NULL"
:
part
.
toString
());
}
}
// throw new SecurityException("Foobar");
}
// throw new SecurityException("Foobar");
throw
new
PermissionDeniedException
(
loggingbean
,
getCurrentUser
(),
message
.
toString
());
}
throw
new
PermissionDeniedException
(
loggingbean
,
getCurrentUser
(),
message
.
toString
());
return
true
;
}
}
return
true
;
}
@Override
public
void
fatalNotLoggedIn
()
throws
PermissionDeniedException
{
@Override
if
(!
isLoggedIn
())
{
public
void
fatalNotLoggedIn
()
throws
PermissionDeniedException
{
throw
new
PermissionDeniedException
(
loggingbean
,
getCurrentUser
(),
"User is not logged in!"
);
if
(!
isLoggedIn
())
{
}
throw
new
PermissionDeniedException
(
loggingbean
,
getCurrentUser
(),
"User is not logged in!"
);
}
}
}
@Override
public
boolean
isCurrentUser
(
User
user
)
{
@Override
return
(
context
.
getCallerPrincipal
()
==
null
||
user
==
null
)
?
false
:
context
.
getCallerPrincipal
().
getName
().
equals
(
user
.
getLogin
());
public
boolean
isCurrentUser
(
User
user
)
{
}
return
(
context
.
getCallerPrincipal
()
==
null
||
user
==
null
)
?
false
:
context
.
getCallerPrincipal
().
getName
().
equals
(
user
.
getLogin
());
}
@Override
public
boolean
isLoggedIn
()
{
@Override
public
boolean
isLoggedIn
()
{
return
!
getAnonUser
().
equals
(
getCurrentUser
())
||
getCurrentUser
().
isSuperadmin
();
}
return
!
getAnonUser
().
equals
(
getCurrentUser
())
||
getCurrentUser
().
isSuperadmin
();
}
@Override
public
User
getCurrentUser
()
{
@Override
Principal
principal
=
context
.
getCallerPrincipal
();
public
User
getCurrentUser
()
{
Principal
principal
=
context
.
getCallerPrincipal
();
User
ret
=
userfacade
.
findByLogin
(
principal
.
getName
());
if
(
ret
==
null
)
{
User
ret
=
userfacade
.
findByLogin
(
principal
.
getName
());
ret
=
getAnonUser
();
if
(
ret
==
null
)
{
}
ret
=
getAnonUser
();
return
ret
;
}
}
return
ret
;
}
/**
* Makes sure default user and public role exist and the user is member of
/**
* the role.
* Makes sure default user and public role exist and the user is member of
*/
* the role.
@Override
*/
public
User
getAnonUser
()
{
@Override
User
defaultUser
=
userfacade
.
findByLogin
(
User
.
ANONYMOUS_LOGINNAME
);
public
User
getAnonUser
()
{
if
(
defaultUser
==
null
)
{
User
defaultUser
=
userfacade
.
findByLogin
(
User
.
ANONYMOUS_LOGINNAME
);
defaultUser
=
new
User
();
if
(
defaultUser
==
null
)
{
defaultUser
.
setLogin
(
User
.
ANONYMOUS_LOGINNAME
);
defaultUser
=
new
User
();
defaultUser
.
setNick
(
User
.
ANONYMOUS_LOGINNAME
);
defaultUser
.
setLogin
(
User
.
ANONYMOUS_LOGINNAME
);
userfacade
.
create
(
defaultUser
);
defaultUser
.
setNick
(
User
.
ANONYMOUS_LOGINNAME
);
userfacade
.
create
(
defaultUser
);
// defaultUser.setSuperadmin(true);
}
// defaultUser.setSuperadmin(true);
return
defaultUser
;
}
}
return
defaultUser
;
}
}
}
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/VotingBean.java
0 → 100644
View file @
48ec93c
package
fi
.
insomnia
.
bortal
.
beans
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
/**
* Session Bean implementation class VotingBean
*/
@Stateless
@LocalBean
public
class
VotingBean
implements
VotingBeanLocal
{
/**
* Default constructor.
*/
public
VotingBean
()
{
// TODO Auto-generated constructor stub
}
}
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/ActionLogFacade.java
View file @
48ec93c
...
@@ -14,6 +14,8 @@ import javax.persistence.criteria.Root;
...
@@ -14,6 +14,8 @@ import javax.persistence.criteria.Root;
import
fi.insomnia.bortal.model.AccountEvent
;
import
fi.insomnia.bortal.model.AccountEvent
;
import
fi.insomnia.bortal.model.AccountEvent_
;
import
fi.insomnia.bortal.model.AccountEvent_
;
import
fi.insomnia.bortal.model.ActionLogMessage
;
import
fi.insomnia.bortal.model.ActionLogMessage
;
import
fi.insomnia.bortal.model.ActionLogMessageResponse
;
import
fi.insomnia.bortal.model.ActionLogMessageResponse_
;
import
fi.insomnia.bortal.model.Bill
;
import
fi.insomnia.bortal.model.Bill
;
import
fi.insomnia.bortal.model.Bill_
;
import
fi.insomnia.bortal.model.Bill_
;
import
fi.insomnia.bortal.model.EventPk
;
import
fi.insomnia.bortal.model.EventPk
;
...
@@ -56,4 +58,21 @@ public class ActionLogFacade extends GenericFacade<Integer,ActionLogMessage> {
...
@@ -56,4 +58,21 @@ public class ActionLogFacade extends GenericFacade<Integer,ActionLogMessage> {
em
.
persist
(
alm
);
em
.
persist
(
alm
);
em
.
flush
();
em
.
flush
();
}
}
public
List
<
ActionLogMessageResponse
>
getActionLogMessageResponses
(
ActionLogMessage
alm
)
{
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaQuery
<
ActionLogMessageResponse
>
cq
=
cb
.
createQuery
(
ActionLogMessageResponse
.
class
);
Root
<
ActionLogMessageResponse
>
root
=
cq
.
from
(
ActionLogMessageResponse
.
class
);
cq
.
where
(
cb
.
equal
(
root
.
get
(
ActionLogMessageResponse_
.
actionLogMessage
),
alm
));
cq
.
orderBy
(
cb
.
asc
(
root
.
get
(
"time"
)));
TypedQuery
<
ActionLogMessageResponse
>
tq
=
em
.
createQuery
(
cq
);
return
tq
.
getResultList
();
}
public
void
saveActionLogResponse
(
ActionLogMessageResponse
almr
)
{
em
.
persist
(
almr
);
em
.
flush
();
}
}
}
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/ActionLogBeanLocal.java
View file @
48ec93c
...
@@ -3,7 +3,9 @@ import java.util.List;
...
@@ -3,7 +3,9 @@ import java.util.List;
import
javax.ejb.Local
;
import
javax.ejb.Local
;
import
fi.insomnia.bortal.enums.ActionLogMessageState
;
import
fi.insomnia.bortal.model.ActionLogMessage
;
import
fi.insomnia.bortal.model.ActionLogMessage
;
import
fi.insomnia.bortal.model.ActionLogMessageResponse
;
import
fi.insomnia.bortal.model.Role
;
import
fi.insomnia.bortal.model.Role
;
@Local
@Local
...
@@ -12,4 +14,6 @@ public interface ActionLogBeanLocal {
...
@@ -12,4 +14,6 @@ public interface ActionLogBeanLocal {
public
List
<
Role
>
getAssignableRoles
();
public
List
<
Role
>
getAssignableRoles
();
public
void
createActionLogEvent
(
String
message
,
Role
crew
,
boolean
isTask
);
public
void
createActionLogEvent
(
String
message
,
Role
crew
,
boolean
isTask
);
public
ActionLogMessage
find
(
Integer
id
);
public
ActionLogMessage
find
(
Integer
id
);
public
List
<
ActionLogMessageResponse
>
getActionLogMessageResponses
(
ActionLogMessage
id
);
public
void
addActionLogMessageResponse
(
ActionLogMessage
alm
,
String
message
,
ActionLogMessageState
state
);
}
}
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/VotingBeanLocal.java
0 → 100644
View file @
48ec93c
package
fi
.
insomnia
.
bortal
.
beans
;
import
javax.ejb.Local
;
@Local
public
interface
VotingBeanLocal
{
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/ActionLogMessage.java
View file @
48ec93c
package
fi
.
insomnia
.
bortal
.
model
;
package
fi
.
insomnia
.
bortal
.
model
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
javax.persistence.CascadeType
;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Entity
;
import
javax.persistence.EnumType
;
import
javax.persistence.EnumType
;
import
javax.persistence.Enumerated
;
import
javax.persistence.Enumerated
;
import
javax.persistence.FetchType
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.OneToMany
;
import
javax.persistence.OrderBy
;
import
javax.persistence.Table
;
import
javax.persistence.Table
;
import
javax.persistence.Temporal
;
import
javax.persistence.Temporal
;
import
javax.persistence.TemporalType
;
import
javax.persistence.TemporalType
;
import
org.eclipse.persistence.annotations.OptimisticLocking
;
import
org.eclipse.persistence.annotations.OptimisticLocking
;
import
org.eclipse.persistence.annotations.OptimisticLockingType
;
import
org.eclipse.persistence.annotations.OptimisticLockingType
;
import
org.eclipse.persistence.annotations.PrivateOwned
;
import
fi.insomnia.bortal.enums.ActionLogMessageState
;
import
fi.insomnia.bortal.enums.ActionLogMessageState
;
...
@@ -34,6 +42,11 @@ public class ActionLogMessage extends GenericEntity {
...
@@ -34,6 +42,11 @@ public class ActionLogMessage extends GenericEntity {
@Column
(
name
=
"message"
,
nullable
=
false
)
@Column
(
name
=
"message"
,
nullable
=
false
)
private
String
message
;
private
String
message
;
@OneToMany
(
mappedBy
=
"actionLogMessage"
,
cascade
=
CascadeType
.
ALL
)
@PrivateOwned
@OrderBy
(
"id"
)
private
List
<
ActionLogMessageResponse
>
actionLogMessageResponses
=
new
ArrayList
<
ActionLogMessageResponse
>();
@Column
(
name
=
"state"
,
nullable
=
true
)
@Column
(
name
=
"state"
,
nullable
=
true
)
@Enumerated
(
EnumType
.
STRING
)
@Enumerated
(
EnumType
.
STRING
)
...
@@ -79,4 +92,12 @@ public class ActionLogMessage extends GenericEntity {
...
@@ -79,4 +92,12 @@ public class ActionLogMessage extends GenericEntity {
this
.
state
=
state
;
this
.
state
=
state
;
}
}
public
List
<
ActionLogMessageResponse
>
getActionLogMessageResponses
()
{
return
actionLogMessageResponses
;
}
public
void
setActionLogMessageResponses
(
List
<
ActionLogMessageResponse
>
actionLogMessageResponses
)
{
this
.
actionLogMessageResponses
=
actionLogMessageResponses
;
}
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/ActionLogMessageResponse.java
0 → 100644
View file @
48ec93c
package
fi
.
insomnia
.
bortal
.
model
;
import
java.util.Date
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.EnumType
;
import
javax.persistence.Enumerated
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.Table
;
import
javax.persistence.Temporal
;
import
javax.persistence.TemporalType
;
import
org.eclipse.persistence.annotations.OptimisticLocking
;
import
org.eclipse.persistence.annotations.OptimisticLockingType
;
import
fi.insomnia.bortal.enums.ActionLogMessageState
;
@Entity
@Table
(
name
=
"actionlog_message_responses"
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
ActionLogMessageResponse
extends
GenericEntity
{
@Column
(
name
=
"time"
,
nullable
=
false
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Date
time
=
new
Date
();
@JoinColumn
(
name
=
"user_id"
)
private
User
user
;
@Column
(
name
=
"message"
,
nullable
=
false
)
private
String
message
;
@Column
(
name
=
"state_change"
,
nullable
=
true
)
@Enumerated
(
EnumType
.
STRING
)
private
ActionLogMessageState
stateChange
;
@JoinColumn
(
name
=
"actionlog_message_id"
,
referencedColumnName
=
"id"
)
@ManyToOne
(
optional
=
false
)
private
ActionLogMessage
actionLogMessage
;
public
Date
getTime
()
{
return
time
;
}
public
void
setTime
(
Date
time
)
{
this
.
time
=
time
;
}
public
User
getUser
()
{
return
user
;
}
public
void
setUser
(
User
user
)
{
this
.
user
=
user
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
ActionLogMessageState
getStateChange
()
{
return
stateChange
;
}
public
void
setStateChange
(
ActionLogMessageState
stateChange
)
{
this
.
stateChange
=
stateChange
;
}
public
ActionLogMessage
getActionLogMessage
()
{
return
actionLogMessage
;
}
public
void
setActionLogMessage
(
ActionLogMessage
message
)
{
this
.
actionLogMessage
=
message
;
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Compo.java
View file @
48ec93c
...
@@ -27,16 +27,6 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
...
@@ -27,16 +27,6 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
*/
*/
@Entity
@Entity
@Table
(
name
=
"compos"
)
@Table
(
name
=
"compos"
)
@NamedQueries
({
@NamedQuery
(
name
=
"Compo.findAll"
,
query
=
"SELECT c FROM Compo c"
),
@NamedQuery
(
name
=
"Compo.findByName"
,
query
=
"SELECT c FROM Compo c WHERE c.name = :name"
),
@NamedQuery
(
name
=
"Compo.findByStartTime"
,
query
=
"SELECT c FROM Compo c WHERE c.startTime = :startTime"
),
@NamedQuery
(
name
=
"Compo.findByVoteStart"
,
query
=
"SELECT c FROM Compo c WHERE c.voteStart = :voteStart"
),
@NamedQuery
(
name
=
"Compo.findByVoteEnd"
,
query
=
"SELECT c FROM Compo c WHERE c.voteEnd = :voteEnd"
),
@NamedQuery
(
name
=
"Compo.findBySubmitStart"
,
query
=
"SELECT c FROM Compo c WHERE c.submitStart = :submitStart"
),
@NamedQuery
(
name
=
"Compo.findBySubmitEnd"
,
query
=
"SELECT c FROM Compo c WHERE c.submitEnd = :submitEnd"
),
@NamedQuery
(
name
=
"Compo.findByHoldVoting"
,
query
=
"SELECT c FROM Compo c WHERE c.holdVoting = :holdVoting"
),
@NamedQuery
(
name
=
"Compo.findByDescription"
,
query
=
"SELECT c FROM Compo c WHERE c.description = :description"
)
})
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
Compo
extends
GenericEventChild
{
public
class
Compo
extends
GenericEventChild
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/CompoEntry.java
View file @
48ec93c
...
@@ -32,13 +32,6 @@ import org.eclipse.persistence.annotations.PrivateOwned;
...
@@ -32,13 +32,6 @@ import org.eclipse.persistence.annotations.PrivateOwned;
*/
*/
@Entity
@Entity
@Table
(
name
=
"entries"
)
@Table
(
name
=
"entries"
)
@NamedQueries
({
@NamedQuery
(
name
=
"CompoEntry.findAll"
,
query
=
"SELECT c FROM CompoEntry c"
),
@NamedQuery
(
name
=
"CompoEntry.findByCreated"
,
query
=
"SELECT c FROM CompoEntry c WHERE c.created = :created"
),
@NamedQuery
(
name
=
"CompoEntry.findByName"
,
query
=
"SELECT c FROM CompoEntry c WHERE c.name = :name"
),
@NamedQuery
(
name
=
"CompoEntry.findByNotes"
,
query
=
"SELECT c FROM CompoEntry c WHERE c.notes = :notes"
),
@NamedQuery
(
name
=
"CompoEntry.findByScreenMessage"
,
query
=
"SELECT c FROM CompoEntry c WHERE c.screenMessage = :screenMessage"
),
@NamedQuery
(
name
=
"CompoEntry.findBySort"
,
query
=
"SELECT c FROM CompoEntry c WHERE c.sort = :sort"
)
})
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
CompoEntry
extends
GenericEventChild
{
public
class
CompoEntry
extends
GenericEventChild
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/CompoEntryFile.java
View file @
48ec93c
...
@@ -27,13 +27,6 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
...
@@ -27,13 +27,6 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
*/
*/
@Entity
@Entity
@Table
(
name
=
"entry_files"
)
@Table
(
name
=
"entry_files"
)
@NamedQueries
({
@NamedQuery
(
name
=
"CompoEntryFile.findAll"
,
query
=
"SELECT c FROM CompoEntryFile c"
),
@NamedQuery
(
name
=
"CompoEntryFile.findByMimeType"
,
query
=
"SELECT c FROM CompoEntryFile c WHERE c.mimeType = :mimeType"
),
@NamedQuery
(
name
=
"CompoEntryFile.findByFileName"
,
query
=
"SELECT c FROM CompoEntryFile c WHERE c.fileName = :fileName"
),
@NamedQuery
(
name
=
"CompoEntryFile.findByDescription"
,
query
=
"SELECT c FROM CompoEntryFile c WHERE c.description = :description"
),
@NamedQuery
(
name
=
"CompoEntryFile.findByHash"
,
query
=
"SELECT c FROM CompoEntryFile c WHERE c.hash = :hash"
),
@NamedQuery
(
name
=
"CompoEntryFile.findByUploaded"
,
query
=
"SELECT c FROM CompoEntryFile c WHERE c.uploaded = :uploaded"
)
})
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
CompoEntryFile
extends
GenericEventChild
{
public
class
CompoEntryFile
extends
GenericEventChild
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/CompoEntryParticipant.java
View file @
48ec93c
...
@@ -21,10 +21,6 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
...
@@ -21,10 +21,6 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
*/
*/
@Entity
@Entity
@Table
(
name
=
"entry_participations"
)
@Table
(
name
=
"entry_participations"
)
@NamedQueries
({
@NamedQuery
(
name
=
"CompoEntryParticipant.findAll"
,
query
=
"SELECT c FROM CompoEntryParticipant c"
),
@NamedQuery
(
name
=
"CompoEntryParticipant.findByRole"
,
query
=
"SELECT c FROM CompoEntryParticipant c WHERE c.role = :role"
)
})
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
CompoEntryParticipant
extends
GenericEventChild
{
public
class
CompoEntryParticipant
extends
GenericEventChild
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Vote.java
View file @
48ec93c
...
@@ -26,10 +26,6 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
...
@@ -26,10 +26,6 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
*/
*/
@Entity
@Entity
@Table
(
name
=
"votes"
,
uniqueConstraints
=
{
@UniqueConstraint
(
columnNames
=
{
"entry_id"
,
"event_id"
,
"voter_user_id"
})
})
@Table
(
name
=
"votes"
,
uniqueConstraints
=
{
@UniqueConstraint
(
columnNames
=
{
"entry_id"
,
"event_id"
,
"voter_user_id"
})
})
@NamedQueries
({
@NamedQuery
(
name
=
"Vote.findAll"
,
query
=
"SELECT v FROM Vote v"
),
@NamedQuery
(
name
=
"Vote.findByScore"
,
query
=
"SELECT v FROM Vote v WHERE v.score = :score"
),
@NamedQuery
(
name
=
"Vote.findByTime"
,
query
=
"SELECT v FROM Vote v WHERE v.time = :time"
)
})
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
Vote
extends
GenericEventChild
{
public
class
Vote
extends
GenericEventChild
{
...
...
code/LanBortalUtilities/src/fi/insomnia/bortal/enums/ActionLogMessageState.java
View file @
48ec93c
...
@@ -3,5 +3,10 @@ package fi.insomnia.bortal.enums;
...
@@ -3,5 +3,10 @@ package fi.insomnia.bortal.enums;
public
enum
ActionLogMessageState
{
public
enum
ActionLogMessageState
{
NEW
,
NEW
,
PENDING
,
PENDING
,
DONE
DONE
;
public
String
getKey
(){
return
"actionlog.messagestate."
+
name
();
}
}
}
code/LanBortalUtilities/src/fi/insomnia/bortal/enums/apps/ContentPermission.java
View file @
48ec93c
package
fi
.
insomnia
.
bortal
.
enums
.
apps
;
package
fi
.
insomnia
.
bortal
.
enums
.
apps
;
import
fi.insomnia.bortal.enums.BortalApplication
;
import
fi.insomnia.bortal.enums.BortalApplication
;
public
enum
ContentPermission
implements
IAppPermission
{
public
enum
ContentPermission
implements
IAppPermission
{
MANAGE_NEWS
(
"Manage newsgroups"
),
MANAGE_NEWS
(
"Manage newsgroups"
),
MANAGE_PAGES
(
"Manage pages"
),
MANAGE_PAGES
(
"Manage pages"
),
MANAGE_ACTIONLOG
(
""
),
;
;
public
static
final
String
S_MANAGE_NEWS
=
"CONTENT/MANAGE_NEWS"
;
public
static
final
String
S_MANAGE_NEWS
=
"CONTENT/MANAGE_NEWS"
;
public
static
final
String
S_MANAGE_PAGES
=
"CONTENT/MANAGE_PAGES"
;
public
static
final
String
S_MANAGE_PAGES
=
"CONTENT/MANAGE_PAGES"
;
public
static
final
String
S_MANAGE_ACTIONLOG
=
"CONTENT/MANAGE_ACTIONLOG"
;
private
String
description
;
private
String
fullName
;
private
String
description
;
private
String
fullName
;
private
ContentPermission
(
String
desc
)
{
this
.
description
=
desc
;
private
ContentPermission
(
String
desc
)
{
fullName
=
new
StringBuilder
().
append
(
getParent
().
toString
()).
append
(
DELIMITER
).
append
(
toString
()).
toString
();
this
.
description
=
desc
;
}
fullName
=
new
StringBuilder
().
append
(
getParent
().
toString
()).
append
(
DELIMITER
).
append
(
toString
()).
toString
();
}
@Override
public
BortalApplication
getParent
()
{
@Override
return
BortalApplication
.
CONTENT
;
public
BortalApplication
getParent
()
{
}
return
BortalApplication
.
CONTENT
;
}
@Override
public
String
getDescription
()
{
@Override
return
this
.
description
;
public
String
getDescription
()
{
}
return
this
.
description
;
}
@Override
public
String
getFullName
()
{
@Override
return
fullName
;
public
String
getFullName
()
{
}
return
fullName
;
}
}
}
code/LanBortalWeb/WebContent/actionlog/messagelist.xhtml
View file @
48ec93c
...
@@ -77,7 +77,8 @@
...
@@ -77,7 +77,8 @@
<h:outputText
value=
"#{message.message}"
/>
<h:outputText
value=
"#{message.message}"
/>
</h:column>
</h:column>
<h:column>
<h:column>
<h:link
rendered=
"#{!empty message.state}"
>
<h:link
rendered=
"#{!empty message.state}"
outcome=
"taskview"
>
<f:param
name=
"id"
value=
"#{message.id}"
/>
Näytä tehtävä
Näytä tehtävä
</h:link>
</h:link>
</h:column>
</h:column>
...
...
code/LanBortalWeb/WebContent/actionlog/taskview.xhtml
View file @
48ec93c
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:users=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:users=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:tools=
"http://java.sun.com/jsf/composite/cditools"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:tools=
"http://java.sun.com/jsf/composite/cditools"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:p=
"http://primefaces.org/ui"
>
>
<h:body>
<h:body>
...
@@ -14,34 +15,86 @@
...
@@ -14,34 +15,86 @@
</f:metadata>
</f:metadata>
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
<h:outputStylesheet
library=
"style"
name=
"insomnia2/css/actionlog.css"
></h:outputStylesheet>
<h:outputStylesheet
library=
"style"
name=
"insomnia2/css/actionlog.css"
></h:outputStylesheet>
<h1>
Task
: insert id
<!-- #{i18n['actionlog.messagelist.header']} -->
</h1>
<h1>
Task
id: #{taskModificationView.message.id}
<!-- #{i18n['actionlog.messagelist.header']} -->
</h1>
<!-- <p>Mo #{i18n['actionlog.messagelist.description']} </p> -->
<!-- <p>Mo #{i18n['actionlog.messagelist.description']} </p> -->
<table>
<div>
<tr>
<table>
<td><h:outputText
class=
"taskHeader"
value=
"Submit time/date: "
/></td>
<tr>
<td><h:outputText
value=
"#{taskModification.message.time}"
/></td>
<td><h:outputText
class=
"taskHeader"
value=
"#{i18n['actionlog.time']}: "
/></td>
</tr>
<td><h:outputText
value=
"#{taskModificationView.message.time}"
>
<tr>
<f:convertDateTime
type=
"both"
pattern=
"dd.MM.yyyy HH:mm"
/>
<td><h:outputText
class=
"taskHeader"
value=
"Submitter: "
/></td>
</h:outputText></td>
<td><h:outputText
value=
"infopoika69"
/></td>
</tr>
</tr>
<tr>
<tr>
<td><h:outputText
class=
"taskHeader"
value=
"#{i18n['actionlog.user']}: "
/></td>
<td><h:outputText
class=
"taskHeader"
value=
"Target crew: "
/></td>
<td><h:outputText
value=
"#{taskModificationView.message.user.nick}"
/></td>
<td><h:outputText
value=
"net"
/></td>
</tr>
</tr>
<tr>
<tr>
<td><h:outputText
class=
"taskHeader"
value=
"#{i18n['actionlog.crew']}: "
/></td>
<td><h:outputText
class=
"taskHeader"
value=
"State: "
/></td>
<td><h:outputText
value=
"#{taskModificationView.message.crew.name}"
/></td>
<td><h:outputText
value=
"odottaa nappaamista"
/></td>
</tr>
</tr>
<tr>
<tr>
<td><h:outputText
class=
"taskHeader"
value=
"#{i18n['actionlog.state']}: "
/></td>
<td><h:outputText
class=
"taskHeader"
value=
"Message: "
/></td>
<td><h:outputText
value=
"#{i18n[taskModificationView.message.state.key]}"
/></td>
<td><h:outputText
value=
"verkko ei toimi."
/></td>
</tr>
</tr>
<tr>
</table>
<td><h:outputText
class=
"taskHeader"
value=
"#{i18n['actionlog.message']}: "
/></td>
<td><h:outputText
value=
"#{taskModificationView.message.message}"
/></td>
</tr>
</table>
</div>
<div
class=
"clearfix"
></div>
<div
class=
"clearfix"
></div>
<hr
style=
"width:90%;"
/>
<div
id=
"actionlog"
>
<div>
<h:form>
<p:poll
interval=
"1"
update=
"messageresponsetable"
/>
<h:dataTable
id=
"messageresponsetable"
value=
"#{taskModificationView.responses}"
var=
"response"
>
<h:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"Aika"
/>
</f:facet>
<h:outputText
value=
"#{response.time}"
>
<f:convertDateTime
type=
"both"
pattern=
"dd.MM.yyyy HH:mm"
/>
</h:outputText>
</h:column>
<h:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"Submitter"
/>
</f:facet>
<h:outputText
value=
"#{response.user.nick}"
/>
</h:column>
<h:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"Message"
/>
</f:facet>
<h:outputText
value=
"#{response.message}"
/>
</h:column>
<h:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"tilanvaihdos"
/>
</f:facet>
<h:outputText
value=
"#{i18n[response.stateChange.key]}"
/>
</h:column>
</h:dataTable>
</h:form>
</div>
<div>
<h:form>
<h3>
Lisää viesti
</h3>
<h:outputText
value=
"Viestisi: "
/>
<h:inputText
value=
"#{taskModificationView.responseMessage}"
size=
"100"
/>
<h:outputText
value=
"Tila: "
/>
<h:selectOneMenu
id=
"stateMenu"
title=
"asdas"
value=
"#{taskModificationView.responseStateChange}"
>
<f:selectItem
itemLabel=
"Ei muutosta"
itemValue=
"#{null}"
/>
<f:selectItem
itemLabel=
"Uusi"
itemValue=
"NEW"
/>
<f:selectItem
itemLabel=
"Työn alla"
itemValue=
"PENDING"
/>
<f:selectItem
itemLabel=
"Tehty"
itemValue=
"DONE"
/>
</h:selectOneMenu>
<h:commandButton
class=
"sendbutton2"
value=
"#{i18n['actionlog.create.submitbutton']}"
action=
"#{taskModificationView.createResponse}"
/>
</h:form>
</div>
</div>
</ui:define>
</ui:define>
</ui:composition>
</ui:composition>
...
...
code/LanBortalWeb/WebContent/resources/style/insomnia2/css/actionlog.css
View file @
48ec93c
...
@@ -83,4 +83,9 @@
...
@@ -83,4 +83,9 @@
color
:
#7DAC0C
;
color
:
#7DAC0C
;
font-size
:
120%
;
font-size
:
120%
;
font-weight
:
bold
;
font-weight
:
bold
;
}
.sendbutton2
{
border
:
1px
solid
#aaa
;
margin-left
:
10px
;
}
}
\ No newline at end of file
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
View file @
48ec93c
This diff is collapsed.
Click to expand it.
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/actionlog/ActionLogCreateView.java
View file @
48ec93c
package
fi
.
insomnia
.
bortal
.
web
.
cdiview
.
actionlog
;
package
fi
.
insomnia
.
bortal
.
web
.
cdiview
.
actionlog
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
...
@@ -9,7 +8,6 @@ import javax.inject.Named;
...
@@ -9,7 +8,6 @@ import javax.inject.Named;
import
javax.validation.constraints.Size
;
import
javax.validation.constraints.Size
;
import
fi.insomnia.bortal.beans.ActionLogBeanLocal
;
import
fi.insomnia.bortal.beans.ActionLogBeanLocal
;
import
fi.insomnia.bortal.beans.RoleBeanLocal
;
import
fi.insomnia.bortal.model.Role
;
import
fi.insomnia.bortal.model.Role
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/actionlog/TaskModificationView.java
View file @
48ec93c
...
@@ -4,26 +4,60 @@ import javax.ejb.EJB;
...
@@ -4,26 +4,60 @@ import javax.ejb.EJB;
import
javax.enterprise.context.ConversationScoped
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.inject.Named
;
import
javax.inject.Named
;
import
java.util.List
;
import
fi.insomnia.bortal.beans.ActionLogBeanLocal
;
import
fi.insomnia.bortal.beans.ActionLogBeanLocal
;
import
fi.insomnia.bortal.enums.ActionLogMessageState
;
import
fi.insomnia.bortal.enums.apps.ContentPermission
;
import
fi.insomnia.bortal.model.ActionLogMessage
;
import
fi.insomnia.bortal.model.ActionLogMessage
;
import
fi.insomnia.bortal.model.ActionLogMessageResponse
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
@Named
@Named
@ConversationScoped
@ConversationScoped
public
class
TaskModificationView
extends
GenericCDIView
{
public
class
TaskModificationView
extends
GenericCDIView
{
/**
*
*/
private
static
final
long
serialVersionUID
=
938879097893244897L
;
private
Integer
id
;
private
Integer
id
;
private
ActionLogMessage
message
;
private
ActionLogMessage
message
;
private
List
<
ActionLogMessageResponse
>
responses
;
private
String
responseMessage
;
private
ActionLogMessageState
responseStateChange
;
@EJB
@EJB
private
ActionLogBeanLocal
logbean
;
private
ActionLogBeanLocal
logbean
;
public
void
initView
(){
public
void
initView
(){
if
(
message
==
null
)
{
if
(
super
.
requirePermissions
(
ContentPermission
.
MANAGE_ACTIONLOG
)
&&
message
==
null
)
{
super
.
beginConversation
();
super
.
beginConversation
();
message
=
logbean
.
find
(
id
);
message
=
logbean
.
find
(
id
);
}
}
}
}
public
void
createResponse
()
{
if
(
responseStateChange
==
null
||
responseStateChange
==
message
.
getState
())
logbean
.
addActionLogMessageResponse
(
message
,
responseMessage
,
null
);
else
{
logbean
.
addActionLogMessageResponse
(
message
,
responseMessage
,
responseStateChange
);
if
(
responseStateChange
!=
message
.
getState
())
{
this
.
message
=
logbean
.
find
(
id
);
}
}
responseMessage
=
""
;
responseStateChange
=
null
;
}
public
List
<
ActionLogMessageResponse
>
getResponses
()
{
responses
=
logbean
.
getActionLogMessageResponses
(
message
);
return
responses
;
}
public
ActionLogMessage
getMessage
(){
return
message
;
}
public
Integer
getId
()
{
public
Integer
getId
()
{
return
id
;
return
id
;
}
}
...
@@ -32,4 +66,20 @@ public class TaskModificationView extends GenericCDIView {
...
@@ -32,4 +66,20 @@ public class TaskModificationView extends GenericCDIView {
this
.
id
=
id
;
this
.
id
=
id
;
}
}
public
String
getResponseMessage
()
{
return
responseMessage
;
}
public
void
setResponseMessage
(
String
responseMessage
)
{
this
.
responseMessage
=
responseMessage
;
}
public
ActionLogMessageState
getResponseStateChange
()
{
return
responseStateChange
;
}
public
void
setResponseStateChange
(
ActionLogMessageState
responseStateChange
)
{
this
.
responseStateChange
=
responseStateChange
;
}
}
}
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserCardView.java
View file @
48ec93c
...
@@ -15,6 +15,8 @@ import fi.insomnia.bortal.web.cdiview.GenericCDIView;
...
@@ -15,6 +15,8 @@ import fi.insomnia.bortal.web.cdiview.GenericCDIView;
@Named
@Named
@ConversationScoped
@ConversationScoped
public
class
UserCardView
extends
GenericCDIView
{
public
class
UserCardView
extends
GenericCDIView
{
private
static
final
long
serialVersionUID
=
-
7316229268164228981L
;
@EJB
@EJB
private
CardTemplateBeanLocal
cardBean
;
private
CardTemplateBeanLocal
cardBean
;
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/converter/GenericIntegerEntityConverter.java
View file @
48ec93c
...
@@ -58,9 +58,15 @@ public abstract class GenericIntegerEntityConverter<T extends ModelInterface<Int
...
@@ -58,9 +58,15 @@ public abstract class GenericIntegerEntityConverter<T extends ModelInterface<Int
T
ret
=
null
;
T
ret
=
null
;
Integer
id
=
null
;
Integer
id
=
null
;
if
(
value
!=
null
)
{
if
(
value
!=
null
)
{
id
=
Integer
.
parseInt
(
value
);
try
{
if
(
id
!=
null
)
{
id
=
Integer
.
parseInt
(
value
);
ret
=
find
(
id
);
if
(
id
!=
null
)
{
ret
=
find
(
id
);
}
}
catch
(
NumberFormatException
nfe
)
{
if
(
value
==
null
||
!
value
.
equals
(
"null"
))
{
throw
nfe
;
}
}
}
}
}
logger
.
debug
(
"Converted String {} to Integer {} became object {}"
,
new
Object
[]
{
value
,
id
,
ret
});
logger
.
debug
(
"Converted String {} to Integer {} became object {}"
,
new
Object
[]
{
value
,
id
,
ret
});
...
@@ -78,6 +84,10 @@ public abstract class GenericIntegerEntityConverter<T extends ModelInterface<Int
...
@@ -78,6 +84,10 @@ public abstract class GenericIntegerEntityConverter<T extends ModelInterface<Int
ret
=
entity
.
getId
().
toString
();
ret
=
entity
.
getId
().
toString
();
}
}
}
}
if
(
ret
==
null
)
{
ret
=
"null"
;
}
return
ret
;
return
ret
;
}
}
//
//
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment