Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Antti Väyrynen
/
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 9a4f2c3a
authored
Mar 21, 2010
by
Juho Juopperi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of dev.intra.insomnia.fi:/data/bortal
2 parents
414a825e
f4a76ba2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
4 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/RoleBean.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/RoleBeanLocal.java
code/LanBortalWeb/WebContent/resources/tools/role/form.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/view/RoleView.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/RoleBean.java
View file @
9a4f2c3
...
@@ -2,12 +2,14 @@
...
@@ -2,12 +2,14 @@
* To change this template, choose Tools | Templates
* To change this template, choose Tools | Templates
* and open the template in the editor.
* and open the template in the editor.
*/
*/
package
fi
.
insomnia
.
bortal
.
beans
;
package
fi
.
insomnia
.
bortal
.
beans
;
import
fi.insomnia.bortal.facade.RoleFacade
;
import
fi.insomnia.bortal.facade.RoleFacade
;
import
fi.insomnia.bortal.model.Role
;
import
fi.insomnia.bortal.model.Role
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
import
javax.ejb.Stateless
;
import
javax.ejb.Stateless
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -22,7 +24,6 @@ public class RoleBean implements RoleBeanLocal {
...
@@ -22,7 +24,6 @@ public class RoleBean implements RoleBeanLocal {
@EJB
@EJB
private
RoleFacade
roleFacade
;
private
RoleFacade
roleFacade
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
RoleBean
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
RoleBean
.
class
);
public
List
<
Role
>
listRoles
()
{
public
List
<
Role
>
listRoles
()
{
...
@@ -41,8 +42,43 @@ public class RoleBean implements RoleBeanLocal {
...
@@ -41,8 +42,43 @@ public class RoleBean implements RoleBeanLocal {
return
role
;
return
role
;
}
}
public
List
<
Role
>
getPossibleParents
(
Role
role
)
{
List
<
Role
>
roleList
=
listRoles
();
List
<
Role
>
children
=
getAllChilds
(
role
,
new
HashSet
<
Role
>());
for
(
Role
unit
:
children
)
{
if
(
roleList
.
contains
(
role
))
{
roleList
.
remove
(
role
);
}
}
return
roleList
;
}
private
static
List
<
Role
>
getAllChilds
(
Role
role
,
Set
<
Role
>
checkedRoles
)
{
List
<
Role
>
returnList
=
new
ArrayList
<
Role
>();
if
(
checkedRoles
.
contains
(
role
))
{
return
returnList
;
}
for
(
Role
unit
:
role
.
getChildren
())
{
List
<
Role
>
someList
=
getAllChilds
(
unit
,
checkedRoles
);
returnList
.
addAll
(
someList
);
}
checkedRoles
.
add
(
role
);
return
returnList
;
}
// Add business logic below. (Right-click in editor and choose
// Add business logic below. (Right-click in editor and choose
// "Insert Code > Add Business Method")
// "Insert Code > Add Business Method")
}
}
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/RoleBeanLocal.java
View file @
9a4f2c3
...
@@ -21,5 +21,7 @@ public interface RoleBeanLocal {
...
@@ -21,5 +21,7 @@ public interface RoleBeanLocal {
public
void
mergeChanges
(
Role
role
);
public
void
mergeChanges
(
Role
role
);
public
Role
create
(
Role
role
);
public
Role
create
(
Role
role
);
public
List
<
Role
>
getPossibleParents
(
Role
role
);
}
}
code/LanBortalWeb/WebContent/resources/tools/role/form.xhtml
View file @
9a4f2c3
...
@@ -14,6 +14,10 @@
...
@@ -14,6 +14,10 @@
<ui:composition>
<ui:composition>
<h:panelGrid>
<h:panelGrid>
<h:outputText
value=
"#{i18n['role.name']}"
/><h:inputText
value=
"#{roleView.role.name}"
/>
<h:outputText
value=
"#{i18n['role.name']}"
/><h:inputText
value=
"#{roleView.role.name}"
/>
<h:selectManyListbox
value=
"#{roleView.role.parents}"
>
<f:selectItems
value=
"#{roleView.possibleParents}"
/>
</h:selectManyListbox>
</h:panelGrid>
</h:panelGrid>
</ui:composition>
</ui:composition>
</html>
</html>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/view/RoleView.java
View file @
9a4f2c3
...
@@ -9,6 +9,7 @@ import fi.insomnia.bortal.beans.SecurityBeanLocal;
...
@@ -9,6 +9,7 @@ import fi.insomnia.bortal.beans.SecurityBeanLocal;
import
fi.insomnia.bortal.exceptions.PermissionDeniedException
;
import
fi.insomnia.bortal.exceptions.PermissionDeniedException
;
import
fi.insomnia.bortal.handler.SessionHandler
;
import
fi.insomnia.bortal.handler.SessionHandler
;
import
fi.insomnia.bortal.model.Role
;
import
fi.insomnia.bortal.model.Role
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
import
javax.faces.bean.ManagedBean
;
import
javax.faces.bean.ManagedBean
;
import
javax.faces.bean.ManagedProperty
;
import
javax.faces.bean.ManagedProperty
;
...
@@ -107,4 +108,11 @@ public class RoleView {
...
@@ -107,4 +108,11 @@ public class RoleView {
public
void
setSessionhandler
(
SessionHandler
sessionhandler
)
{
public
void
setSessionhandler
(
SessionHandler
sessionhandler
)
{
this
.
sessionhandler
=
sessionhandler
;
this
.
sessionhandler
=
sessionhandler
;
}
}
/**
* @return the possibleParents
*/
public
List
<
Role
>
getPossibleParents
()
{
return
roleBean
.
getPossibleParents
(
role
);
}
}
}
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