Package de.xima.fc.handler.system
Class FormThemeHandler
- java.lang.Object
-
- de.xima.fc.handler.AMSApiHandler
-
- de.xima.fc.handler.system.FormThemeHandler
-
- All Implemented Interfaces:
IAPIHandler
,IFormThemeHandler
,Serializable
public class FormThemeHandler extends AMSApiHandler implements IFormThemeHandler
Handler implementation for theIFormHandler
that allows common operations onform themes
.- Since:
- 8.3.0
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FormThemeHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FormThemeReference
findDefaultFormThemeByClient(UserContext userContext, Mandant client)
Gets the default form theme for the givenclient
scope.FormThemeReference
findDefaultFormThemeByProject(UserContext userContext, Projekt project)
FormThemeReference
findDefaultFormThemeByProject(UserContext userContext, Long projectId)
ETagResource<ByteArrayFile>
handleFormThemeFileRequest(UserContext uc, Long clientId, FormThemeFileReference fileReference, ETagRequest eTagRequest)
Loads the content of the given form the file.ETagResource<ByteArrayFile>
handleFormThemeFileRequest(UserContext uc, UUID clientUuid, FormThemeFileReference fileReference, ETagRequest eTagRequest)
Loads the content of the given form the file.FormThemeData
loadFormThemeDataHierarchically(UserContext uc, Mandant client, FormThemeReference formThemeReference, String context, Set<String> extensions, boolean useDefaultIfUnresolvable)
Combines multiple methods to load all data of a form theme at once.byte[]
loadFormThemeFile(UserContext uc, Mandant client, FormThemeFileReference fileReference)
Loads the content of the given form the file.byte[]
loadFormThemeFile(UserContext uc, Long clientId, FormThemeFileReference fileReference)
Loads the content of the given form the file.byte[]
loadFormThemeFile(UserContext uc, UUID clientUuid, FormThemeFileReference fileReference)
Loads the content of the given form the file.Set<String>
resolveFormThemeCssClassesHierarchically(UserContext uc, Mandant client, FormThemeReference formThemeReference, boolean useDefaultIfUnresolvable)
Gets all CSS classes from the given form theme and all its parent themes.Map<String,List<FormThemeFileReference>>
resolveFormThemeFilesHierarchically(UserContext uc, Mandant client, FormThemeReference formThemeReference, String context, Set<String> extensions, boolean useDefaultIfUnresolvable)
Gets all files from the given form theme, including files from parent form themes (if any).-
Methods inherited from class de.xima.fc.handler.AMSApiHandler
getName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.xima.fc.com.interfaces.IAPIHandler
getName
-
-
-
-
Method Detail
-
findDefaultFormThemeByClient
public FormThemeReference findDefaultFormThemeByClient(UserContext userContext, Mandant client)
Description copied from interface:IFormThemeHandler
Gets the default form theme for the givenclient
scope. When no client is given, returns the system's default form theme.- Specified by:
findDefaultFormThemeByClient
in interfaceIFormThemeHandler
- Parameters:
userContext
- User context of the user who wants to load the file.client
- The client scope for which to get the default form theme. May be null to get the system default form theme.- Returns:
- The default form theme for the given client scope, never null.
-
findDefaultFormThemeByProject
public FormThemeReference findDefaultFormThemeByProject(UserContext userContext, Projekt project)
Description copied from interface:IFormThemeHandler
Gets the default form theme for theclient
scope from the givenproject
. When no project is given, returns the system's default form theme.- Specified by:
findDefaultFormThemeByProject
in interfaceIFormThemeHandler
- Parameters:
userContext
- User context of the user who wants to load the file.project
- A project owned by the client scope for which to get the default form theme. May be null to get the system default form theme.- Returns:
- The default form theme for the given client scope, never null.
-
findDefaultFormThemeByProject
public FormThemeReference findDefaultFormThemeByProject(UserContext userContext, Long projectId)
Description copied from interface:IFormThemeHandler
Gets the default form theme for theclient
scope from the givenproject
. When no project is given, returns the system's default form theme.- Specified by:
findDefaultFormThemeByProject
in interfaceIFormThemeHandler
- Parameters:
userContext
- User context of the user who wants to load the file.projectId
- ID of a project owned by the client scope for which to get the default form theme. May be null to get the system default form theme.- Returns:
- The default form theme for the given client scope, never null.
-
handleFormThemeFileRequest
public ETagResource<ByteArrayFile> handleFormThemeFileRequest(UserContext uc, Long clientId, FormThemeFileReference fileReference, ETagRequest eTagRequest) throws IOException
Description copied from interface:IFormThemeHandler
Loads the content of the given form the file.- Specified by:
handleFormThemeFileRequest
in interfaceIFormThemeHandler
- Parameters:
uc
- User context of the user who wants to load the file.clientId
- ID of the client to load the file for, usually the client who owns the form. May be null if the form theme is not client-specific (e.g. when provided by a system plugin).fileReference
- Reference to the file to load.eTagRequest
- The ETag request to check if the file has changed.- Returns:
- The content of the file, if modified.
- Throws:
FileNotFoundException
- If the file does not exist.IOException
- If the file could not be loaded.
-
handleFormThemeFileRequest
public ETagResource<ByteArrayFile> handleFormThemeFileRequest(UserContext uc, UUID clientUuid, FormThemeFileReference fileReference, ETagRequest eTagRequest) throws IOException
Description copied from interface:IFormThemeHandler
Loads the content of the given form the file.- Specified by:
handleFormThemeFileRequest
in interfaceIFormThemeHandler
- Parameters:
uc
- User context of the user who wants to load the file.clientUuid
- UUID of the client to load the file for, usually the client who owns the form. May be null if the form theme is not client-specific (e.g. when provided by a system plugin).fileReference
- Reference to the file to load.eTagRequest
- The ETag request to check if the file has changed.- Returns:
- The content of the file, if modified.
- Throws:
FileNotFoundException
- If the file does not exist.IOException
- If the file could not be loaded.
-
loadFormThemeDataHierarchically
public FormThemeData loadFormThemeDataHierarchically(UserContext uc, Mandant client, FormThemeReference formThemeReference, String context, Set<String> extensions, boolean useDefaultIfUnresolvable)
Description copied from interface:IFormThemeHandler
Combines multiple methods to load all data of a form theme at once. Reads the CSS classes of the form theme and all files matching the given filter.- Specified by:
loadFormThemeDataHierarchically
in interfaceIFormThemeHandler
- Parameters:
uc
- User context of the user who wants to load the file.client
- The client to load the file for, usually the client who owns the form. May be null if the form theme is not client-specific (e.g. when provided by a system plugin).formThemeReference
- The form theme to get the files for.context
- The resource context to get the files for. SeeEFormThemeResourceContext
for well-known contexts.extensions
- The file extensions to get the files for. If empty, all files are returned.useDefaultIfUnresolvable
- If true and the given theme cannot be resolved (e.g. when the referenced theme does not exist anymore), uses the default theme instead.- Returns:
- The form theme data with the CSS classes and all files matching the given filter.
- See Also:
IFormThemeHandler.resolveFormThemeFilesHierarchically(UserContext, Mandant, FormThemeReference, String, Set, boolean)
,IFormThemeHandler.resolveFormThemeCssClassesHierarchically(UserContext, Mandant, FormThemeReference, boolean)
-
loadFormThemeFile
public byte[] loadFormThemeFile(UserContext uc, UUID clientUuid, FormThemeFileReference fileReference) throws IOException
Description copied from interface:IFormThemeHandler
Loads the content of the given form the file.- Specified by:
loadFormThemeFile
in interfaceIFormThemeHandler
- Parameters:
uc
- User context of the user who wants to load the file.clientUuid
- UUID of the client to load the file for, usually the client who owns the form. May be null if the form theme is not client-specific (e.g. when provided by a system plugin).fileReference
- Reference to the file to load.- Returns:
- The content of the file.
- Throws:
FileNotFoundException
- If the file does not exist.IOException
- If the file could not be loaded.
-
loadFormThemeFile
public byte[] loadFormThemeFile(UserContext uc, Long clientId, FormThemeFileReference fileReference) throws IOException
Description copied from interface:IFormThemeHandler
Loads the content of the given form the file.- Specified by:
loadFormThemeFile
in interfaceIFormThemeHandler
- Parameters:
uc
- User context of the user who wants to load the file.clientId
- ID of the client to load the file for, usually the client who owns the form. May be null if the form theme is not client-specific (e.g. when provided by a system plugin).fileReference
- Reference to the file to load.- Returns:
- The content of the file.
- Throws:
FileNotFoundException
- If the file does not exist.IOException
- If the file could not be loaded.
-
loadFormThemeFile
public byte[] loadFormThemeFile(UserContext uc, Mandant client, FormThemeFileReference fileReference) throws IOException
Description copied from interface:IFormThemeHandler
Loads the content of the given form the file.- Specified by:
loadFormThemeFile
in interfaceIFormThemeHandler
- Parameters:
uc
- User context of the user who wants to load the file.client
- The client to load the file for, usually the client who owns the form. May be null if the form theme is not client-specific (e.g. when provided by a system plugin).fileReference
- Reference to the file to load.- Returns:
- The content of the file.
- Throws:
FileNotFoundException
- If the file does not exist.IOException
- If the file could not be loaded.
-
resolveFormThemeCssClassesHierarchically
public Set<String> resolveFormThemeCssClassesHierarchically(UserContext uc, Mandant client, FormThemeReference formThemeReference, boolean useDefaultIfUnresolvable)
Description copied from interface:IFormThemeHandler
Gets all CSS classes from the given form theme and all its parent themes. CSS classes are returned in no particular order.- Specified by:
resolveFormThemeCssClassesHierarchically
in interfaceIFormThemeHandler
- Parameters:
uc
- User context of the user who wants to load the file.client
- The client to load the file for, usually the client who owns the form. May be null if the form theme is not client-specific (e.g. when provided by a system plugin).formThemeReference
- The form theme to get the files for.useDefaultIfUnresolvable
- If true and the given theme cannot be resolved (e.g. when the referenced theme does not exist anymore), uses the default theme instead.- Returns:
- A set of CSS classes that are defined in the form theme and all its parent themes.
-
resolveFormThemeFilesHierarchically
public Map<String,List<FormThemeFileReference>> resolveFormThemeFilesHierarchically(UserContext uc, Mandant client, FormThemeReference formThemeReference, String context, Set<String> extensions, boolean useDefaultIfUnresolvable)
Description copied from interface:IFormThemeHandler
Gets all files from the given form theme, including files from parent form themes (if any). Files are returned in order of their file name.- Specified by:
resolveFormThemeFilesHierarchically
in interfaceIFormThemeHandler
- Parameters:
uc
- User context of the user who wants to load the file.client
- The client to load the file for, usually the client who owns the form. May be null if the form theme is not client-specific (e.g. when provided by a system plugin).formThemeReference
- The form theme to get the files for.context
- The resource context to get the files for. SeeEFormThemeResourceContext
for well-known contexts.extensions
- The file extensions to get the files for. If empty, all files are returned.useDefaultIfUnresolvable
- If true and the given theme cannot be resolved (e.g. when the referenced theme does not exist anymore), uses the default theme instead.- Returns:
- A map of form resource types to a set of form theme file references.
-
-