public abstract class BaseDomainObjectService<T extends EntityId,D extends EntityId,P extends Id,ED extends DomainObjectDefinition<D,P>,E extends DomainObject<T,D,P>,EB extends DomainObject.DomainObjectBuilder<T,D,P,E,EB>,Q extends DomainObjectQuery,QB extends EntityQuery.EntityQueryBuilder<Q,QB>,OC extends DomainObjectOperandContainer<T,D,P>,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,A extends DomainObjectActionEvent<E,WB>,L extends DomainObjectActionListener<A>,M extends DomainObjectManager<T,D,P,E,EB,Q,QB,OC,W,WB>,PROV extends DomainObjectProvider<T,D,P,?,?>,PERS extends EntityPersistence<T,E,Q>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>> extends BaseEntityService<T,P,E,EB,Q,QB,OC,W,WB,A,L,M,PROV,PERS> implements DomainObjectService<T,D,P,E,Q,W,WB,U,UB>
Modifier | Constructor and Description |
---|---|
protected |
BaseDomainObjectService(M manager,
List<PROV> providers,
PERS persistence,
PredicatePostProcessor<E> predicatePostProcessor,
List<L> actionListeners,
CurrentTenantService currentTenantService,
CurrentUserService currentUserService,
Class<? extends DomainObjectDefinitionService<D,P,ED,?>> definitionServiceClass,
EntityAuditHandler auditHandler,
Registry serviceRegistry,
LifeCycle lifeCycle,
TimeProvider timeProvider) |
Modifier and Type | Method and Description |
---|---|
protected E |
adjustDefinitionReference(E entity)
Reads the entity's definition id which references the external id of the entity definition, and adjusts the entity to reference the id of the entity definition
instead.
|
E |
apply(U update,
String description)
Applies an entity update.
|
WB |
createModificationBuilder()
Creates a new type-safe modification builder.
|
WB |
createModificationBuilder(W modification)
Creates a new type-safe modification builder based on the given template modification.
|
void |
deleteVariable(GlobalId globalId,
String name,
String description)
Deletes the variable with the given
name from the entity with given globalId . |
<V> void |
deleteVariable(GlobalId globalId,
VariableName<V,?> name,
String description)
Deletes the variable with the given
name from the entity with given globalId . |
void |
deleteVariable(T id,
String name,
String description)
Deletes the variable with the given
name from the entity with given id . |
<V> void |
deleteVariable(T id,
VariableName<V,?> name,
String description)
Deletes the variable with the given
name from the entity with given id . |
void |
deleteVariables(GlobalId globalId,
Collection<String> variables,
String description)
Deletes the variables from the collection of variable
names from the entity with given globalId . |
void |
deleteVariables(T entityId,
Collection<String> variables,
String description)
Deletes the variables from the collection of variable
names from the entity with given entityId . |
protected DomainObjectDefinitionService<D,P,ED,?> |
getDefinitionService() |
protected abstract W |
getFinalModification(U update)
Returns the final modification corresponding to the given update.
|
protected E |
getModifiedEntityForUpdate(E baseEntity,
W modification) |
void |
init()
Life-cycle method to initialize the service before using the service for the first time.
|
protected EntityActionEvent.Type |
mapFieldIdToActionType(FieldId fieldId) |
protected void |
notifyProviders(E entity,
Set<FieldChange> fieldChanges) |
protected void |
performDelete(T entityId,
String description) |
protected void |
performStateUpdateReceivedFromProvider(T entityId,
State newState) |
protected void |
performStateUpdateReceivedFromProvider(T entityId,
State newState,
String cause) |
protected E |
performUpdate(E entity,
W modification,
boolean notifyProvider,
String description) |
void |
putVariable(GlobalId globalId,
String name,
Object value,
String description)
Associates the given variable with the specified entity.
|
<V> void |
putVariable(GlobalId globalId,
VariableName<V,?> name,
V value,
String description)
Associates the given variable with the specified entity.
|
void |
putVariable(T id,
String name,
Object value,
String description)
Associates the given variable with the specified entity.
|
<V> void |
putVariable(T id,
VariableName<V,?> name,
V value,
String description)
Associates the given variable with the specified entity.
|
void |
putVariables(GlobalId globalId,
Map<String,Object> variables,
String description)
Associates the given variables with the specified entity.
|
void |
putVariables(GlobalId globalId,
VariableMap variables,
String description)
Associates the given variables with the specified entity.
|
void |
putVariables(T entityId,
Map<String,Object> variables,
String description)
Associates the given variables with the specified entity.
|
void |
putVariables(T entityId,
VariableMap variables,
String description)
Associates the given variables with the specified entity.
|
void |
setDescription(GlobalId globalId,
String description,
String comment)
Sets the description of the specified entity.
|
void |
setDescription(T entityId,
String description,
String comment)
Sets the description of the specified entity.
|
void |
setName(GlobalId globalId,
String name,
String description)
Sets the name of the specified entity.
|
void |
setName(T entityId,
String name,
String description)
Sets the name of the specified entity.
|
void |
setState(GlobalId globalId,
State state,
String description)
Sets the state of the specified entity.
|
void |
setState(T entityId,
State state,
String description)
Sets the state of the specified entity.
|
void |
setSubState(GlobalId globalId,
State subState,
String description)
Sets the sub state of the specified entity.
|
void |
setSubState(T entityId,
State subState,
String description)
Sets the sub state of the specified entity.
|
T |
startEntity(D definitionId,
Map<String,Object> variables)
Starts a new entity based on the definition with the given id.
|
T |
startEntity(D definitionId,
String name,
Object value)
Starts a new entity based on the definition with the given id.
|
T |
startEntity(D definitionId,
VariableMap variables)
Starts a new entity based on the definition with the given id.
|
<V> T |
startEntity(D definitionId,
VariableName<V,?> name,
V value)
Starts a new entity based on the definition with the given id.
|
protected E |
trimNonPersistentData(E entity) |
protected abstract void |
updateDomainObjectSpecificCalculatedFieldsBeforeInsert(E newEntity,
EB builder) |
protected abstract void |
updateDomainObjectSpecificCalculatedFieldsBeforeUpdate(E oldEntity,
E newEntity,
Collection<FieldChange> fieldChanges,
Date currentTime,
EB builder) |
protected void |
updateEntityAndSendChangeEvents(E entity,
Set<FieldChange> fieldChanges,
boolean notifyProvider) |
protected void |
updateEntitySpecificCalculatedFieldsBeforeInsert(E newEntity,
EB builder) |
protected void |
validateEntityToAdd(E entity) |
addActionListener, addEntity, addEntityGeneric, addEntityGivenByProvider, addValidatedEntity, adjustEntityGivenByProvider, countEntities, countEntities, countEntities, countEntities, createActionEvent, ensureExternalIdIsDefined, ensureGlobalIdIsDefined, ensureIdIsDefined, findEntities, findEntities, findEntities, findEntities, findEntity, findEntity, findEntity, findEntity, findEntityByExternalId, findEntityByExternalId, findEntityByGlobalId, findEntityByGlobalId, findEntityById, findEntityById, findExternalIdByGlobalId, findExternalIdByGlobalId, findExternalIdById, findExternalIdById, findGlobalIdByExternalId, findGlobalIdByExternalId, findIdByExternalId, findIdByExternalId, findNonNullEntityByGlobalId, findNonNullEntityById, findProvider, getAuditHandler, getCurrentTenantId, getCurrentUserId, getDefinedExternalId, getDefinedGlobalId, getDefinedId, getEntityByGlobalId, getEntityByGlobalId, getEntityById, getEntityById, getLifeCycle, getManager, getPersistence, getProviders, getServiceRegistry, getSharedTenantId, getTimeProvider, insertEntityAndSendChangeEvents, isMultiTenant, performInsert, removeActionListener, sendActionPerformedEvent, sendActionWillBePerformedEvent, sendActionWillBePerformedEvent, sendActionWillBePerformedEvent, sendActionWillBePerformedEvent
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createReadableUpdateBuilder, createUpdateBuilder
addEntity, addEntityGeneric, countEntities, countEntities, countEntities, countEntities, findEntities, findEntities, findEntities, findEntities, findEntity, findEntity, findEntity, findEntity, findEntityByExternalId, findEntityByExternalId, findEntityByGlobalId, findEntityByGlobalId, findEntityById, findEntityById, findExternalIdByGlobalId, findExternalIdByGlobalId, findExternalIdById, findExternalIdById, findGlobalIdByExternalId, findGlobalIdByExternalId, findIdByExternalId, findIdByExternalId, getEntityByGlobalId, getEntityByGlobalId, getEntityById, getEntityById
protected BaseDomainObjectService(M manager, List<PROV> providers, PERS persistence, PredicatePostProcessor<E> predicatePostProcessor, List<L> actionListeners, CurrentTenantService currentTenantService, CurrentUserService currentUserService, Class<? extends DomainObjectDefinitionService<D,P,ED,?>> definitionServiceClass, EntityAuditHandler auditHandler, Registry serviceRegistry, LifeCycle lifeCycle, TimeProvider timeProvider)
protected DomainObjectDefinitionService<D,P,ED,?> getDefinitionService()
public void init()
Service
init
in interface Service
init
in class BaseEntityService<T extends EntityId,P extends Id,E extends DomainObject<T,D,P>,EB extends DomainObject.DomainObjectBuilder<T,D,P,E,EB>,Q extends DomainObjectQuery,QB extends EntityQuery.EntityQueryBuilder<Q,QB>,OC extends DomainObjectOperandContainer<T,D,P>,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,A extends DomainObjectActionEvent<E,WB>,L extends DomainObjectActionListener<A>,M extends DomainObjectManager<T,D,P,E,EB,Q,QB,OC,W,WB>,PROV extends DomainObjectProvider<T,D,P,?,?>,PERS extends EntityPersistence<T,E,Q>>
public void setName(T entityId, String name, String description)
DomainObjectService
setName
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
entityId
- the id of the entity for which to set the namename
- the name to set on the entitydescription
- transient meta information regarding the reason to set the name of the entitypublic void setName(GlobalId globalId, String name, String description)
DomainObjectService
setName
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
globalId
- the global id of the entity for which to set the namename
- the name to set on the entitydescription
- transient meta information regarding the reason to set the name of the entitypublic void setDescription(T entityId, String description, String comment)
DomainObjectService
setDescription
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
entityId
- the id of the entity for which to set the descriptiondescription
- the description to set on the entitycomment
- transient meta information regarding the reason to set the description of the entitypublic void setDescription(GlobalId globalId, String description, String comment)
DomainObjectService
setDescription
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
globalId
- the global id of the entity for which to set the descriptiondescription
- the description to set on the entitycomment
- transient meta information regarding the reason to set the description of the entitypublic void setState(T entityId, State state, String description)
DomainObjectService
setState
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
entityId
- the id of the entity for which to set the statestate
- the state to set on the entitydescription
- transient meta information regarding the reason to set the state of the entitypublic void setState(GlobalId globalId, State state, String description)
DomainObjectService
setState
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
globalId
- the global id of the entity for which to set the statestate
- the state to set on the entitydescription
- transient meta information regarding the reason to set the state of the entitypublic void setSubState(T entityId, State subState, String description)
DomainObjectService
setSubState
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
entityId
- the id of the entity for which to set the sub statesubState
- the sub state to set on the entitydescription
- transient meta information regarding the reason to set the sub state of the entitypublic void setSubState(GlobalId globalId, State subState, String description)
DomainObjectService
setSubState
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
globalId
- the global id of the entity for which to set the sub statesubState
- the sub state to set on the entitydescription
- transient meta information regarding the reason to set the sub state of the entitypublic void putVariable(T id, String name, Object value, String description)
DomainObjectService
putVariable
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
id
- the id of the entity for which to associate the variable withname
- the name of the variable to associate with the entityvalue
- the value of the variable to associate with the entitydescription
- transient meta information regarding the reason to associate variable with the entitypublic void putVariable(GlobalId globalId, String name, Object value, String description)
DomainObjectService
putVariable
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
globalId
- the global id of the entity to be updatedname
- the name of the variable to associate with the entityvalue
- the value of the variable to associate with the entitydescription
- transient meta information regarding the reason to associate variable with the entitypublic <V> void putVariable(T id, VariableName<V,?> name, V value, String description)
DomainObjectService
putVariable
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
V
- the expected transient type of the variableid
- the id of the entity for which to associate the variable withname
- the name of the variable to associate with the entityvalue
- the value of the variable to associate with the entitydescription
- transient meta information regarding the reason to associate variable with the entitypublic <V> void putVariable(GlobalId globalId, VariableName<V,?> name, V value, String description)
DomainObjectService
putVariable
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
V
- the expected transient type of the variableglobalId
- the global id of the entity to be updatedname
- the name of the variable to associate with the entityvalue
- the value of the variable to associate with the entitydescription
- transient meta information regarding the reason to associate variable with the entitypublic void putVariables(T entityId, Map<String,Object> variables, String description)
DomainObjectService
putVariables
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
entityId
- the id of the entity for which to associate the variables withvariables
- the variables to associate with the entitydescription
- transient meta information regarding the reason to associate variables with the entitypublic void putVariables(GlobalId globalId, Map<String,Object> variables, String description)
DomainObjectService
putVariables
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
globalId
- the global id of the entity to be updatedvariables
- the variables to associate with the entitydescription
- transient meta information regarding the reason to associate variables with the entitypublic void putVariables(T entityId, VariableMap variables, String description)
DomainObjectService
putVariables
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
entityId
- the id of the entity for which to associate the variables withvariables
- the variables to associate with the entitydescription
- transient meta information regarding the reason to associate variables with the entitypublic void putVariables(GlobalId globalId, VariableMap variables, String description)
DomainObjectService
putVariables
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
globalId
- the global id of the entity to be updatedvariables
- the variables to associate with the entitydescription
- transient meta information regarding the reason to associate variables with the entitypublic void deleteVariable(T id, String name, String description)
DomainObjectService
name
from the entity with given id
. In the case when variable does not exist no action is taken.deleteVariable
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
id
- the entity id from which variable is deletedname
- the variable namedescription
- transient meta information regarding the reason to delete variable from the entitypublic void deleteVariable(GlobalId globalId, String name, String description)
DomainObjectService
name
from the entity with given globalId
. In the case when variable does not exist no action is taken.deleteVariable
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
globalId
- the entity globalId from which variable is deletedname
- the variable namedescription
- transient meta information regarding the reason to delete variable from the entitypublic <V> void deleteVariable(T id, VariableName<V,?> name, String description)
DomainObjectService
name
from the entity with given id
. In the case when variable does not exist no action is taken.deleteVariable
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
id
- the entity globalId from which variable is deletedname
- the variable namedescription
- transient meta information regarding the reason to delete variable from the entitypublic <V> void deleteVariable(GlobalId globalId, VariableName<V,?> name, String description)
DomainObjectService
name
from the entity with given globalId
. In the case when variable does not exist no action is taken.deleteVariable
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
globalId
- the entity globalId from which variable is deletedname
- the variable namedescription
- transient meta information regarding the reason to delete variable from the entitypublic void deleteVariables(T entityId, Collection<String> variables, String description)
DomainObjectService
names
from the entity with given entityId
. In the case when variable does not exist no action
is taken.deleteVariables
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
entityId
- the entity id from which variable is deletedvariables
- the collection of variable names to deletedescription
- transient meta information regarding the reason to delete variable from the entitypublic void deleteVariables(GlobalId globalId, Collection<String> variables, String description)
DomainObjectService
names
from the entity with given globalId
. In the case when variable does not exist no action
is taken.deleteVariables
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
globalId
- the entity globalId from which variable is deletedvariables
- the collection of variable names to deletedescription
- transient meta information regarding the reason to delete variable from the entitypublic T startEntity(D definitionId, String name, Object value)
DomainObjectService
startEntity
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
definitionId
- the id of the definition for which to start a new entityname
- the name of the variable to build the initial data set of the entity that is startedvalue
- the value of the variable to build the initial data set of the entity that is startedpublic <V> T startEntity(D definitionId, VariableName<V,?> name, V value)
DomainObjectService
startEntity
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
V
- the expected transient type of the variabledefinitionId
- the id of the definition for which to start a new entityname
- the name of the variable to build the initial data set of the entity that is startedvalue
- the value of the variable to build the initial data set of the entity that is startedpublic T startEntity(D definitionId, Map<String,Object> variables)
DomainObjectService
startEntity
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
definitionId
- the id of the definition for which to start a new entityvariables
- the variables to build the initial data set of the entity that is startedpublic T startEntity(D definitionId, VariableMap variables)
DomainObjectService
startEntity
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
definitionId
- the id of the definition for which to start a new entityvariables
- the variables to build the initial data set of the entity that is startedprotected void validateEntityToAdd(E entity)
validateEntityToAdd
in class BaseEntityService<T extends EntityId,P extends Id,E extends DomainObject<T,D,P>,EB extends DomainObject.DomainObjectBuilder<T,D,P,E,EB>,Q extends DomainObjectQuery,QB extends EntityQuery.EntityQueryBuilder<Q,QB>,OC extends DomainObjectOperandContainer<T,D,P>,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,A extends DomainObjectActionEvent<E,WB>,L extends DomainObjectActionListener<A>,M extends DomainObjectManager<T,D,P,E,EB,Q,QB,OC,W,WB>,PROV extends DomainObjectProvider<T,D,P,?,?>,PERS extends EntityPersistence<T,E,Q>>
protected void updateEntitySpecificCalculatedFieldsBeforeInsert(E newEntity, EB builder)
updateEntitySpecificCalculatedFieldsBeforeInsert
in class BaseEntityService<T extends EntityId,P extends Id,E extends DomainObject<T,D,P>,EB extends DomainObject.DomainObjectBuilder<T,D,P,E,EB>,Q extends DomainObjectQuery,QB extends EntityQuery.EntityQueryBuilder<Q,QB>,OC extends DomainObjectOperandContainer<T,D,P>,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,A extends DomainObjectActionEvent<E,WB>,L extends DomainObjectActionListener<A>,M extends DomainObjectManager<T,D,P,E,EB,Q,QB,OC,W,WB>,PROV extends DomainObjectProvider<T,D,P,?,?>,PERS extends EntityPersistence<T,E,Q>>
protected abstract void updateDomainObjectSpecificCalculatedFieldsBeforeInsert(E newEntity, EB builder)
protected E trimNonPersistentData(E entity)
trimNonPersistentData
in class BaseEntityService<T extends EntityId,P extends Id,E extends DomainObject<T,D,P>,EB extends DomainObject.DomainObjectBuilder<T,D,P,E,EB>,Q extends DomainObjectQuery,QB extends EntityQuery.EntityQueryBuilder<Q,QB>,OC extends DomainObjectOperandContainer<T,D,P>,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,A extends DomainObjectActionEvent<E,WB>,L extends DomainObjectActionListener<A>,M extends DomainObjectManager<T,D,P,E,EB,Q,QB,OC,W,WB>,PROV extends DomainObjectProvider<T,D,P,?,?>,PERS extends EntityPersistence<T,E,Q>>
protected final E adjustDefinitionReference(E entity)
entity
- the entity to adjustpublic WB createModificationBuilder()
DomainObjectService
createModificationBuilder
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
public WB createModificationBuilder(W modification)
DomainObjectService
createModificationBuilder
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
modification
- the template modificationpublic E apply(U update, String description)
DomainObjectService
apply
in interface DomainObjectService<T extends EntityId,D extends EntityId,P extends Id,E extends DomainObject<T,D,P>,Q extends DomainObjectQuery,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,U extends DomainObjectUpdate<W>,UB extends DomainObjectUpdate.Builder<E,W,WB,U,UB>>
update
- the update to be applieddescription
- transient meta information regarding the reason for the changeprotected abstract W getFinalModification(U update)
update
- the incoming updateprotected E performUpdate(E entity, W modification, boolean notifyProvider, String description)
protected EntityActionEvent.Type mapFieldIdToActionType(FieldId fieldId)
protected abstract void updateDomainObjectSpecificCalculatedFieldsBeforeUpdate(E oldEntity, E newEntity, Collection<FieldChange> fieldChanges, Date currentTime, EB builder)
protected void performStateUpdateReceivedFromProvider(T entityId, State newState)
protected void performStateUpdateReceivedFromProvider(T entityId, State newState, String cause)
protected void updateEntityAndSendChangeEvents(E entity, Set<FieldChange> fieldChanges, boolean notifyProvider)
protected void notifyProviders(E entity, Set<FieldChange> fieldChanges)
notifyProviders
in class BaseEntityService<T extends EntityId,P extends Id,E extends DomainObject<T,D,P>,EB extends DomainObject.DomainObjectBuilder<T,D,P,E,EB>,Q extends DomainObjectQuery,QB extends EntityQuery.EntityQueryBuilder<Q,QB>,OC extends DomainObjectOperandContainer<T,D,P>,W extends DomainObjectModification<T,D,P,E,EB>,WB extends DomainObjectModification.DomainObjectModificationBuilder<T,D,P,E,EB,W,WB>,A extends DomainObjectActionEvent<E,WB>,L extends DomainObjectActionListener<A>,M extends DomainObjectManager<T,D,P,E,EB,Q,QB,OC,W,WB>,PROV extends DomainObjectProvider<T,D,P,?,?>,PERS extends EntityPersistence<T,E,Q>>
Copyright © 2010 - 2018 edorasware ag. All Rights Reserved.