Class NestedRelationshipProcessingStateMachine
java.lang.Object
org.springframework.data.neo4j.core.mapping.NestedRelationshipProcessingStateMachine
@API(status=INTERNAL,
since="6.0")
public final class NestedRelationshipProcessingStateMachine
extends Object
This stores all processed nested relations and objects during save of objects so that
the recursive descent can be stopped accordingly.
- Author:
- Michael J. Simons
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumValid processing states.static interfaceReactive Supplier for arbitrary relationship ids.static interfaceSupplier for arbitrary relationship ids. -
Constructor Summary
ConstructorsConstructorDescriptionNestedRelationshipProcessingStateMachine(Neo4jMappingContext mappingContext) NestedRelationshipProcessingStateMachine(Neo4jMappingContext mappingContext, @Nullable Object initialObject, @Nullable Object elementId) -
Method Summary
Modifier and TypeMethodDescription@Nullable ObjectgetObjectId(Object object) This returns an id for the given object.getProcessedAs(Object entity) getStateOf(@Nullable Object fromId, RelationshipDescription relationshipDescription, Collection<?> valuesToStore) Retrieves the state for a given id.booleanhasProcessedRelationship(@Nullable Object fromId, @Nullable RelationshipDescription relationshipDescription) Checks if the relationship has already been processed.booleanhasProcessedRelationshipEntity(Object source, Object target, RelationshipDescription type) booleanhasProcessedValue(Object value) Checks if the value has already been processed.voidmarkAsAliased(Object aliasEntity, Object entityOrId) voidmarkEntityAsProcessed(Object valueToStore, Object elementId) Marks the passed objects as processed.voidmarkRelationshipAsProcessed(@Nullable Object fromId, @Nullable RelationshipDescription relationshipDescription) Marks the passed objects as processed.voidregisterInitialObject(Object initialObject, Object elementId) voidrequireIdUpdate(Neo4jPersistentEntity<?> sourceEntity, RelationshipDescription relationshipDescription, boolean canUseElementId, Object fromId, Object toId, NestedRelationshipContext relationshipContext, Object relatedValueToStore, @Nullable Neo4jPersistentProperty idProperty) voidstoreProcessRelationshipEntity(MappingSupport.RelationshipPropertiesWithEntityHolder id, Object source, Object target, RelationshipDescription type) voidupdateRelationshipIdsReactive(NestedRelationshipProcessingStateMachine.ReactiveRelationshipIdSupplier idSupplier)
-
Constructor Details
-
NestedRelationshipProcessingStateMachine
-
NestedRelationshipProcessingStateMachine
public NestedRelationshipProcessingStateMachine(Neo4jMappingContext mappingContext, @Nullable Object initialObject, @Nullable Object elementId)
-
-
Method Details
-
registerInitialObject
-
getStateOf
public NestedRelationshipProcessingStateMachine.ProcessState getStateOf(@Nullable Object fromId, RelationshipDescription relationshipDescription, Collection<?> valuesToStore) Retrieves the state for a given id.- Parameters:
fromId- the originating id to be checked.relationshipDescription- check whether this relationship description has been processedvaluesToStore- check whether all the values in the collection have been processed- Returns:
- the state of things processed
-
markRelationshipAsProcessed
public void markRelationshipAsProcessed(@Nullable Object fromId, @Nullable RelationshipDescription relationshipDescription) Marks the passed objects as processed.- Parameters:
fromId- the originating id to be checked.relationshipDescription- to be marked as processed
-
markEntityAsProcessed
-
hasProcessedValue
Checks if the value has already been processed.- Parameters:
value- the object that should be looked for in the registry.- Returns:
- processed yes (true) / no (false)
-
hasProcessedRelationship
public boolean hasProcessedRelationship(@Nullable Object fromId, @Nullable RelationshipDescription relationshipDescription) Checks if the relationship has already been processed.- Parameters:
fromId- the originating id to be checked.relationshipDescription- the relationship that should be looked for in the registry.- Returns:
- processed yes (true) / no (false)
-
storeProcessRelationshipEntity
public void storeProcessRelationshipEntity(MappingSupport.RelationshipPropertiesWithEntityHolder id, Object source, Object target, RelationshipDescription type) -
hasProcessedRelationshipEntity
public boolean hasProcessedRelationshipEntity(Object source, Object target, RelationshipDescription type) -
requireIdUpdate
public void requireIdUpdate(Neo4jPersistentEntity<?> sourceEntity, RelationshipDescription relationshipDescription, boolean canUseElementId, Object fromId, Object toId, NestedRelationshipContext relationshipContext, Object relatedValueToStore, @Nullable Neo4jPersistentProperty idProperty) -
updateRelationshipIds
public void updateRelationshipIds(NestedRelationshipProcessingStateMachine.RelationshipIdSupplier idSupplier) -
updateRelationshipIdsReactive
public Mono<Void> updateRelationshipIdsReactive(NestedRelationshipProcessingStateMachine.ReactiveRelationshipIdSupplier idSupplier) -
markAsAliased
-
getObjectId
This returns an id for the given object. We deliberate use the wording of a generic object id as that might either be the Neo4j 5+ elementId() or on older Neo4j versions or with older data modulestoString(id()).- Parameters:
object- the object for which an id is requested- Returns:
- the objects id
-
getProcessedAs
-