Class ThemeServiceImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.CRUDServiceImpl<Theme,QTheme,ThemeDTO,ThemeData,ThemeDataParams>
-
- org.cyclos.impl.contentmanagement.ThemeServiceImpl
-
- All Implemented Interfaces:
ApplicationUpgradeInitializationListener,BaseApplicationInitializationListener,ThemeServiceLocal,CRUDServiceLocal<Theme,ThemeDTO,ThemeData,ThemeDataParams>,ThemeService,CRUDService<ThemeDTO,ThemeData,ThemeDataParams>,CRUDWithConfirmationPasswordService<ThemeDTO,ThemeData,ThemeDataParams>,Service
@Service public class ThemeServiceImpl extends CRUDServiceImpl<Theme,QTheme,ThemeDTO,ThemeData,ThemeDataParams> implements ThemeServiceLocal, ApplicationUpgradeInitializationListener
implementation forThemeService
-
-
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.BaseApplicationInitializationListener
MAX_PRIORITY, MIN_PRIORITY, NORMAL_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description ThemeServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplyThemes(ApplyThemesDTO params)Applies the given themes to the given configuration: logged user, guests, mobile and pay application.FileInfoexport(Long id)Exports the given themeStringgetCSS(Long id)Returns the CSS corresponding to the theme with the given idStringgetCSS(Theme theme)Returns the css content for the givenThemeprotected ThemeDatagetData(Theme theme)Returns details data for the given entityStringgetDefinition(Theme theme, ThemeDefinition definition)Returns the theme definition value for the given theme, or the default value if not set.StringgetDefinitionsAsString(Theme theme)Returns the (base) definitions as a String containing the LESS variables for the givenThemeprotected String[]getExcludedPropertiesToDTO(Theme entity)May be overridden in order to exclude properties when converting the given entity to DTOStringgetFallbackCSS(ThemeType type)Returns a default CSS corresponding to the theme type.ThemesListDatagetListData(ConfigurationVO configurationVO)Returns data to list themes in a configurationThemeVOgetTheme(ThemeType type)Returns the theme for the given type.ThemeVOgetVO(Long id)Returns theThemeVOwith the given id.List<Theme>importBuiltin()Imports all built-in themes, updating those already importedLongimportNew(ConfigurationVO configurationVO, String fileName, SerializableInputStream in)Import the theme definitions from file, creating it on the given configuration, returning the new theme idvoidinitialize()booleanisBuiltin(Theme theme)Returns whether a theme is builtinList<ThemeVO>list(ConfigurationVO configurationVO)Returns a list with visible themes on the given configuration sorted by theme type (first main web themes)List<Theme>listAll()Lists all themesThemenewEntity(ThemeDataParams params)Should be implemented in order to instantiate a new entity based on the given context parametersprotected voidonAfterSave(Theme theme, Theme currentCopy, Object dataFromOnBeforeSave)May be overridden in order to perform custom logic after saving an entityvoidonApplicationUpgradeInitialization()Invoked when the application service is initializedprotected voidonBeforeRemove(Theme theme)May be overridden in order to perform custom logic before removing an entityprotected ObjectonBeforeSave(Theme theme, Theme currentCopy)May be overridden in order to perform custom logic before saving an entity.protected voidregisterNetworkMappings(NetworkPathRegistry networkPathRegistry)Needs to be overridden by subclasses to register the path up to the networkprotected ValidatorresolveValidator(ThemeDTO dto)ThemeDTOtoDTO(Theme entity)Converts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses-
Methods inherited from class org.cyclos.impl.CRUDServiceImpl
addCustomInternalNameValidations, addCustomNameValidations, checkConfirmationPassword, doRemove, find, findAll, from, getConfirmationPasswordInput, getConfirmationPasswordInputForRemove, getData, getDataForNew, getDeviceConfirmationParams, getEntityClass, getEntityInternalNameKey, getExcludedPropertiesToEntity, getNameLabel, getUniqueInternalNameQuery, getUniqueNameQuery, isEntityInternalNameRequired, isNameRequired, load, logEntity, onAfterRemove, 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
-
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.impl.BaseApplicationInitializationListener
applicationInitializationPriority, getInitializationId
-
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, toEntity, validate
-
-
-
-
Method Detail
-
applyThemes
public void applyThemes(ApplyThemesDTO params) throws FrameworkException
Description copied from interface:ThemeServiceApplies the given themes to the given configuration: logged user, guests, mobile and pay application. Passing null means the theme will be inherited from parent configurations, but is not possible for the system default configuration. The themes must be defined within that configuration or in any of it's ancestors.- Specified by:
applyThemesin interfaceThemeService- Throws:
FrameworkException
-
export
public FileInfo export(Long id)
Description copied from interface:ThemeServiceExports the given theme- Specified by:
exportin interfaceThemeService
-
getCSS
public String getCSS(Long id)
Description copied from interface:ThemeServiceReturns the CSS corresponding to the theme with the given id- Specified by:
getCSSin interfaceThemeService
-
getCSS
public String getCSS(Theme theme)
Description copied from interface:ThemeServiceLocalReturns the css content for the givenTheme- Specified by:
getCSSin interfaceThemeServiceLocal
-
getDefinition
public String getDefinition(Theme theme, ThemeDefinition definition)
Description copied from interface:ThemeServiceLocalReturns the theme definition value for the given theme, or the default value if not set.- Specified by:
getDefinitionin interfaceThemeServiceLocal
-
getDefinitionsAsString
public String getDefinitionsAsString(Theme theme)
Description copied from interface:ThemeServiceLocalReturns the (base) definitions as a String containing the LESS variables for the givenTheme- Specified by:
getDefinitionsAsStringin interfaceThemeServiceLocal
-
getFallbackCSS
public String getFallbackCSS(ThemeType type)
Description copied from interface:ThemeServiceReturns a default CSS corresponding to the theme type. It's used only in case the selected theme fails to compile.- Specified by:
getFallbackCSSin interfaceThemeService
-
getListData
public ThemesListData getListData(ConfigurationVO configurationVO) throws FrameworkException
Description copied from interface:ThemeServiceReturns data to list themes in a configuration- Specified by:
getListDatain interfaceThemeService- Throws:
FrameworkException
-
getTheme
public ThemeVO getTheme(ThemeType type) throws FrameworkException
Description copied from interface:ThemeServiceReturns the theme for the given type. In case ofThemeType.MAIN_WEBthe returned theme depends on if there is a logged user or not.- Specified by:
getThemein interfaceThemeService- Throws:
FrameworkException
-
getVO
public ThemeVO getVO(Long id) throws EntityNotFoundException
Description copied from interface:ThemeServiceReturns theThemeVOwith the given id.- Specified by:
getVOin interfaceThemeService- Throws:
EntityNotFoundException
-
importBuiltin
public List<Theme> importBuiltin()
Description copied from interface:ThemeServiceLocalImports all built-in themes, updating those already imported- Specified by:
importBuiltinin interfaceThemeServiceLocal
-
importNew
public Long importNew(ConfigurationVO configurationVO, String fileName, SerializableInputStream in) throws FileParsingException
Description copied from interface:ThemeServiceImport the theme definitions from file, creating it on the given configuration, returning the new theme id- Specified by:
importNewin interfaceThemeService- Throws:
FileParsingException
-
initialize
@PostConstruct public void initialize() throws IOException- Throws:
IOException
-
isBuiltin
public boolean isBuiltin(Theme theme)
Description copied from interface:ThemeServiceLocalReturns whether a theme is builtin- Specified by:
isBuiltinin interfaceThemeServiceLocal
-
list
public List<ThemeVO> list(ConfigurationVO configurationVO)
Description copied from interface:ThemeServiceReturns a list with visible themes on the given configuration sorted by theme type (first main web themes)- Specified by:
listin interfaceThemeService
-
listAll
public List<Theme> listAll()
Description copied from interface:ThemeServiceLocalLists all themes- Specified by:
listAllin interfaceThemeServiceLocal
-
newEntity
public Theme newEntity(ThemeDataParams params)
Description copied from class:CRUDServiceImplShould be implemented in order to instantiate a new entity based on the given context parameters- Specified by:
newEntityin interfaceCRUDServiceLocal<Theme,ThemeDTO,ThemeData,ThemeDataParams>- Specified by:
newEntityin classCRUDServiceImpl<Theme,QTheme,ThemeDTO,ThemeData,ThemeDataParams>
-
onApplicationUpgradeInitialization
public void onApplicationUpgradeInitialization()
Description copied from interface:ApplicationUpgradeInitializationListenerInvoked when the application service is initialized- Specified by:
onApplicationUpgradeInitializationin interfaceApplicationUpgradeInitializationListener
-
toDTO
public ThemeDTO toDTO(Theme entity)
Description copied from class:CRUDServiceImplConverts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses- Specified by:
toDTOin interfaceCRUDServiceLocal<Theme,ThemeDTO,ThemeData,ThemeDataParams>- Overrides:
toDTOin classCRUDServiceImpl<Theme,QTheme,ThemeDTO,ThemeData,ThemeDataParams>
-
getData
protected ThemeData getData(Theme theme)
Description copied from class:CRUDServiceImplReturns details data for the given entity- Specified by:
getDatain classCRUDServiceImpl<Theme,QTheme,ThemeDTO,ThemeData,ThemeDataParams>
-
getExcludedPropertiesToDTO
protected String[] getExcludedPropertiesToDTO(Theme entity)
Description copied from class:CRUDServiceImplMay be overridden in order to exclude properties when converting the given entity to DTO- Overrides:
getExcludedPropertiesToDTOin classCRUDServiceImpl<Theme,QTheme,ThemeDTO,ThemeData,ThemeDataParams>
-
onAfterSave
protected void onAfterSave(Theme theme, Theme currentCopy, Object dataFromOnBeforeSave)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic after saving an entity- Overrides:
onAfterSavein classCRUDServiceImpl<Theme,QTheme,ThemeDTO,ThemeData,ThemeDataParams>
-
onBeforeRemove
protected void onBeforeRemove(Theme theme)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic before removing an entity- Overrides:
onBeforeRemovein classCRUDServiceImpl<Theme,QTheme,ThemeDTO,ThemeData,ThemeDataParams>
-
onBeforeSave
protected Object onBeforeSave(Theme theme, Theme 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<Theme,QTheme,ThemeDTO,ThemeData,ThemeDataParams>
-
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(ThemeDTO dto)
- Specified by:
resolveValidatorin classCRUDServiceImpl<Theme,QTheme,ThemeDTO,ThemeData,ThemeDataParams>
-
-