use of org.apache.directory.fortress.core.model.Hier in project directory-fortress-core by apache.
the class AdminRoleUtil method loadGraph.
/**
* Read this ldap record,{@code cn=Hierarchies, ou=OS-P} into this entity, {@link Hier}, before loading into this collection class,{@code org.jgrapht.graph.SimpleDirectedGraph}
* using 3rd party lib, <a href="http://www.jgrapht.org/">JGraphT</a>.
*
* @param contextId maps to sub-tree in DIT, e.g. ou=contextId, dc=example, dc=com.
* @return handle to simple digraph containing adminRole hierarchies.
*/
private static synchronized SimpleDirectedGraph<String, Relationship> loadGraph(String contextId) {
Hier inHier = new Hier(Hier.Type.ROLE);
inHier.setContextId(contextId);
LOG.info("loadGraph initializing ADMIN ROLE context [{}]", inHier.getContextId());
List<Graphable> descendants = null;
try {
descendants = adminRoleP.getAllDescendants(inHier.getContextId());
} catch (SecurityException se) {
LOG.info("loadGraph caught SecurityException={}", se);
}
Hier hier = HierUtil.loadHier(contextId, descendants);
SimpleDirectedGraph<String, Relationship> graph;
graph = HierUtil.buildGraph(hier);
adminRoleCache.put(getKey(contextId), graph);
return graph;
}
use of org.apache.directory.fortress.core.model.Hier in project directory-fortress-core by apache.
the class RoleUtil method loadGraph.
/**
* Read this ldap record,{@code cn=Hierarchies, ou=OS-P} into this entity, {@link Hier}, before loading into this collection class,{@code org.jgrapht.graph.SimpleDirectedGraph}
* using 3rd party lib, <a href="http://www.jgrapht.org/">JGraphT</a>.
*
* @param contextId maps to sub-tree in DIT, e.g. ou=contextId, dc=example, dc=com.
* @return handle to simple digraph containing role hierarchies.
*/
private synchronized SimpleDirectedGraph<String, Relationship> loadGraph(String contextId) {
Hier inHier = new Hier(Hier.Type.ROLE);
inHier.setContextId(contextId);
LOG.info("loadGraph initializing ROLE context [{}]", inHier.getContextId());
List<Graphable> descendants = null;
try {
descendants = roleP.getAllDescendants(inHier.getContextId());
} catch (SecurityException se) {
LOG.info("loadGraph caught SecurityException={}", se);
}
Hier hier = HierUtil.loadHier(contextId, descendants);
SimpleDirectedGraph<String, Relationship> graph;
graph = HierUtil.buildGraph(hier);
roleCache.put(getKey(contextId), graph);
return graph;
}
use of org.apache.directory.fortress.core.model.Hier in project directory-fortress-core by apache.
the class AdminMgrConsole method toHierTest.
/**
* @param graph
* @return
* @throws org.apache.directory.fortress.core.SecurityException
*/
public static Hier toHierTest(UndirectedGraph<String, Relationship> graph) {
Hier he = new Hier();
Set<Relationship> eSet = graph.edgeSet();
for (Relationship edge : eSet) {
// Edge:(User : Root)
he.setRelationship(edge);
}
Set<String> vSet = graph.vertexSet();
for (String vertice : vSet) {
// he.addRole(vertice);
}
return he;
}
use of org.apache.directory.fortress.core.model.Hier in project directory-fortress-core by apache.
the class UsoUtil method loadGraph.
/**
* Read this ldap record,{@code cn=Hierarchies, ou=OS-P} into this entity, {@link Hier}, before loading into this collection class,{@code org.jgrapht.graph.SimpleDirectedGraph}
* using 3rd party lib, <a href="http://www.jgrapht.org/">JGraphT</a>.
*
* @param contextId maps to sub-tree in DIT, e.g. ou=contextId, dc=example, dc=com.
* @return handle to simple digraph containing user ou hierarchies.
*/
private synchronized SimpleDirectedGraph<String, Relationship> loadGraph(String contextId) {
Hier inHier = new Hier(Hier.Type.ROLE);
inHier.setContextId(contextId);
LOG.info("loadGraph initializing USO context [{}]", inHier.getContextId());
List<Graphable> descendants = null;
try {
OrgUnit orgUnit = new OrgUnit();
orgUnit.setType(OrgUnit.Type.USER);
orgUnit.setContextId(contextId);
descendants = orgUnitP.getAllDescendants(orgUnit);
} catch (SecurityException se) {
LOG.info("loadGraph caught SecurityException={}", se);
}
Hier hier = HierUtil.loadHier(contextId, descendants);
SimpleDirectedGraph<String, Relationship> graph;
graph = HierUtil.buildGraph(hier);
usoCache.put(getKey(contextId), graph);
return graph;
}
use of org.apache.directory.fortress.core.model.Hier in project directory-fortress-core by apache.
the class PsoUtil method loadGraph.
/**
* Read this ldap record,{@code cn=Hierarchies, ou=OS-P} into this entity, {@link Hier}, before loading into this collection class,{@code org.jgrapht.graph.SimpleDirectedGraph}
* using 3rd party lib, <a href="http://www.jgrapht.org/">JGraphT</a>.
*
* @param contextId maps to sub-tree in DIT, e.g. ou=contextId, dc=example, dc=com.
* @return handle to simple digraph containing perm ou hierarchies.
*/
private synchronized SimpleDirectedGraph<String, Relationship> loadGraph(String contextId) {
Hier inHier = new Hier(Hier.Type.ROLE);
inHier.setContextId(contextId);
LOG.info("loadGraph initializing PSO context [{}]", inHier.getContextId());
List<Graphable> descendants = null;
try {
OrgUnit orgUnit = new OrgUnit();
orgUnit.setType(OrgUnit.Type.PERM);
orgUnit.setContextId(contextId);
descendants = orgUnitP.getAllDescendants(orgUnit);
} catch (SecurityException se) {
LOG.info("loadGraph caught SecurityException={}", se);
}
Hier hier = HierUtil.loadHier(contextId, descendants);
SimpleDirectedGraph<String, Relationship> graph;
graph = HierUtil.buildGraph(hier);
psoCache.put(getKey(contextId), graph);
return graph;
}
Aggregations