public abstract class GraphPolicy
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
GraphPolicy.Ability
Abilities that the user may have to operate upon model objects.
|
static class |
GraphPolicy.Action
The action to take on an object instance.
|
static class |
GraphPolicy.Details
A tuple noting the state of a mapped object instance in the current graph traversal.
|
static class |
GraphPolicy.Orphan
If an object instance has any
GraphPolicy.Action.EXCLUDEd parentsthat would prevent it from being orphaned. |
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<java.lang.String,GraphPolicyRulePredicate> |
predicates
The predicates that have been registered with
registerPredicate(GraphPolicyRulePredicate). |
| Constructor and Description |
|---|
GraphPolicy() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
abstract GraphPolicy |
getCleanInstance()
Create a clone of this graph policy that has fresh state.
|
abstract boolean |
isCondition(java.lang.String name)
Check if a condition has been set.
|
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). |
void |
registerPredicate(GraphPolicyRulePredicate predicate)
Use the given predicate in executing this graph policy.
|
abstract java.util.Set<GraphPolicy.Details> |
review(java.util.Map<java.lang.String,java.util.Set<GraphPolicy.Details>> linkedFrom,
GraphPolicy.Details rootObject,
java.util.Map<java.lang.String,java.util.Set<GraphPolicy.Details>> linkedTo,
java.util.Set<java.lang.String> notNullable,
boolean isErrorRules)
The action to take about the link between the mapped objects.
|
abstract void |
setCondition(java.lang.String name)
Set a named condition,
|
protected final java.util.Map<java.lang.String,GraphPolicyRulePredicate> predicates
registerPredicate(GraphPolicyRulePredicate).public abstract GraphPolicy getCleanInstance()
public void registerPredicate(GraphPolicyRulePredicate predicate)
predicate - a graph policy predicatepublic abstract void setCondition(java.lang.String name)
name - the name of the conditionpublic abstract boolean isCondition(java.lang.String name)
name - the name of the conditionpublic void noteDetails(org.hibernate.Session session,
ome.model.IObject object,
java.lang.String realClass,
long id)
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().session - the Hibernate session, for obtaining more information about the objectobject - an unloaded model object about which policy may be askedrealClass - the real class name of the objectid - the ID of the objectpublic 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)
linkedFrom - details of the objects linking to the root objectrootObject - details of the root objectslinkedTo - details of the objects linked by the root objectpublic abstract java.util.Set<GraphPolicy.Details> review(java.util.Map<java.lang.String,java.util.Set<GraphPolicy.Details>> linkedFrom, GraphPolicy.Details rootObject, java.util.Map<java.lang.String,java.util.Set<GraphPolicy.Details>> linkedTo, java.util.Set<java.lang.String> notNullable, boolean isErrorRules) throws GraphException
GraphPolicy.Action.EXCLUDEd object, once changed from that, may not change back to GraphPolicy.Action.EXCLUDE.
An GraphPolicy.Action.OUTSIDE object, once changed to that, may not change back from GraphPolicy.Action.OUTSIDE.
GraphPolicy.Orphan values matter only for GraphPolicy.Action.EXCLUDEd objects.
Given GraphPolicy.Orphan.RELEVANT if GraphPolicy.Orphan.IS_LAST or GraphPolicy.Orphan.IS_NOT_LAST can be returned,
or could be if after GraphPolicy.Orphan.RELEVANT is returned then resolved for the other object,
then appropriate values should be returned accordingly.
If GraphPolicy.Orphan.RELEVANT is returned for an object then this method may be called again with
GraphPolicy.Orphan.IS_LAST or GraphPolicy.Orphan.IS_NOT_LAST.
Class properties' String representation is package.DeclaringClass.propertyName.linkedFrom - map from class property to objects for which the property links to the root objectrootObject - the object at the center of this reviewlinkedTo - map from class property to objects to which the property links from the root objectnotNullable - which properties from the linkedFrom and linkedTo map keys are not nullableisErrorRules - if final checks should be performed instead of normal rule matchingGraphException - if there was a problem in applying the policy