public abstract class FilteredEntityTransactionData<T extends org.neo4j.graphdb.Entity> extends Object
EntityTransactionData that filters out Entitys and properties
based on provided EntityInclusionPolicy and PropertyInclusionPolicy.
Results of most methods returning Collections and Maps will be filtered. boolean
and single object returning methods (and propertiesOfDeletedEntity(org.neo4j.graphdb.Entity)
will always return the full truth no matter the policies. All returned Entitys will be wrapped
in FilteredEntity.
So for example:
getAllCreated() can return 5 objects, but hasBeenCreated(org.neo4j.graphdb.Entity) can
return true for more of them, as it ignores the filtering.
When traversing the graph using an object returned by this API (such as FilteredNode),
nodes, properties, and relationships not included by the InclusionPolicies will be excluded. The only exception
to this are relationship start and end nodes - they are returned even if they would normally be filtered out. This is
a design decision in order to honor the requirement that relationships must have start and end node.| Modifier and Type | Field and Description |
|---|---|
protected InclusionPolicies |
policies |
| Modifier | Constructor and Description |
|---|---|
protected |
FilteredEntityTransactionData(InclusionPolicies policies)
Construct filtered entity transaction data.
|
| Modifier and Type | Method and Description |
|---|---|
Map<String,Change<Object>> |
changedProperties(T entity)
Get properties changed in the transaction.
|
Map<String,Object> |
createdProperties(T entity)
Get properties created in the transaction.
|
Map<String,Object> |
deletedProperties(T entity)
Get properties deleted in the transaction.
|
protected Collection<Change<T>> |
filterChangedEntities(Collection<Change<T>> toFilter)
Filter changed entities according to provided policies.
|
protected abstract T |
filtered(T original)
Create a filtered instance of a entity.
|
protected Change<T> |
filteredChange(Change<T> change)
Make both objects contained in the changed object filtered.
|
protected Collection<T> |
filterEntities(Collection<T> toFilter)
Filter entities according to provided
EntityInclusionPolicy. |
protected <V> Map<String,V> |
filterProperties(Map<String,V> properties,
T entity)
Filter properties according to provided
PropertyInclusionPolicy. |
Collection<Change<T>> |
getAllChanged()
Get all entities changed in the transaction.
|
Collection<T> |
getAllCreated()
Get all entities created in the transaction.
|
Collection<T> |
getAllDeleted()
Get all entities deleted in the transaction as they were before the transaction started.
|
Change<T> |
getChanged(T entity)
Get a entity that has been changed in this transaction as it was before the transaction started and as it is now.
|
T |
getDeleted(T entity)
Get a entity that has been deleted in this transaction as it was before the transaction started.
|
protected abstract EntityInclusionPolicy<T> |
getEntityInclusionPolicy()
Get entity inclusion policy for the appropriate entity.
|
protected abstract PropertyInclusionPolicy<T> |
getPropertyInclusionPolicy()
Get property inclusion policy for the appropriate entity.
|
protected abstract EntityTransactionData<T> |
getWrapped()
Get the wrapped/decorated
EntityTransactionData. |
boolean |
hasBeenChanged(T entity)
Check whether a entity has been changed in the transaction, i.e.
|
boolean |
hasBeenCreated(T entity)
Check whether the given entity has been created in the transaction.
|
boolean |
hasBeenDeleted(T entity)
Check whether the given entity has been deleted in the transaction.
|
protected boolean |
hasChanged(Change<T> candidate) |
boolean |
hasPropertyBeenChanged(T entity,
String key)
Check whether a property has been changed in the transaction.
|
boolean |
hasPropertyBeenCreated(T entity,
String key)
Check whether a property has been created in the transaction.
|
boolean |
hasPropertyBeenDeleted(T entity,
String key)
Check whether a property has been deleted in the transaction.
|
Map<String,Object> |
propertiesOfDeletedEntity(T entity)
Get properties of a deleted entity.
|
protected final InclusionPolicies policies
protected FilteredEntityTransactionData(InclusionPolicies policies)
policies - for filtering.protected abstract EntityTransactionData<T> getWrapped()
EntityTransactionData.protected abstract EntityInclusionPolicy<T> getEntityInclusionPolicy()
protected abstract PropertyInclusionPolicy<T> getPropertyInclusionPolicy()
protected abstract T filtered(T original)
original - instance to be wrapped in the filtering decorator.public boolean hasBeenCreated(T entity)
entity - to check.public Collection<T> getAllCreated()
public boolean hasBeenDeleted(T entity)
entity - to check.public T getDeleted(T entity)
entity - to get.FilteredEntity.IllegalArgumentException - in case the given entity has not been deleted in the transaction.public Collection<T> getAllDeleted()
public boolean hasBeenChanged(T entity)
entity - to check.public Change<T> getChanged(T entity)
entity - to get.FilteredEntity.IllegalArgumentException - in case the given entity has not been changed in the transaction.public Collection<Change<T>> getAllChanged()
public boolean hasPropertyBeenCreated(T entity, String key)
entity - to check.key - of the property to check.public Map<String,Object> createdProperties(T entity)
entity - for which to get created properties.PropertyInclusionPolicy. Compliance with the EntityInclusionPolicy is not
verified.public boolean hasPropertyBeenDeleted(T entity, String key)
entity - to check.key - of the property to check.public Map<String,Object> deletedProperties(T entity)
entity - for which to get deleted properties.PropertyInclusionPolicy. Compliance with the EntityInclusionPolicy is not
verified.public Map<String,Object> propertiesOfDeletedEntity(T entity)
entity - deleted entity.public boolean hasPropertyBeenChanged(T entity, String key)
entity - to check.key - of the property to check.public Map<String,Change<Object>> changedProperties(T entity)
entity - for which to get changed properties.PropertyInclusionPolicy. Compliance with the EntityInclusionPolicy is not
verified.protected final Collection<T> filterEntities(Collection<T> toFilter)
EntityInclusionPolicy.toFilter - entities to filter.protected final Collection<Change<T>> filterChangedEntities(Collection<Change<T>> toFilter)
EntityInclusionPolicy with at least one property created, deleted, or changed that complies
with the provided PropertyInclusionPolicy will be returned.toFilter - changed entities to filter.protected final <V> Map<String,V> filterProperties(Map<String,V> properties, T entity)
PropertyInclusionPolicy.
EntityInclusionPolicy is ignored!V - property value type.properties - to filter.entity - to which the properties belong.Copyright © 2013-2016–2020 Graph Aware Limited. All rights reserved.