Class EntityDefaultValueServiceImpl
java.lang.Object
ch.tocco.nice2.persist.entity.impl.defaultvalue.EntityDefaultValueServiceImpl
- All Implemented Interfaces:
EntityDefaultValueService
@Component
public class EntityDefaultValueServiceImpl
extends Object
implements EntityDefaultValueService
-
Constructor Summary
ConstructorDescriptionEntityDefaultValueServiceImpl
(DefaultValueResolver resolver, QueryPopulator queryPopulator, Context context) -
Method Summary
Modifier and TypeMethodDescriptiongetBufferedSetEntityDefaultsTask
(String entityModel) Get OptionalTask that sets entity defaults but loads them only once.getDefaultEntitiesForRelation
(RelationModel relationModel) Same asEntityDefaultValueService.getDefaultValuesForRelation(RelationModel)
but returns anEntityList
instead of aSet
.getDefaultValueForField
(FieldModel fieldModel) Evaluates and returns the default value for the passed field model if available.getDefaultValuesForRelation
(RelationModel relationModel) Evaluates and returns the default values for the passed relation model asSet
with primary keys as string if available.getSetEntityDefaultsTask
(boolean setNonNullableToEmpty) Get OptionalTask that sets entity defaults on an entity and returns it.void
setEntityDefaults
(Entity entity) Sets the default values for fields and relations, but only where those fields and relations were not touched already (are null for fields and empty for relations).
-
Constructor Details
-
EntityDefaultValueServiceImpl
public EntityDefaultValueServiceImpl(DefaultValueResolver resolver, QueryPopulator queryPopulator, Context context)
-
-
Method Details
-
setEntityDefaults
Description copied from interface:EntityDefaultValueService
Sets the default values for fields and relations, but only where those fields and relations were not touched already (are null for fields and empty for relations).- Specified by:
setEntityDefaults
in interfaceEntityDefaultValueService
-
getSetEntityDefaultsTask
Description copied from interface:EntityDefaultValueService
Get OptionalTask that sets entity defaults on an entity and returns it. If the parameter is true, non nullable fields will be set to empty after the default values have been set. (using the EntityModelUtils#setNonNullableToEmpty method)- Specified by:
getSetEntityDefaultsTask
in interfaceEntityDefaultValueService
-
getBufferedSetEntityDefaultsTask
Description copied from interface:EntityDefaultValueService
Get OptionalTask that sets entity defaults but loads them only once. A task that was created like this may only be used for entities of the model provided in the parameter and may result in faster entity creation if many entities of the same model are created.- Specified by:
getBufferedSetEntityDefaultsTask
in interfaceEntityDefaultValueService
-
getDefaultValueForField
Description copied from interface:EntityDefaultValueService
Evaluates and returns the default value for the passed field model if available.- Specified by:
getDefaultValueForField
in interfaceEntityDefaultValueService
-
getDefaultValuesForRelation
Description copied from interface:EntityDefaultValueService
Evaluates and returns the default values for the passed relation model asSet
with primary keys as string if available.- Specified by:
getDefaultValuesForRelation
in interfaceEntityDefaultValueService
-
getDefaultEntitiesForRelation
Description copied from interface:EntityDefaultValueService
Same asEntityDefaultValueService.getDefaultValuesForRelation(RelationModel)
but returns anEntityList
instead of aSet
. If no default entities can be found an emptyEntityList
will be returned.- Specified by:
getDefaultEntitiesForRelation
in interfaceEntityDefaultValueService
-