Class DeleteServiceImpl
java.lang.Object
ch.tocco.nice2.persist.entity.impl.delete.DeleteServiceImpl
- All Implemented Interfaces:
DeleteService
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Implementation of theDeleteService.EntityData
interface, which is part of the result structure.static class
Nested classes/interfaces inherited from interface ch.tocco.nice2.persist.entity.api.delete.DeleteService
DeleteService.EntityData, DeleteService.EntityDeletionData
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
We 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
ConstructorDescriptionDeleteServiceImpl
(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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ch.tocco.nice2.persist.entity.api.delete.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:DeleteService
Returns 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:
createDeletionData
in 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:DeleteService
Deletes all entities which are part of the deletion set created byDeleteService.createDeletionData(EntityModel, List)
.- Specified by:
deleteEntities
in interfaceDeleteService
- Throws:
DeleteException
- if the deletion set contains blocking entities, or read/delete permissions are missing
-