Package de.xima.fc.entities
Class ClientFormTheme
- java.lang.Object
-
- de.xima.cmn.dao.model.AEntity<Long>
-
- de.xima.fc.entities.AbstractEntity
-
- de.xima.fc.entities.AbstractLockableEntity
-
- de.xima.fc.entities.ALockableEntity
-
- de.xima.fc.entities.ClientFormTheme
-
- All Implemented Interfaces:
de.xima.cmn.dao.interfaces.IEntity<Long>
,de.xima.cmn.dao.interfaces.ILockableEntity<Long>
,ICustomAttributeProviding
,ICustomAttributesEntity
,IDescriptionProviding
,IFileListProviding<ClientFormThemeFile,ClientFormThemeFileData>
,ILockingVersionProviding
,IMandantDependent
,INameHolding
,INameProviding
,ITransferable
,ITransferableEntity
,ITransferableLockableEntity
,IUUIDEntity
,Serializable
,Comparable<de.xima.cmn.dao.interfaces.IEntity<Long>>
@Entity public class ClientFormTheme extends ALockableEntity implements IMandantDependent, INameHolding, IDescriptionProviding, IUUIDEntity, ICustomAttributesEntity, IFileListProviding<ClientFormThemeFile,ClientFormThemeFileData>
Entity model for a form theme. A form theme is a collection of text and binary resources that are used to style a form, such as JavaScript files, CSS flies, fonts, and images. Users can select a form theme in the form designer; each form can have a different form theme. The form theme affects both the main web form and related pages such as HTML templates.- Since:
- 8.3.0
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
ATTR_CLIENT
JPA attribute name for thegetClient()
field.static String
ATTR_FILES
JPA attribute name for thegetFiles()
field.static String
ATTR_MANDANT
Deprecated.UseATTR_CLIENT
instead.static String
CUSTOM_ATTR_PARENT_FORM_THEME_PREFIX
The prefix for the keys of thecustom attributes
that stores theparent form theme
.-
Fields inherited from class de.xima.fc.entities.AbstractLockableEntity
COL_LOCKINGVERSION, lockingVersion
-
Fields inherited from class de.xima.fc.entities.AbstractEntity
COL_ID, id
-
Fields inherited from interface de.xima.fc.entities.interfaces.ICustomAttributesEntity
ATTR_CUSTOM_ATTRIBUTES, COL_CUSTOM_ATTRIBUTE_NAME, COL_CUSTOM_ATTRIBUTE_VALUE
-
Fields inherited from interface de.xima.fc.entities.interfaces.IDescriptionProviding
ATTR_BESCHREIBUNG, ATTR_DESCRIPTION, COL_DESCRIPTION
-
Fields inherited from interface de.xima.fc.entities.interfaces.IMandantDependent
COL_CLIENT_ID
-
Fields inherited from interface de.xima.fc.entities.interfaces.INameProviding
ATTR_NAME, COL_NAME
-
Fields inherited from interface de.xima.fc.entities.interfaces.ITransferableEntity
IMPORT_ID, INVALID_ID
-
Fields inherited from interface de.xima.fc.entities.interfaces.IUUIDEntity
ATTR_UUID, COL_UUID, INVALID_UUID, INVALID_UUID_OBJECT, NULL_SAFE_UUID_TYPE, NULLABLE_UUID_TYPE, TYPE_NAME_UUID
-
-
Constructor Summary
Constructors Constructor Description ClientFormTheme()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ClientFormThemeFile
addOrReplaceFile(String resourceContext, String fileName, byte[] data, IUser user)
Adds a file with the given context and file name to this theme.ClientFormTheme
cloneBasics()
Creates a copy of this client form theme, with all basic field (i.e.String
getBeschreibung()
Deprecated.UsegetDescription()
instead.Mandant
getClient()
Gets the client scope to which this form theme belongs.Map<String,String>
getCustomAttributes()
Gets the custom attributes that may be used to store additional information.String
getDescription()
Gets the internal description of this form theme.ClientFormThemeFile
getFile(String resourceContext, String fileName)
Gets a file with the given file name from the given context, if such a file exists.byte[]
getFileData(String resourceContext, String fileName)
Gets the binary content of the given file.List<ClientFormThemeFile>
getFiles()
Gets the list of files that are used by this form theme.Map<ClientFormThemeFile.ClientFormThemeFileId,ClientFormThemeFile>
getFilesMapFlat()
Creates a new, modifiable map that represents a snapshot of the currentfiles
.Map<String,Map<String,ClientFormThemeFile>>
getFilesMapNested()
Creates a new, modifiable map that represents a snapshot of the currentfiles
.Long
getId()
Gets the database ID of this form theme.Mandant
getMandant()
Deprecated.UsegetClient()
instead.String
getName()
The name of this form theme.FormThemeReference
getParentFormTheme()
Gets the parent theme from which this theme inherits.String
getUUID()
Gets the UUID of this entity as a string.UUID
getUUIDObject()
Gets the UUID of this entity.boolean
hasFile(String resourceContext, String fileName)
Checks whether a file with the given file name from the given context exists.void
removeFile(String resourceContext, String fileName)
Remove a file with the given file name from the given context, if such a file exists.void
setClient(Mandant client)
The client scope to which this form theme belongs.void
setCustomAttributes(Map<String,String> customAttributes)
Sets the custom attributes that may be used to store additional information.void
setDescription(String description)
Sets the internal description of this form theme.void
setFiles(List<ClientFormThemeFile> files)
Sets the list of files that are used by this form theme.void
setId(Long id)
Sets the database ID of this form theme.void
setMandant(Mandant client)
Deprecated.UsesetClient(Mandant)
instead.void
setName(String name)
The name of this form theme.void
setParentFormTheme(FormThemeReference parentFormTheme)
Sets the parent theme from which this theme inherits.void
setUUID(String uuid)
Sets the UUID of this entity.void
setUUIDObject(UUID uuid)
Sets the UUID of this entity.-
Methods inherited from class de.xima.fc.entities.AbstractLockableEntity
entityHasChanged, getLockingVersion, setLockingVersion, toString
-
Methods inherited from class de.xima.fc.entities.AbstractEntity
asIntValue, isPersisted, setId
-
Methods inherited from class de.xima.cmn.dao.model.AEntity
compareTo, equals, getDBTableName, hashCode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface de.xima.fc.entities.interfaces.ICustomAttributeProviding
getCustomAttribute, getCustomAttributeAs, getCustomAttributeAs, getCustomAttributeBoolean, getCustomAttributeDouble, getCustomAttributeDouble, getCustomAttributeEnum, getCustomAttributeEnum, getCustomAttributeInt, getCustomAttributeInt, getCustomAttributeJsonArray, getCustomAttributeJsonObject, getCustomAttributeLong, getCustomAttributeLong, getCustomAttributeString, getCustomAttributeString, getCustomAttributeUuid
-
Methods inherited from interface de.xima.fc.entities.interfaces.ICustomAttributesEntity
removeCustomAttribute, setCustomAttribute, setCustomAttributeBoolean, setCustomAttributeDouble, setCustomAttributeEnum, setCustomAttributeInt, setCustomAttributeJSONArray, setCustomAttributeJSONObject, setCustomAttributeLong, setCustomAttributeString, setCustomAttributeUuid
-
Methods inherited from interface de.xima.fc.entities.interfaces.IFileListProviding
addFile, addFile, getFile, removeFile, setFile
-
-
-
-
Field Detail
-
ATTR_CLIENT
public static final String ATTR_CLIENT
JPA attribute name for thegetClient()
field.- See Also:
- Constant Field Values
-
ATTR_FILES
public static final String ATTR_FILES
JPA attribute name for thegetFiles()
field.- See Also:
- Constant Field Values
-
ATTR_MANDANT
@Deprecated public static final String ATTR_MANDANT
Deprecated.UseATTR_CLIENT
instead.JPA attribute name for thegetClient()
field.- See Also:
- Constant Field Values
-
CUSTOM_ATTR_PARENT_FORM_THEME_PREFIX
public static final String CUSTOM_ATTR_PARENT_FORM_THEME_PREFIX
The prefix for the keys of thecustom attributes
that stores theparent form theme
. SeeFormThemeReference#toAttributeMap
andofAttributeMap
.- See Also:
- Constant Field Values
-
-
Method Detail
-
addOrReplaceFile
public ClientFormThemeFile addOrReplaceFile(String resourceContext, String fileName, byte[] data, IUser user)
Adds a file with the given context and file name to this theme. When a file with the context and file name exists already, overrides the data of that file.- Parameters:
resourceContext
- The resource context the file is used in, seeEFormThemeResourceContext
for well-known contexts. See alsogetResourceContext()
.fileName
- The name of the file. The file name must be unique among all files with the same context.data
- The data of the file.user
- The user who adds the file. May be null for the anonymous user.- Returns:
- The file that was added or replaced.
-
cloneBasics
public ClientFormTheme cloneBasics()
Creates a copy of this client form theme, with all basic field (i.e. without referenced entities) copied.- Returns:
- A copy of this client form theme.
-
getBeschreibung
@Deprecated public String getBeschreibung()
Deprecated.UsegetDescription()
instead.Gets the internal description of this form theme. The description is only visible in the backend when editing the theme.- Specified by:
getBeschreibung
in interfaceIDescriptionProviding
- Returns:
- The internal description of this form theme.
-
getClient
public Mandant getClient()
Gets the client scope to which this form theme belongs.- Returns:
- client This theme's client scope.
-
setClient
public void setClient(Mandant client)
The client scope to which this form theme belongs.- Parameters:
client
- This theme's client scope.
-
getCustomAttributes
public Map<String,String> getCustomAttributes()
Gets the custom attributes that may be used to store additional information.- Specified by:
getCustomAttributes
in interfaceICustomAttributeProviding
- Returns:
- The custom attributes.
-
setCustomAttributes
public void setCustomAttributes(Map<String,String> customAttributes)
Sets the custom attributes that may be used to store additional information.- Specified by:
setCustomAttributes
in interfaceICustomAttributesEntity
- Parameters:
customAttributes
- The custom attributes to set.
-
getDescription
public String getDescription()
Gets the internal description of this form theme. The description is only visible in the backend when editing the theme.- Specified by:
getDescription
in interfaceIDescriptionProviding
- Returns:
- The internal description of this form theme.
-
setDescription
public void setDescription(String description)
Sets the internal description of this form theme. The description is only visible in the backend when editing the theme.- Parameters:
description
- The internal description of this form theme.
-
getFile
public ClientFormThemeFile getFile(String resourceContext, String fileName)
Gets a file with the given file name from the given context, if such a file exists.- Parameters:
resourceContext
- The resource context the file is used in, seeEFormThemeResourceContext
for well-known contexts. See alsogetResourceContext()
.fileName
- The name of the file. The file name must be unique among all files with the same context.- Returns:
- The file with the given context and file name, or null if no such file exists.
-
getFileData
public byte[] getFileData(String resourceContext, String fileName)
Gets the binary content of the given file. When the file does not exist, returns null.- Parameters:
resourceContext
- The resource context the file is used in, seeEFormThemeResourceContext
for well-known contexts. See alsogetResourceContext()
.fileName
- The name of the file. The file name must be unique among all files with the same context.- Returns:
- The binary content of the file, or null if the file does not exist.
-
getFiles
public List<ClientFormThemeFile> getFiles()
Gets the list of files that are used by this form theme. This includes plain text resources such as JavaScript and CSS files, as well as binary resources such as images and fonts. Unless the order is determined in some other way, resources such as CSS and JavaScript files are inserted in the order of their file name. The file name must be unique among all files in the same form theme.- Specified by:
getFiles
in interfaceIFileListProviding<ClientFormThemeFile,ClientFormThemeFileData>
- Returns:
- The list of files used by this form theme.
-
setFiles
public void setFiles(List<ClientFormThemeFile> files)
Sets the list of files that are used by this form theme. This includes plain text resources such as JavaScript and CSS files, as well as binary resources such as images and fonts. Unless the order is determined in some other way, resources such as CSS and JavaScript files are inserted in the order of their file name. The file name must be unique among all files in the same form theme.- Specified by:
setFiles
in interfaceIFileListProviding<ClientFormThemeFile,ClientFormThemeFileData>
- Parameters:
files
- The list of files used by this form theme.
-
getFilesMapFlat
public Map<ClientFormThemeFile.ClientFormThemeFileId,ClientFormThemeFile> getFilesMapFlat()
Creates a new, modifiable map that represents a snapshot of the currentfiles
. The map key is theID
of theClientFormThemeFile
, the map value thefile
itself.- Returns:
- A new map with all files.
-
getFilesMapNested
public Map<String,Map<String,ClientFormThemeFile>> getFilesMapNested()
Creates a new, modifiable map that represents a snapshot of the currentfiles
. The map key is theresource context
, the map value another map with thefile path
as the key and thefile
itself as the value.- Returns:
- A new map with all files.
-
getId
public Long getId()
Gets the database ID of this form theme. The database ID is unique within the system, across all clients.- Specified by:
getId
in interfacede.xima.cmn.dao.interfaces.IEntity<Long>
- Returns:
- The database ID of this form theme.
-
setId
public void setId(Long id)
Sets the database ID of this form theme. The database ID is unique within the system, across all clients. Note: Since the ID is generated by the database, this method should normally not be used.- Specified by:
setId
in interfacede.xima.cmn.dao.interfaces.IEntity<Long>
- Overrides:
setId
in classAbstractEntity
- Parameters:
id
- The database ID of this form theme.
-
getMandant
@Deprecated public Mandant getMandant()
Deprecated.UsegetClient()
instead.Gets the client scope to which this form theme belongs.- Specified by:
getMandant
in interfaceIMandantDependent
- Returns:
- client This theme's client scope.
-
setMandant
@Deprecated public void setMandant(Mandant client)
Deprecated.UsesetClient(Mandant)
instead.The client scope to which this form theme belongs.- Specified by:
setMandant
in interfaceIMandantDependent
- Parameters:
client
- This theme's client scope.
-
getName
public String getName()
The name of this form theme. The name is displayed in the form designer and can be edited in the backend.- Specified by:
getName
in interfaceINameProviding
- Returns:
- The new name of this form theme.
-
setName
public void setName(String name)
The name of this form theme. The name is displayed in the form designer and can be edited in the backend.- Specified by:
setName
in interfaceINameHolding
- Parameters:
name
- The new name of this form theme.
-
getParentFormTheme
public FormThemeReference getParentFormTheme()
Gets the parent theme from which this theme inherits. If this theme has no parent, it is a top-level theme. Otherwise, the parent theme's CSS and JavaScript files are included first, before this theme. A parent may itself have a parent.- Returns:
- The parent theme from which this theme inherits. May be null.
-
setParentFormTheme
public void setParentFormTheme(FormThemeReference parentFormTheme)
Sets the parent theme from which this theme inherits. If this theme has no parent, it is a top-level theme. Otherwise, the parent theme's CSS and JavaScript files are included first, before this theme. A parent may itself have a parent.- Parameters:
parentFormTheme
- The parent theme from which this theme inherits. May be null.
-
getUUID
public String getUUID()
Gets the UUID of this entity as a string. The UUID is unique amongst all form themes belonging to the same client.- Specified by:
getUUID
in interfaceIUUIDEntity
- Returns:
- uuid The UUID of the entity.
-
setUUID
public void setUUID(String uuid)
Sets the UUID of this entity. The UUID is unique amongst all form themes belonging to the same client.- Specified by:
setUUID
in interfaceIUUIDEntity
- Parameters:
uuid
- The UUID of the entity. Must be a valid UUID-4 string.- Throws:
IllegalArgumentException
- If the UUID is non-empty and not a valid UUID-4 string.
-
getUUIDObject
public UUID getUUIDObject()
Gets the UUID of this entity. The UUID is unique amongst all form themes belonging to the same client.- Specified by:
getUUIDObject
in interfaceIUUIDEntity
- Returns:
- uuid The UUID of the entity.
-
setUUIDObject
public void setUUIDObject(UUID uuid)
Sets the UUID of this entity. The UUID is unique amongst all form themes belonging to the same client.- Parameters:
uuid
- The UUID of the entity. Must be a valid UUID-4 string.
-
hasFile
public boolean hasFile(String resourceContext, String fileName)
Checks whether a file with the given file name from the given context exists.- Parameters:
resourceContext
- The resource context the file is used in, seeEFormThemeResourceContext
for well-known contexts. See alsogetResourceContext()
.fileName
- The name of the file. The file name must be unique among all files with the same context.- Returns:
- True if a file with the given file name from the given context exists, false otherwise.
-
removeFile
public void removeFile(String resourceContext, String fileName)
Remove a file with the given file name from the given context, if such a file exists. Does nothing if no such file exists.- Parameters:
resourceContext
- The resource context the file is used in, seeEFormThemeResourceContext
for well-known contexts. See alsogetResourceContext()
.fileName
- The name of the file. The file name must be unique among all files with the same context.
-
-