Class DeleteServiceImpl
java.lang.Object
ch.tocco.nice2.persist.entity.impl.delete.DeleteServiceImpl
- All Implemented Interfaces:
DeleteService
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classImplementation of theDeleteService.EntityDatainterface, which is part of the result structure.static classNested classes/interfaces inherited from interface DeleteService
DeleteService.EntityData, DeleteService.EntityDeletionData -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intWe can't delete too many entities at once, because the deletion is executed in a single transaction which would consume too much heap space if it contained too many entities. -
Constructor Summary
ConstructorsConstructorDescriptionDeleteServiceImpl(Context context, PersistenceService persistenceService, SecurityManager securityManager, BusinessUnitManager businessUnitManager) -
Method Summary
Modifier and TypeMethodDescriptioncreateDeletionData(EntityModel model, List<PrimaryKey> keys) Returns a report that contains information whether the the given entities may be deleted using a cascading delete.deleteEntities(EntityModel model, List<PrimaryKey> keys) Deletes all entities which are part of the deletion set created byDeleteService.createDeletionData(EntityModel, List).Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DeleteService
deleteEntity, getPartitionedTask
-
Field Details
-
DELETE_LIMIT
public static final int DELETE_LIMITWe can't delete too many entities at once, because the deletion is executed in a single transaction which would consume too much heap space if it contained too many entities. It is difficult to predict how many entities we could delete in a single request, because in this limit isn't represented whatever some listeners might do when triggered and, thus, it isn't the same for all entity models. This limit of 10k is derived by deleting `Membership` entities and measuring memory usage for it -> A total of 10k entities (including related entities, not only Membership entities) already takes up about 300M of the heap space. We shouldn't go higher than that (e.g. a limit of 20k in this constellation already leads to OOM and a crash for a Nice instance with a total memory of 1G).- See Also:
-
-
Constructor Details
-
DeleteServiceImpl
public DeleteServiceImpl(Context context, PersistenceService persistenceService, SecurityManager securityManager, BusinessUnitManager businessUnitManager)
-
-
Method Details
-
createDeletionData
public Map<EntityId, DeleteService.EntityDeletionData> createDeletionData(EntityModel model, List<PrimaryKey> keys) Description copied from interface:DeleteServiceReturns a report that contains information whether the the given entities may be deleted using a cascading delete. The report also contains all entities that would be additionally deleted and all entities that would block the cascading delete.- Specified by:
createDeletionDatain interfaceDeleteService- Parameters:
model- the entity modelkeys- keys of all entities that should be deleted.
-
deleteEntities
public List<EntityId> deleteEntities(EntityModel model, List<PrimaryKey> keys) throws DeleteException Description copied from interface:DeleteServiceDeletes all entities which are part of the deletion set created byDeleteService.createDeletionData(EntityModel, List).- Specified by:
deleteEntitiesin interfaceDeleteService- Throws:
DeleteException- if the deletion set contains blocking entities, or read/delete permissions are missing
-