public class GraphTraversal
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
GraphTraversal.PlanExecutor
Executor that allows callers to actually perform the planned action.
|
static interface |
GraphTraversal.Processor
Executes the planned operation.
|
| Constructor and Description |
|---|
GraphTraversal(org.hibernate.Session session,
ome.system.EventContext eventContext,
ACLVoter aclVoter,
GraphPathBean graphPathBean,
com.google.common.collect.SetMultimap<java.lang.String,java.lang.String> unnullable,
GraphPolicy policy,
GraphTraversal.Processor processor)
Construct a new instance of a graph traversal manager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
assertNoPolicyViolations()
Check that there are no policy violations matched by
p:error policy rules. |
void |
assertNoUnlinking()
Assert that
unlinkTargets(boolean) need not be called. |
com.google.common.collect.SetMultimap<java.lang.String,java.lang.Long> |
getLinkeds(java.lang.String propertyValueClass,
java.lang.String propertyName,
java.lang.Long id)
Get the model objects that are linked to by the given object via the given property.
|
com.google.common.collect.SetMultimap<java.lang.String,java.lang.Long> |
getLinkers(java.lang.String propertyValueClass,
java.lang.String propertyName,
java.lang.Long id)
Get the model objects that link to the given object via the given property.
|
java.util.Map.Entry<java.util.Collection<ome.model.IObject>,java.util.Collection<ome.model.IObject>> |
planOperation(java.util.Collection<? extends ome.model.IObject> objectInstances,
boolean include,
boolean applyRules)
Traverse model object graph to determine steps for the proposed operation.
|
java.util.Map.Entry<com.google.common.collect.SetMultimap<java.lang.String,java.lang.Long>,com.google.common.collect.SetMultimap<java.lang.String,java.lang.Long>> |
planOperation(com.google.common.collect.SetMultimap<java.lang.String,java.lang.Long> objects,
boolean include,
boolean applyRules)
Traverse model object graph to determine steps for the proposed operation.
|
GraphTraversal.PlanExecutor |
processTargets()
Prepare to process the targeted model objects.
|
void |
setOwnsAll()
Deprecated.
An ugly expedient hack that requires review and may be removed without notice.
|
GraphTraversal.PlanExecutor |
unlinkTargets(boolean isUnlinkIncludeFromExclude)
Prepare to remove links between the targeted model objects and the remainder of the model object graph.
|
public GraphTraversal(org.hibernate.Session session,
ome.system.EventContext eventContext,
ACLVoter aclVoter,
GraphPathBean graphPathBean,
com.google.common.collect.SetMultimap<java.lang.String,java.lang.String> unnullable,
GraphPolicy policy,
GraphTraversal.Processor processor)
session - the Hibernate sessioneventContext - the current event contextaclVoter - ACL voter for permissions checkinggraphPathBean - the graph path beanunnullable - properties that, while nullable, may not be nulled by a graph traversal operationpolicy - how to determine which related objects to include in the operationprocessor - how to operate on the resulting target object graphpublic java.util.Map.Entry<com.google.common.collect.SetMultimap<java.lang.String,java.lang.Long>,com.google.common.collect.SetMultimap<java.lang.String,java.lang.Long>> planOperation(com.google.common.collect.SetMultimap<java.lang.String,java.lang.Long> objects,
boolean include,
boolean applyRules)
throws GraphException
objects - the model objects to processinclude - if the given model objects are to be included (instead of just deleted)applyRules - if the given model objects should have the policy rules applied to themGraphException - if the model objects were not as expectedpublic java.util.Map.Entry<java.util.Collection<ome.model.IObject>,java.util.Collection<ome.model.IObject>> planOperation(java.util.Collection<? extends ome.model.IObject> objectInstances,
boolean include,
boolean applyRules)
throws GraphException
objectInstances - the model objects to process, may be unloaded with ID onlyinclude - if the given model objects are to be included (instead of just deleted)applyRules - if the given model objects should have the policy rules applied to themGraphException - if the model objects were not as expectedpublic void assertNoPolicyViolations()
throws GraphException
p:error policy rules.GraphException - if the policy rules are violatedpublic void assertNoUnlinking()
throws GraphException
unlinkTargets(boolean) need not be called.GraphException - if any model objects are to be GraphPolicy.Action.DELETEdpublic GraphTraversal.PlanExecutor unlinkTargets(boolean isUnlinkIncludeFromExclude) throws GraphException
isUnlinkIncludeFromExclude - if GraphPolicy.Action.EXCLUDE objects must be unlinked from GraphPolicy.Action.INCLUDE objects
and vice versaGraphException - if the user does not have permission to unlink the targetspublic GraphTraversal.PlanExecutor processTargets() throws GraphException
GraphException - if the user does not have permission to process the targets or
if a cycle is detected in the model object graphpublic com.google.common.collect.SetMultimap<java.lang.String,java.lang.Long> getLinkeds(java.lang.String propertyValueClass,
java.lang.String propertyName,
java.lang.Long id)
propertyValueClass - the full name of the model class that declares the given propertypropertyName - a property name, may be nestedid - the ID of the model object doing the linkingnullpublic com.google.common.collect.SetMultimap<java.lang.String,java.lang.Long> getLinkers(java.lang.String propertyValueClass,
java.lang.String propertyName,
java.lang.Long id)
propertyValueClass - the full name of the model class that declares the given propertypropertyName - a property name, may be nestedid - the ID of the model object being linked tonull@Deprecated public void setOwnsAll()
GraphPolicy.Ability.OWN to always be included among GraphPolicy.Details.permissions.