Class GraphNode
java.lang.Object
edu.internet2.middleware.grouper.app.graph.GraphNode
A GraphNode is a vertex of the directed graph. It holds a single {link GrouperObject}
entity, and exposes that object's hashCode and equals methods, so that GraphNodes can
be added to Sets without duplicate objects. This class has facilities for keeping track
of ancillary data, such as parent nodes and child nodes, the node's distance from the
start node, member count, and flags for whether the node's parents and children
have been visited. Maintaining this data is optional, and is up to the caller to
set them meaningfully.
-
Constructor Summary
ConstructorDescriptionGraphNode
(GrouperObject grouperObject) General constructor for a GraphNode containing a grouper Object.GraphNode
(GrouperObject grouperObject, boolean isStartNode) Constructor that also marks the node as the starting node for the graph -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChildNode
(GraphNode childNode) Adds a child node to the collectionvoid
addObjectTypeName
(String objectTypeName) Adds one object type name to the node's current list.void
addParentNode
(GraphNode parentNode) adds a parent node to the collectionvoid
boolean
Compares two nodes and considers them equal if they both hold the same GrouperObject.long
The total member count as set by the caller.Gets the child nodes linked to this node.long
the direct member count as set by the callerlong
Returns the number of hops from the starting node to this node.returns the underlying GrouperObject valuehelper method to get the id of the underlying GrouperObjectHelper method to get the id of the underlying GrouperObjectthe grouper object types for a group or stem, as set by the creator of this nodeGets the parent nodes linked to this node.gets the style object type enumtrue if this is a group node and the subject is a member of this group null is returned if the check is not being doneint
hashCode()
Computes the hashCode based on the contained GrouperObjectboolean
True if the underlying Grouper object is group the has a composite type of COMPLEMENTboolean
isGroup()
True if the underlying Grouper object is aGroup
boolean
True if the underlying Grouper object is group the has a composite type of INTERSECTboolean
True if the underlying Grouper object is a group set up as a Grouper Loader job (either SQL or LDAP).boolean
True if the underlying Grouper object is aGrouperObjectProvisionerWrapper
boolean
True if the underlying Grouper object is a group set up as a SQL_SIMPLE or LDAP_SIMPLE Grouper Loader jobboolean
True if this is the starting node.boolean
isStem()
True if the underlying Grouper object is aStem
boolean
True if the underlying Grouper object is aGrouperObjectSubjectWrapper
boolean
virtual method that returns true if both parents and children have been visitedboolean
Returns whether the child nodes have been visited.boolean
returns whether the parent nodes have been visited.void
setAllMemberCount
(long allMemberCount) sets the total member count for this nodevoid
setDirectMemberCount
(long directMemberCount) sets the direct member count for this node.void
setDistanceFromStartNode
(long distanceFromStartNode) Sets the number of hops from the starting node to this node.void
setObjectTypeNames
(List<String> objectTypeNames) sets the list of grouper object type namesvoid
setStartNode
(boolean startNode) sets whether this is the start nodevoid
setSubjectIsMember
(Boolean subjectIsMember) true if this is a group node and the subject is a member of this group null if the check is not being donevoid
setVisitedChildren
(boolean visitedChildren) marks this node as having visited all its child nodesvoid
setVisitedParents
(boolean visitedParents) marks this node as having visited all its parent nodestoString()
-
Constructor Details
-
GraphNode
Constructor that also marks the node as the starting node for the graph- Parameters:
grouperObject
-isStartNode
-
-
GraphNode
General constructor for a GraphNode containing a grouper Object.- Parameters:
grouperObject
-
-
-
Method Details
-
equals
Compares two nodes and considers them equal if they both hold the same GrouperObject. -
hashCode
public int hashCode()Computes the hashCode based on the contained GrouperObject -
determineStyles
public void determineStyles() -
getGrouperObject
returns the underlying GrouperObject value- Returns:
- the internal GrouperObject value
-
getAllMemberCount
public long getAllMemberCount()The total member count as set by the caller.- Returns:
-
getObjectTypeNames
the grouper object types for a group or stem, as set by the creator of this node- Returns:
- the object type names
-
getDirectMemberCount
public long getDirectMemberCount()the direct member count as set by the caller- Returns:
-
setAllMemberCount
public void setAllMemberCount(long allMemberCount) sets the total member count for this node- Parameters:
allMemberCount
- member count
-
setDirectMemberCount
public void setDirectMemberCount(long directMemberCount) sets the direct member count for this node.- Parameters:
directMemberCount
- member count
-
setObjectTypeNames
sets the list of grouper object type names- Parameters:
objectTypeNames
-
-
addObjectTypeName
Adds one object type name to the node's current list.- Parameters:
objectTypeName
-
-
isVisited
public boolean isVisited()virtual method that returns true if both parents and children have been visited- Returns:
-
isVisitedParents
public boolean isVisitedParents()returns whether the parent nodes have been visited. Set by the caller- Returns:
- true if parent nodes have been visited
-
setVisitedParents
public void setVisitedParents(boolean visitedParents) marks this node as having visited all its parent nodes- Parameters:
visitedParents
-
-
isVisitedChildren
public boolean isVisitedChildren()Returns whether the child nodes have been visited. Set by the caller- Returns:
- true if child nodes have been visited
-
setVisitedChildren
public void setVisitedChildren(boolean visitedChildren) marks this node as having visited all its child nodes- Parameters:
visitedChildren
-
-
getParentNodes
Gets the parent nodes linked to this node. Set by the caller- Returns:
- the set of all parent nodes reachable by this node
-
addParentNode
adds a parent node to the collection- Parameters:
parentNode
- parent node to add
-
getChildNodes
Gets the child nodes linked to this node. Set by the caller- Returns:
- the set of all child nodes reachable by this node
-
addChildNode
Adds a child node to the collection- Parameters:
childNode
- child node to add
-
getDistanceFromStartNode
public long getDistanceFromStartNode()Returns the number of hops from the starting node to this node. The value is set by the caller, but by convention parents of the start node will be negative numbers. The value should be zero only for the starting node.- Returns:
- Distance from the starting node
-
setDistanceFromStartNode
public void setDistanceFromStartNode(long distanceFromStartNode) Sets the number of hops from the starting node to this node. If this is a parent of the start node, will be less than zero- Parameters:
distanceFromStartNode
-
-
isStem
public boolean isStem()True if the underlying Grouper object is aStem
- Returns:
- whether the Grouper object is a stem
-
isGroup
public boolean isGroup()True if the underlying Grouper object is aGroup
- Returns:
- whether the Grouper object is a group
-
isSubject
public boolean isSubject()True if the underlying Grouper object is aGrouperObjectSubjectWrapper
- Returns:
- whether the Grouper object is a subject wrapped as a GrouperObjectSubjectWrapper
-
isLoaderGroup
public boolean isLoaderGroup()True if the underlying Grouper object is a group set up as a Grouper Loader job (either SQL or LDAP).- Returns:
- whether the Grouper object is a group with loader settings
-
isSimpleLoaderGroup
public boolean isSimpleLoaderGroup()True if the underlying Grouper object is a group set up as a SQL_SIMPLE or LDAP_SIMPLE Grouper Loader job- Returns:
- whether the Grouper object is a group with loader settings
-
isProvisionerTarget
public boolean isProvisionerTarget()True if the underlying Grouper object is aGrouperObjectProvisionerWrapper
- Returns:
- whether the Grouper object is a provisioner object wrapped as a GrouperObjectProvisionerWrapper
-
isIntersectGroup
public boolean isIntersectGroup()True if the underlying Grouper object is group the has a composite type of INTERSECT- Returns:
- whether the Grouper object has a composite INTERSECT type
-
isComplementGroup
public boolean isComplementGroup()True if the underlying Grouper object is group the has a composite type of COMPLEMENT- Returns:
- whether the Grouper object has a composite COMPLEMENT type
-
isStartNode
public boolean isStartNode()True if this is the starting node. Set by the caller- Returns:
- whether this is the starting node
-
setStartNode
public void setStartNode(boolean startNode) sets whether this is the start node- Parameters:
startNode
- flag whether this is the starting node
-
getStyleObjectType
gets the style object type enum- Returns:
- style object type
-
getGrouperObjectId
helper method to get the id of the underlying GrouperObject- Returns:
- the id of the underlying GrouperObject
-
getGrouperObjectName
Helper method to get the id of the underlying GrouperObject- Returns:
- the name of the underlying GrouperObject
-
getSubjectIsMember
true if this is a group node and the subject is a member of this group null is returned if the check is not being done- Returns:
-
setSubjectIsMember
true if this is a group node and the subject is a member of this group null if the check is not being done -
toString
-