public abstract class BaseGraphPolicyAdjuster extends GraphPolicy
GraphPolicy.Ability, GraphPolicy.Action, GraphPolicy.Details, GraphPolicy.Orphan
predicates
Constructor and Description |
---|
BaseGraphPolicyAdjuster(GraphPolicy graphPolicy)
Construct a new graph policy adjuster.
|
Modifier and Type | Method and Description |
---|---|
GraphPolicy |
getCleanInstance()
Create a clone of this graph policy that has fresh state.
|
protected boolean |
isAdjustedAfterReview(GraphPolicy.Details object)
An opportunity to adjust each model object after the graph policy reviews it.
|
protected boolean |
isAdjustedBeforeReview(GraphPolicy.Details object)
An opportunity to adjust each model object before the graph policy reviews it.
|
boolean |
isCondition(java.lang.String name)
Check if a condition has been set.
|
void |
noteDetails(org.hibernate.Session session,
IObject object,
java.lang.String realClass,
long id)
Any model object about which policy may be asked is first passed to
GraphPolicy.noteDetails(Session, IObject, String, long)
before GraphPolicy.review(Map, Details, Map, Set, boolean) . |
void |
registerPredicate(GraphPolicyRulePredicate predicate)
Use the given predicate in executing this graph policy.
|
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.
|
void |
setCondition(java.lang.String name)
Set a named condition,
|
allObjects
public BaseGraphPolicyAdjuster(GraphPolicy graphPolicy)
graphPolicy
- the graph policy that is to be adjustedprotected boolean isAdjustedBeforeReview(GraphPolicy.Details object)
object
- the model object before reviewprotected boolean isAdjustedAfterReview(GraphPolicy.Details object)
object
- the model object after reviewpublic void registerPredicate(GraphPolicyRulePredicate predicate)
GraphPolicy
registerPredicate
in class GraphPolicy
predicate
- a graph policy predicatepublic GraphPolicy getCleanInstance()
GraphPolicy
getCleanInstance
in class GraphPolicy
public void setCondition(java.lang.String name)
GraphPolicy
setCondition
in class GraphPolicy
name
- the name of the conditionpublic boolean isCondition(java.lang.String name)
GraphPolicy
isCondition
in class GraphPolicy
name
- the name of the conditionpublic void noteDetails(org.hibernate.Session session, IObject object, java.lang.String realClass, long id)
GraphPolicy
GraphPolicy.noteDetails(Session, IObject, String, long)
before GraphPolicy.review(Map, Details, Map, Set, boolean)
. Each object is passed only once.
Subclasses overriding this method probably ought also override GraphPolicy.getCleanInstance()
.noteDetails
in class GraphPolicy
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 final 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
GraphPolicy.Action.EXCLUDE
d 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.EXCLUDE
d 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
.review
in class GraphPolicy
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
Version: 5.4.10-ice35-b105
Copyright © 2019 The University of Dundee & Open Microscopy Environment. All Rights Reserved.