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
ConstructorsConstructorDescriptionEntityDefaultValueServiceImpl(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 anEntityListinstead 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 asSetwith primary keys as string if available.getSetEntityDefaultsTask(boolean setNonNullableToEmpty) Get OptionalTask that sets entity defaults on an entity and returns it.voidsetEntityDefaults(Entity entity, boolean onlyMandatory) 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).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ch.tocco.nice2.persist.entity.api.defaultvalue.EntityDefaultValueService
setEntityDefaults
-
Constructor Details
-
EntityDefaultValueServiceImpl
public EntityDefaultValueServiceImpl(DefaultValueResolver resolver, QueryPopulator queryPopulator, Context context)
-
-
Method Details
-
setEntityDefaults
Description copied from interface:EntityDefaultValueServiceSets 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). if onlyMandatory is true only defaults on mandatory fields and relations are set (non-nullable fields which are null are handled like mandatory fields).- Specified by:
setEntityDefaultsin interfaceEntityDefaultValueService
-
getSetEntityDefaultsTask
Description copied from interface:EntityDefaultValueServiceGet 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:
getSetEntityDefaultsTaskin interfaceEntityDefaultValueService
-
getBufferedSetEntityDefaultsTask
Description copied from interface:EntityDefaultValueServiceGet 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:
getBufferedSetEntityDefaultsTaskin interfaceEntityDefaultValueService
-
getDefaultValueForField
Description copied from interface:EntityDefaultValueServiceEvaluates and returns the default value for the passed field model if available.- Specified by:
getDefaultValueForFieldin interfaceEntityDefaultValueService
-
getDefaultValuesForRelation
Description copied from interface:EntityDefaultValueServiceEvaluates and returns the default values for the passed relation model asSetwith primary keys as string if available.- Specified by:
getDefaultValuesForRelationin interfaceEntityDefaultValueService
-
getDefaultEntitiesForRelation
Description copied from interface:EntityDefaultValueServiceSame asEntityDefaultValueService.getDefaultValuesForRelation(RelationModel)but returns anEntityListinstead of aSet. If no default entities can be found an emptyEntityListwill be returned.- Specified by:
getDefaultEntitiesForRelationin interfaceEntityDefaultValueService
-