java.lang.Object
edu.internet2.middleware.grouper.app.graph.GraphNode

public class GraphNode extends Object
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 Details

    • GraphNode

      public GraphNode(GrouperObject grouperObject, boolean isStartNode)
      Constructor that also marks the node as the starting node for the graph
      Parameters:
      grouperObject -
      isStartNode -
    • GraphNode

      public GraphNode(GrouperObject grouperObject)
      General constructor for a GraphNode containing a grouper Object.
      Parameters:
      grouperObject -
  • Method Details

    • equals

      public boolean equals(Object obj)
      Compares two nodes and considers them equal if they both hold the same GrouperObject.
      Overrides:
      equals in class Object
      Parameters:
      obj - GraphNode to compare
      Returns:
    • hashCode

      public int hashCode()
      Computes the hashCode based on the contained GrouperObject
      Overrides:
      hashCode in class Object
      Returns:
    • determineStyles

      public void determineStyles()
    • getGrouperObject

      public GrouperObject 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

      public List<String> 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

      public void setObjectTypeNames(List<String> objectTypeNames)
      sets the list of grouper object type names
      Parameters:
      objectTypeNames -
    • addObjectTypeName

      public void addObjectTypeName(String objectTypeName)
      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

      public Set<GraphNode> 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

      public void addParentNode(GraphNode parentNode)
      adds a parent node to the collection
      Parameters:
      parentNode - parent node to add
    • getChildNodes

      public Set<GraphNode> 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

      public void addChildNode(GraphNode childNode)
      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 a Stem
      Returns:
      whether the Grouper object is a stem
    • isGroup

      public boolean isGroup()
      True if the underlying Grouper object is a Group
      Returns:
      whether the Grouper object is a group
    • isSubject

      public boolean isSubject()
      True if the underlying Grouper object is a GrouperObjectSubjectWrapper
      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 a GrouperObjectProvisionerWrapper
      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

      public StyleObjectType getStyleObjectType()
      gets the style object type enum
      Returns:
      style object type
    • getGrouperObjectId

      public String getGrouperObjectId()
      helper method to get the id of the underlying GrouperObject
      Returns:
      the id of the underlying GrouperObject
    • getGrouperObjectName

      public String getGrouperObjectName()
      Helper method to get the id of the underlying GrouperObject
      Returns:
      the name of the underlying GrouperObject
    • getSubjectIsMember

      public Boolean 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

      public void 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 done
    • toString

      public String toString()
      Overrides:
      toString in class Object