public abstract class GraphPolicy extends 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.EXCLUDE d parentsthat would prevent it from being orphaned. |
Modifier and Type | Field and Description |
---|---|
protected Map<String,GraphPolicyRulePredicate> |
predicates
The predicates that have been registered with
registerPredicate(GraphPolicyRulePredicate) . |
Constructor and Description |
---|
GraphPolicy() |
Modifier and Type | Method and Description |
---|---|
static Set<GraphPolicy.Details> |
allObjects(Collection<Set<GraphPolicy.Details>> linkedFrom,
GraphPolicy.Details rootObject,
Collection<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(String name)
Check if a condition has been set.
|
void |
noteDetails(org.hibernate.Session session,
IObject object,
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 Set<GraphPolicy.Details> |
review(Map<String,Set<GraphPolicy.Details>> linkedFrom,
GraphPolicy.Details rootObject,
Map<String,Set<GraphPolicy.Details>> linkedTo,
Set<String> notNullable,
boolean isErrorRules)
The action to take about the link between the mapped objects.
|
abstract void |
setCondition(String name)
Set a named condition,
|
protected final Map<String,GraphPolicyRulePredicate> predicates
registerPredicate(GraphPolicyRulePredicate)
.public abstract GraphPolicy getCleanInstance()
public void registerPredicate(GraphPolicyRulePredicate predicate)
predicate
- a graph policy predicatepublic abstract void setCondition(String name)
name
- the name of the conditionpublic abstract boolean isCondition(String name)
name
- the name of the conditionpublic void noteDetails(org.hibernate.Session session, IObject object, 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 Set<GraphPolicy.Details> allObjects(Collection<Set<GraphPolicy.Details>> linkedFrom, GraphPolicy.Details rootObject, Collection<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 Set<GraphPolicy.Details> review(Map<String,Set<GraphPolicy.Details>> linkedFrom, GraphPolicy.Details rootObject, Map<String,Set<GraphPolicy.Details>> linkedTo, Set<String> notNullable, boolean isErrorRules) throws GraphException
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
.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.0-ice35-b74
Copyright © 2017 The University of Dundee & Open Microscopy Environment. All Rights Reserved.