Package org.cyclos.impl.system
Class BaseCustomFieldServiceImpl<CF extends CustomField<CF,C,PV>,C extends CustomFieldPossibleValueCategory<CF,C,PV>,PV extends CustomFieldPossibleValue<CF,C,PV>,A extends com.querydsl.core.types.EntityPath<CF>,DTO extends CustomFieldDTO,D extends CustomFieldData<DTO>,DP>
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.CRUDServiceImpl<CF,A,DTO,D,DP>
-
- org.cyclos.impl.system.BaseCustomFieldServiceImpl<CF,C,PV,A,DTO,D,DP>
-
- All Implemented Interfaces:
CRUDServiceLocal<CF,DTO,D,DP>,CRUDService<DTO,D,DP>,CRUDWithConfirmationPasswordService<DTO,D,DP>,Service,BaseCustomFieldService<DTO,D,DP>
- Direct Known Subclasses:
AdCustomFieldServiceImpl,ContactCustomFieldServiceImpl,ContactInfoFieldServiceImpl,CustomOperationFieldServiceImpl,CustomWizardFieldServiceImpl,DocumentCustomFieldServiceImpl,RecordCustomFieldServiceImpl,TransactionCustomFieldServiceImpl,UserCustomFieldServiceImpl,VoucherCustomFieldServiceImpl
public abstract class BaseCustomFieldServiceImpl<CF extends CustomField<CF,C,PV>,C extends CustomFieldPossibleValueCategory<CF,C,PV>,PV extends CustomFieldPossibleValue<CF,C,PV>,A extends com.querydsl.core.types.EntityPath<CF>,DTO extends CustomFieldDTO,D extends CustomFieldData<DTO>,DP> extends CRUDServiceImpl<CF,A,DTO,D,DP> implements BaseCustomFieldService<DTO,D,DP>
Contains methods used by all custom field services
-
-
Field Summary
Fields Modifier and Type Field Description protected CustomFieldValueHandlercustomFieldValueHandlerprotected CustomScriptServiceLocalcustomScriptServiceprotected Class<D>dataClass-
Fields inherited from class org.cyclos.impl.CRUDServiceImpl
$, ATTR_CURRENT_COPY, cacheHandler, dtoClass, entityClass, extensionPointService, idPath, internalNamePath, namePath, ownerEntityIdPath, ownerEntityPath, ownerEntityPropertyName, passwordHandler, richTextHandler, withConfirmationPassword
-
Fields inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
authHandler, conversionHandler, entityManagerHandler, groupsHandler, productsHandler, restBeanPropertyMapping, userLocatorHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddCustomInternalNameValidations(Property internalName, DTO dto)This method may be overridden to add custom validations for the INTERNAL_NAME property.protected voidaddCustomValidations(Validator validator, DTO dto)It may be overridden to add specific validations for the custom field.protected DgetData(CF field)Returns details data for the given entityprotected abstract IntegergetMaxOrder(CF field)Should be implemented in order to return the maximum order number for fields like the given oneprotected abstract BaseCustomFieldPossibleValueCategoryServiceLocal<CF,C,PV>getPossibleValueCategoryService()Must be implemented in order to return the corresponding category serviceprotected abstract BaseCustomFieldPossibleValueServiceLocal<CF,C,PV>getPossibleValueService()Must be implemented in order to return the corresponding possible value serviceprotected List<Class<?>>getPropertyClasses()May be overridden in order to return a list of classes to apply internal name property validationsprotected abstract booleanisBinaryTypesAllowed()Indicates whether this custom field nature allows binary typesprotected booleanisEntityInternalNameRequired()NOTE: This method will be only invoked if the entity is anIInternalNamedEntity.protected ObjectonBeforeSave(CF field, CF currentCopy)May be overridden in order to perform custom logic before saving an entity.protected ValidatorresolveValidator(DTO dto)protected booleansupportsValues()Indicates whether this custom field nature can have stored values, i.e the values are persisted (e.g documents and custom operations do not have field values)protected List<CustomFieldDetailedVO>toDetailedVOs(Collection<CF> customFields)DTOtoDTO(CF field)Converts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses-
Methods inherited from class org.cyclos.impl.CRUDServiceImpl
addCustomNameValidations, checkConfirmationPassword, doRemove, find, findAll, from, getConfirmationPasswordInput, getConfirmationPasswordInputForRemove, getData, getDataForNew, getDeviceConfirmationParams, getEntityClass, getEntityInternalNameKey, getExcludedPropertiesToDTO, getExcludedPropertiesToEntity, getNameLabel, getUniqueInternalNameQuery, getUniqueNameQuery, isNameRequired, load, logEntity, newEntity, onAfterRemove, onAfterSave, onBeforeRemove, preProcessCurrentCopy, remove, remove, removeAll, removeAll, removeAllWithConfirmationPassword, removeWithConfirmationPassword, resolveDTOType, resolveEntityType, resolveExtensionPointAccessor, save, saveOrder, saveSkippingEntityLog, saveWithConfirmationPassword, shouldCheckConfirmationPassword, subClassMappings, toEntity, validate
-
Methods inherited from class org.cyclos.impl.BaseServiceImpl
initializeNetworkMappings, registerNetworkMappings
-
Methods inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
canManage, checkManagesUser, checkPermission, checkRelatesToUser, checkValue, clearAlreadyValidated, getBaseEntityManagerHandler, getConfiguration, getLoggedBasicUser, getLoggedUser, getProducts, getTranslatedName, getTranslatedValue, hasPermission, hasValue, inSameNetwork, inSameNetworkOrGlobal, isAdmin, isAlreadyValidated, isBroker, isGlobalAdmin, isGlobalAdminInNetwork, isGuest, isLoggedIn, isMember, isMemberOnly, isNetworkAdmin, isOperator, isRelatedToUser, isSystem, isUserManager, isUserManagerOf, message, message, permission, permission, permissionOptionalValue, permissionOptionalValue, setAlreadyValidated, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, dataTranslationProxy, delete, detach, doDataTranslationProxy, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cyclos.services.system.BaseCustomFieldService
saveOrder
-
Methods inherited from interface org.cyclos.services.CRUDService
getData, getDataForNew, load, remove, removeAll, save
-
Methods inherited from interface org.cyclos.impl.CRUDServiceLocal
saveEntity
-
-
-
-
Field Detail
-
dataClass
protected final Class<D extends CustomFieldData<DTO>> dataClass
-
customFieldValueHandler
@Autowired protected CustomFieldValueHandler customFieldValueHandler
-
customScriptService
@Autowired protected CustomScriptServiceLocal customScriptService
-
-
Method Detail
-
toDTO
public DTO toDTO(CF field)
Description copied from class:CRUDServiceImplConverts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses- Specified by:
toDTOin interfaceCRUDServiceLocal<CF extends CustomField<CF,C,PV>,C extends CustomFieldPossibleValueCategory<CF,C,PV>,PV extends CustomFieldPossibleValue<CF,C,PV>,A extends com.querydsl.core.types.EntityPath<CF>>- Overrides:
toDTOin classCRUDServiceImpl<CF extends CustomField<CF,C,PV>,A extends com.querydsl.core.types.EntityPath<CF>,DTO extends CustomFieldDTO,D extends CustomFieldData<DTO>,DP>
-
addCustomInternalNameValidations
protected void addCustomInternalNameValidations(Property internalName, DTO dto)
Description copied from class:CRUDServiceImplThis method may be overridden to add custom validations for the INTERNAL_NAME property.- Overrides:
addCustomInternalNameValidationsin classCRUDServiceImpl<CF extends CustomField<CF,C,PV>,A extends com.querydsl.core.types.EntityPath<CF>,DTO extends CustomFieldDTO,D extends CustomFieldData<DTO>,DP>
-
addCustomValidations
protected void addCustomValidations(Validator validator, DTO dto)
It may be overridden to add specific validations for the custom field. NOTE: You musn't add validations for the followings properties: 'internal_name' and 'name'.
UseCRUDServiceImpl.addCustomInternalNameValidations(Property, org.cyclos.model.EntityDTO)orCRUDServiceImpl.addCustomNameValidations(Property, org.cyclos.model.EntityDTO)instead.- Parameters:
dto- the DTO to be validated
-
getData
protected D getData(CF field)
Description copied from class:CRUDServiceImplReturns details data for the given entity- Specified by:
getDatain classCRUDServiceImpl<CF extends CustomField<CF,C,PV>,A extends com.querydsl.core.types.EntityPath<CF>,DTO extends CustomFieldDTO,D extends CustomFieldData<DTO>,DP>
-
getMaxOrder
protected abstract Integer getMaxOrder(CF field)
Should be implemented in order to return the maximum order number for fields like the given one
-
getPossibleValueCategoryService
protected abstract BaseCustomFieldPossibleValueCategoryServiceLocal<CF,C,PV> getPossibleValueCategoryService()
Must be implemented in order to return the corresponding category service
-
getPossibleValueService
protected abstract BaseCustomFieldPossibleValueServiceLocal<CF,C,PV> getPossibleValueService()
Must be implemented in order to return the corresponding possible value service
-
getPropertyClasses
protected List<Class<?>> getPropertyClasses()
May be overridden in order to return a list of classes to apply internal name property validations
-
isBinaryTypesAllowed
protected abstract boolean isBinaryTypesAllowed()
Indicates whether this custom field nature allows binary types
-
isEntityInternalNameRequired
protected boolean isEntityInternalNameRequired()
Description copied from class:CRUDServiceImplNOTE: This method will be only invoked if the entity is anIInternalNamedEntity. Subclasses could override it if the internal name is required.- Overrides:
isEntityInternalNameRequiredin classCRUDServiceImpl<CF extends CustomField<CF,C,PV>,A extends com.querydsl.core.types.EntityPath<CF>,DTO extends CustomFieldDTO,D extends CustomFieldData<DTO>,DP>- Returns:
- false (optional by default)
-
onBeforeSave
protected Object onBeforeSave(CF field, CF currentCopy)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic before saving an entity. Any returned value will be passed to theCRUDServiceImpl.onAfterSave(BaseEntity, BaseEntity, Object)method- Overrides:
onBeforeSavein classCRUDServiceImpl<CF extends CustomField<CF,C,PV>,A extends com.querydsl.core.types.EntityPath<CF>,DTO extends CustomFieldDTO,D extends CustomFieldData<DTO>,DP>
-
resolveValidator
protected final Validator resolveValidator(DTO dto)
- Specified by:
resolveValidatorin classCRUDServiceImpl<CF extends CustomField<CF,C,PV>,A extends com.querydsl.core.types.EntityPath<CF>,DTO extends CustomFieldDTO,D extends CustomFieldData<DTO>,DP>
-
supportsValues
protected boolean supportsValues()
Indicates whether this custom field nature can have stored values, i.e the values are persisted (e.g documents and custom operations do not have field values)
-
toDetailedVOs
protected List<CustomFieldDetailedVO> toDetailedVOs(Collection<CF> customFields)
-
-