Class GraphPolicy


  • public abstract class GraphPolicy
    extends java.lang.Object
    A policy guides how to traverse the graph. This class' methods are expected to be fast and are not required to be thread-safe.
    Since:
    5.1.0
    • Constructor Detail

      • GraphPolicy

        public GraphPolicy()
    • Method Detail

      • getCleanInstance

        public abstract GraphPolicy getCleanInstance()
        Create a clone of this graph policy that has fresh state.
        Returns:
        an instance ready to begin a new graph traversal
      • registerPredicate

        public void registerPredicate​(GraphPolicyRulePredicate predicate)
        Use the given predicate in executing this graph policy.
        Parameters:
        predicate - a graph policy predicate
      • setCondition

        public abstract void setCondition​(java.lang.String name)
        Set a named condition,
        Parameters:
        name - the name of the condition
      • isCondition

        public abstract boolean isCondition​(java.lang.String name)
        Check if a condition has been set.
        Parameters:
        name - the name of the condition
        Returns:
        if the condition is set
      • noteDetails

        public void noteDetails​(org.hibernate.Session session,
                                ome.model.IObject object,
                                java.lang.String realClass,
                                long id)
        Any model object about which policy may be asked is first passed to noteDetails(Session, IObject, String, long) before review(Map, Details, Map, Set, boolean). Each object is passed only once. Subclasses overriding this method probably ought also override getCleanInstance().
        Parameters:
        session - the Hibernate session, for obtaining more information about the object
        object - an unloaded model object about which policy may be asked
        realClass - the real class name of the object
        id - the ID of the object
      • allObjects

        public static java.util.Set<GraphPolicy.Details> allObjects​(java.util.Collection<java.util.Set<GraphPolicy.Details>> linkedFrom,
                                                                    GraphPolicy.Details rootObject,
                                                                    java.util.Collection<java.util.Set<GraphPolicy.Details>> linkedTo)
        Utility method to return all the objects for review as a single set of objects.
        Parameters:
        linkedFrom - details of the objects linking to the root object
        rootObject - details of the root objects
        linkedTo - details of the objects linked by the root object
        Returns:
        details of all the objects passed as arguments