Package de.xima.fc.api.entity
Class FormThemeAPI
- java.lang.Object
-
- de.xima.fc.api.ASubAPI
-
- de.xima.fc.api.entity.FormThemeAPI
-
public class FormThemeAPI extends ASubAPI
API class for common operations onform themes.- Since:
- 8.3.0
- Author:
- XIMA MEDIA GmbH
-
-
Constructor Summary
Constructors Constructor Description FormThemeAPI()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FormThemeReferencefindDefaultFormThemeByClient(UserContext userContext, Mandant client)Gets the default form theme for the givenclientscope.FormThemeReferencefindDefaultFormThemeByProject(UserContext userContext, Projekt project)FormThemeReferencefindDefaultFormThemeByProject(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.FormThemeDataloadFormThemeDataHierarchically(UserContext uc, Mandant client, FormThemeReference formThemeReference, String resourceContext, 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 resourceContext, 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.api.ASubAPI
getHandlerProvider
-
-
-
-
Method Detail
-
findDefaultFormThemeByClient
public FormThemeReference findDefaultFormThemeByClient(UserContext userContext, Mandant client)
Gets the default form theme for the givenclientscope. When no client is given, returns the system's default form theme.- 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)
Gets the default form theme for theclientscope from the givenproject. When no project is given, returns the system's default form theme.- 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)
Gets the default form theme for theclientscope from the givenproject. When no project is given, returns the system's default form theme.- 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
Loads the content of the given form the file.- 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
Loads the content of the given form the file.- 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 resourceContext, Set<String> extensions, boolean useDefaultIfUnresolvable)
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.- 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.resourceContext- The resource context to get the files for. SeeEFormThemeResourceContextfor 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:
resolveFormThemeFilesHierarchically(UserContext, Mandant, FormThemeReference, String, Set, boolean),resolveFormThemeCssClassesHierarchically(UserContext, Mandant, FormThemeReference, boolean)
-
loadFormThemeFile
public byte[] loadFormThemeFile(UserContext uc, UUID clientUuid, FormThemeFileReference fileReference) throws IOException
Loads the content of the given form the file.- 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
Loads the content of the given form the file.- 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
Loads the content of the given form the file.- 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)
Gets all CSS classes from the given form theme and all its parent themes. CSS classes are returned in no particular order.- 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 resourceContext, Set<String> extensions, boolean useDefaultIfUnresolvable)
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.- 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.resourceContext- The resource context to get the files for. SeeEFormThemeResourceContextfor 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.
-
-