Package io.jmix.graphql.datafetcher
Class EntityMutationDataFetcher
java.lang.Object
io.jmix.graphql.datafetcher.EntityMutationDataFetcher
-
Field Summary
Modifier and TypeFieldDescriptionprotected DataFetcherPlanBuilder
protected DataManager
protected EntityImportExport
protected EntitySerialization
protected EntityStates
protected IdentifierService
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
assureCompositionInverseLink
(Object parent, MetaClass parentMetaClass, MetaProperty metaProperty, Object child) Check that inverse link is set correctly in composition relation.protected void
checkCanDeleteEntity
(MetaClass metaClass) protected void
checkReadOnlyAttributeWrite
(MetaClass metaClass, EntityImportPlan importPlan, Object entity) graphql.schema.DataFetcher<?>
deleteEntity
(MetaClass metaClass) protected Object
getMainEntity
(Collection<Object> importedEntities, MetaClass metaClass) protected void
populateAndCheckComposition
(Object entity, Set<Object> visited) Walk through entity graph and check that all compositions have correct relations.graphql.schema.DataFetcher<?>
upsertEntity
(MetaClass metaClass)
-
Field Details
-
dataManager
-
entitySerialization
-
entityImportExport
-
dataFetcherPlanBuilder
-
entityStates
-
identifierService
-
-
Constructor Details
-
EntityMutationDataFetcher
public EntityMutationDataFetcher()
-
-
Method Details
-
upsertEntity
-
deleteEntity
-
getMainEntity
-
checkCanDeleteEntity
-
checkReadOnlyAttributeWrite
protected void checkReadOnlyAttributeWrite(MetaClass metaClass, EntityImportPlan importPlan, Object entity) -
populateAndCheckComposition
Walk through entity graph and check that all compositions have correct relations. If composition inverse value is null - update it to correct value. If composition inverse value doesn't match parent - throw exception.- Parameters:
entity
- entity to be checkedvisited
- a set of entities that already be checked in graph
-
assureCompositionInverseLink
protected void assureCompositionInverseLink(Object parent, MetaClass parentMetaClass, MetaProperty metaProperty, Object child) Check that inverse link is set correctly in composition relation. If link is null - fix it (assign to parent). If link point to different entity (not equals to parent) - throw exception.- Parameters:
parent
- - parent entityparentMetaClass
- - meta class of parent entitymetaProperty
- - metadata of property which points to child in parent entitychild
- - child entity
-