Package org.cyclos.impl.system
Class ConfigurationServiceImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.CRUDServiceImpl<Configuration,QConfiguration,ConfigurationDTO,ConfigurationData,ConfigurationVO>
-
- org.cyclos.impl.system.ConfigurationServiceImpl
-
- All Implemented Interfaces:
CRUDServiceLocal<Configuration,ConfigurationDTO,ConfigurationData,ConfigurationVO>,ConfigurationServiceLocal,CRUDService<ConfigurationDTO,ConfigurationData,ConfigurationVO>,CRUDWithConfirmationPasswordService<ConfigurationDTO,ConfigurationData,ConfigurationVO>,Service,ConfigurationService
@Service public class ConfigurationServiceImpl extends CRUDServiceImpl<Configuration,QConfiguration,ConfigurationDTO,ConfigurationData,ConfigurationVO> implements ConfigurationServiceLocal
implementation forConfigurationService
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.CRUDServiceImpl
$, ATTR_CURRENT_COPY, dtoClass, entityClass, extensionPointService, idPath, internalNamePath, namePath, ownerEntityIdPath, ownerEntityPath, ownerEntityPropertyName, passwordHandler, richTextHandler, withConfirmationPassword
-
Fields inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
authHandler, conversionHandler, customFieldValueHandler, entityManagerHandler, groupsHandler, productsHandler, restBeanPropertyMapping, userLocatorHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
Fields inherited from interface org.cyclos.impl.system.ConfigurationServiceLocal
UNACCENT
-
-
Constructor Summary
Constructors Constructor Description ConfigurationServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigurationcreateDefaultForNetwork(Network network)Creates the default configuration for the given networkActiveConfigurationDatagetActiveConfiguration(ConfigurationVO configurationVO)Returns the active configuration for the configuration with the given idList<Configuration>getConfigurationTreePath(Configuration configuration)Returns the configuration tree path for the given configuration If the logged user is global then the global configurations will also be returned.protected ConfigurationDatagetData(Configuration configuration)Returns details data for the given entityConfigurationVOgetDefault()Returns the default configuration for the current network (or the global default configuration)protected Object[]getExcludedPropertiesToEntity(ConfigurationDTO dto)May be overridden in order to exclude properties when converting the given DTO to entityConfigurationSearchDatagetSearchData()Gets data used on the search pageList<ConfigurationDetailedVO>list()Returns all visible configurationsList<Configuration>listAll()Returns all configurationsList<Configuration>listByThemeUsage(Theme theme, ThemeUsage usage)Lists the configurations which uses the given theme under the given usage typeList<Configuration>listVisible()Returns the configurations which are visible by the logged administratorConfigurationnewEntity(ConfigurationVO parentVO)Should be implemented in order to instantiate a new entity based on the given context parametersprotected voidonAfterRemove(Configuration entity)May be overridden in order to perform custom logic after removing an entityprotected voidonAfterSave(Configuration configuration, Configuration currentCopy, Object dataFromOnBeforeSave)May be overridden in order to perform custom logic after saving an entityprotected ObjectonBeforeSave(Configuration configuration, Configuration currentCopy)May be overridden in order to perform custom logic before saving an entity.protected voidpreProcessCurrentCopy(ConfigurationDTO dto, Configuration currentCopy)This method is invoked before saving the entity and also, if the log is enabled, before removing.protected voidregisterNetworkMappings(NetworkPathRegistry networkPathRegistry)Needs to be overridden by subclasses to register the path up to the networkvoidremoveGroup(Group group)Removes a group from any configuration; usually done when the group is disabled, and not supposed to show up anymore.protected ValidatorresolveValidator(ConfigurationDTO dto)Page<ConfigurationDetailedVO>search(ConfigurationQuery params)Search configurations according to the specified query parameters<T> voidsetConfiguration(Configuration configuration, com.querydsl.core.types.Path<T> path, T value)Sets a configuration property and add it on the defined collectionvoidsetLocalization(Configuration configuration, Language language, String country, String timeZoneId)Sets the localization options in the given configuration, defining the language, country and time zone, as well as fields derived from the language and coutry, like date and number format.List<Configuration>sortByHierarchy(Collection<Configuration> configurations)Sort the given configurations according to the hierarchy<T extends ActiveConfigurationData>
TtoActiveConfiguration(Class<T> dataType, ConfigurationAccessor accessor)Converts the givenConfigurationAccessorinto anActiveConfigurationDataAddressConfigurationDatatoAddressConfiguration(ConfigurationAccessor accessor)Converts the givenConfigurationAccessorinto anAddressConfigurationDataConfigurationDTOtoDTO(Configuration configuration)Converts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclassesConfigurationtoEntity(ConfigurationDTO dto)Converts the given DTO in an entity, handling theCRUDServiceImpl.subClassMappings()mappings for subclassesPhoneConfigurationDatatoPhoneConfiguration(ConfigurationAccessor accessor)Converts the givenConfigurationAccessorinto aPhoneConfigurationDatavoidupdateSitemapLastModified(Configuration configuration)Marks the configuration's sitemap as modified-
Methods inherited from class org.cyclos.impl.CRUDServiceImpl
addCustomInternalNameValidations, addCustomNameValidations, checkConfirmationPassword, doRemove, find, findAll, from, getConfirmationPasswordInput, getConfirmationPasswordInputForRemove, getData, getDataForNew, getDeviceConfirmationParams, getEntityClass, getEntityInternalNameKey, getExcludedPropertiesToDTO, getNameLabel, getUniqueInternalNameQuery, getUniqueNameQuery, isEntityInternalNameRequired, isNameRequired, load, logEntity, onBeforeRemove, remove, remove, removeAll, removeAll, removeAllWithConfirmationPassword, removeWithConfirmationPassword, resolveDTOType, resolveEntityType, resolveExtensionPointAccessor, save, saveOrder, saveSkippingEntityLog, saveWithConfirmationPassword, shouldCheckConfirmationPassword, subClassMappings, validate
-
Methods inherited from class org.cyclos.impl.BaseServiceImpl
initializeNetworkMappings
-
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, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, delete, detach, 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.CRUDService
getData, getDataForNew, load, remove, removeAll, save
-
Methods inherited from interface org.cyclos.impl.CRUDServiceLocal
find, findAll, getEntityClass, remove, removeAll, saveEntity, saveSkippingEntityLog, validate
-
-
-
-
Method Detail
-
createDefaultForNetwork
public Configuration createDefaultForNetwork(Network network) throws FrameworkException
Description copied from interface:ConfigurationServiceLocalCreates the default configuration for the given network- Specified by:
createDefaultForNetworkin interfaceConfigurationServiceLocal- Throws:
FrameworkException
-
getActiveConfiguration
public ActiveConfigurationData getActiveConfiguration(ConfigurationVO configurationVO)
Description copied from interface:ConfigurationServiceReturns the active configuration for the configuration with the given id- Specified by:
getActiveConfigurationin interfaceConfigurationService
-
getConfigurationTreePath
public List<Configuration> getConfigurationTreePath(Configuration configuration)
Description copied from interface:ConfigurationServiceLocalReturns the configuration tree path for the given configuration If the logged user is global then the global configurations will also be returned.- Specified by:
getConfigurationTreePathin interfaceConfigurationServiceLocal
-
getDefault
public ConfigurationVO getDefault() throws FrameworkException
Description copied from interface:ConfigurationServiceReturns the default configuration for the current network (or the global default configuration)- Specified by:
getDefaultin interfaceConfigurationService- Throws:
FrameworkException
-
getSearchData
public ConfigurationSearchData getSearchData()
Description copied from interface:ConfigurationServiceGets data used on the search page- Specified by:
getSearchDatain interfaceConfigurationService
-
list
public List<ConfigurationDetailedVO> list() throws FrameworkException
Description copied from interface:ConfigurationServiceReturns all visible configurations- Specified by:
listin interfaceConfigurationService- Throws:
FrameworkException
-
listAll
public List<Configuration> listAll()
Description copied from interface:ConfigurationServiceLocalReturns all configurations- Specified by:
listAllin interfaceConfigurationServiceLocal
-
listByThemeUsage
public List<Configuration> listByThemeUsage(Theme theme, ThemeUsage usage) throws FrameworkException
Description copied from interface:ConfigurationServiceLocalLists the configurations which uses the given theme under the given usage type- Specified by:
listByThemeUsagein interfaceConfigurationServiceLocal- Throws:
FrameworkException
-
listVisible
public List<Configuration> listVisible() throws FrameworkException
Description copied from interface:ConfigurationServiceLocalReturns the configurations which are visible by the logged administrator- Specified by:
listVisiblein interfaceConfigurationServiceLocal- Throws:
FrameworkException
-
newEntity
public Configuration newEntity(ConfigurationVO parentVO)
Description copied from class:CRUDServiceImplShould be implemented in order to instantiate a new entity based on the given context parameters- Specified by:
newEntityin interfaceCRUDServiceLocal<Configuration,ConfigurationDTO,ConfigurationData,ConfigurationVO>- Specified by:
newEntityin classCRUDServiceImpl<Configuration,QConfiguration,ConfigurationDTO,ConfigurationData,ConfigurationVO>
-
removeGroup
public void removeGroup(Group group)
Description copied from interface:ConfigurationServiceLocalRemoves a group from any configuration; usually done when the group is disabled, and not supposed to show up anymore. The group is removed from possibleInitialGroups and from visibleGroups.- Specified by:
removeGroupin interfaceConfigurationServiceLocal
-
search
public Page<ConfigurationDetailedVO> search(ConfigurationQuery params)
Description copied from interface:ConfigurationServiceSearch configurations according to the specified query parameters- Specified by:
searchin interfaceConfigurationService
-
setConfiguration
public <T> void setConfiguration(Configuration configuration, com.querydsl.core.types.Path<T> path, T value)
Description copied from interface:ConfigurationServiceLocalSets a configuration property and add it on the defined collection- Specified by:
setConfigurationin interfaceConfigurationServiceLocal
-
setLocalization
public void setLocalization(Configuration configuration, Language language, String country, String timeZoneId) throws FrameworkException
Description copied from interface:ConfigurationServiceLocalSets the localization options in the given configuration, defining the language, country and time zone, as well as fields derived from the language and coutry, like date and number format.- Specified by:
setLocalizationin interfaceConfigurationServiceLocal- Throws:
FrameworkException
-
sortByHierarchy
public List<Configuration> sortByHierarchy(Collection<Configuration> configurations) throws FrameworkException
Description copied from interface:ConfigurationServiceLocalSort the given configurations according to the hierarchy- Specified by:
sortByHierarchyin interfaceConfigurationServiceLocal- Throws:
FrameworkException
-
toActiveConfiguration
public <T extends ActiveConfigurationData> T toActiveConfiguration(Class<T> dataType, ConfigurationAccessor accessor) throws FrameworkException
Description copied from interface:ConfigurationServiceLocalConverts the givenConfigurationAccessorinto anActiveConfigurationData- Specified by:
toActiveConfigurationin interfaceConfigurationServiceLocal- Throws:
FrameworkException
-
toAddressConfiguration
public AddressConfigurationData toAddressConfiguration(ConfigurationAccessor accessor) throws FrameworkException
Description copied from interface:ConfigurationServiceLocalConverts the givenConfigurationAccessorinto anAddressConfigurationData- Specified by:
toAddressConfigurationin interfaceConfigurationServiceLocal- Throws:
FrameworkException
-
toDTO
public ConfigurationDTO toDTO(Configuration configuration)
Description copied from class:CRUDServiceImplConverts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses- Specified by:
toDTOin interfaceCRUDServiceLocal<Configuration,ConfigurationDTO,ConfigurationData,ConfigurationVO>- Overrides:
toDTOin classCRUDServiceImpl<Configuration,QConfiguration,ConfigurationDTO,ConfigurationData,ConfigurationVO>
-
toEntity
public Configuration toEntity(ConfigurationDTO dto)
Description copied from class:CRUDServiceImplConverts the given DTO in an entity, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses- Specified by:
toEntityin interfaceCRUDServiceLocal<Configuration,ConfigurationDTO,ConfigurationData,ConfigurationVO>- Overrides:
toEntityin classCRUDServiceImpl<Configuration,QConfiguration,ConfigurationDTO,ConfigurationData,ConfigurationVO>
-
toPhoneConfiguration
public PhoneConfigurationData toPhoneConfiguration(ConfigurationAccessor accessor) throws FrameworkException
Description copied from interface:ConfigurationServiceLocalConverts the givenConfigurationAccessorinto aPhoneConfigurationData- Specified by:
toPhoneConfigurationin interfaceConfigurationServiceLocal- Throws:
FrameworkException
-
updateSitemapLastModified
public void updateSitemapLastModified(Configuration configuration) throws FrameworkException
Description copied from interface:ConfigurationServiceLocalMarks the configuration's sitemap as modified- Specified by:
updateSitemapLastModifiedin interfaceConfigurationServiceLocal- Throws:
FrameworkException
-
getData
protected ConfigurationData getData(Configuration configuration)
Description copied from class:CRUDServiceImplReturns details data for the given entity- Specified by:
getDatain classCRUDServiceImpl<Configuration,QConfiguration,ConfigurationDTO,ConfigurationData,ConfigurationVO>
-
getExcludedPropertiesToEntity
protected Object[] getExcludedPropertiesToEntity(ConfigurationDTO dto)
Description copied from class:CRUDServiceImplMay be overridden in order to exclude properties when converting the given DTO to entity- Overrides:
getExcludedPropertiesToEntityin classCRUDServiceImpl<Configuration,QConfiguration,ConfigurationDTO,ConfigurationData,ConfigurationVO>
-
onAfterRemove
protected void onAfterRemove(Configuration entity)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic after removing an entity- Overrides:
onAfterRemovein classCRUDServiceImpl<Configuration,QConfiguration,ConfigurationDTO,ConfigurationData,ConfigurationVO>
-
onAfterSave
protected void onAfterSave(Configuration configuration, Configuration currentCopy, Object dataFromOnBeforeSave)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic after saving an entity- Overrides:
onAfterSavein classCRUDServiceImpl<Configuration,QConfiguration,ConfigurationDTO,ConfigurationData,ConfigurationVO>
-
onBeforeSave
protected Object onBeforeSave(Configuration configuration, Configuration 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<Configuration,QConfiguration,ConfigurationDTO,ConfigurationData,ConfigurationVO>
-
preProcessCurrentCopy
protected void preProcessCurrentCopy(ConfigurationDTO dto, Configuration currentCopy)
Description copied from class:CRUDServiceImplThis method is invoked before saving the entity and also, if the log is enabled, before removing. Subclasses can override it to fetch lazy relationships, etc as the current copy will be detached. In case of removing (i.e the log is enabled for this entity) the dto parameter will be null.- Overrides:
preProcessCurrentCopyin classCRUDServiceImpl<Configuration,QConfiguration,ConfigurationDTO,ConfigurationData,ConfigurationVO>
-
registerNetworkMappings
protected void registerNetworkMappings(NetworkPathRegistry networkPathRegistry)
Description copied from class:BaseServiceImplNeeds to be overridden by subclasses to register the path up to the network- Specified by:
registerNetworkMappingsin classBaseServiceImpl
-
resolveValidator
protected Validator resolveValidator(ConfigurationDTO dto)
- Specified by:
resolveValidatorin classCRUDServiceImpl<Configuration,QConfiguration,ConfigurationDTO,ConfigurationData,ConfigurationVO>
-
-