Class FormThemeHandler

    • Constructor Detail

      • FormThemeHandler

        public FormThemeHandler()
    • Method Detail

      • findDefaultFormThemeByClient

        public FormThemeReference findDefaultFormThemeByClient​(UserContext userContext,
                                                               Mandant client)
        Description copied from interface: IFormThemeHandler
        Gets the default form theme for the given client scope. When no client is given, returns the system's default form theme.
        Specified by:
        findDefaultFormThemeByClient in interface IFormThemeHandler
        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 the client scope from the given project. When no project is given, returns the system's default form theme.
        Specified by:
        findDefaultFormThemeByProject in interface IFormThemeHandler
        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 the client scope from the given project. When no project is given, returns the system's default form theme.
        Specified by:
        findDefaultFormThemeByProject in interface IFormThemeHandler
        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 interface IFormThemeHandler
        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 interface IFormThemeHandler
        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.
      • 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 interface IFormThemeHandler
        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 interface IFormThemeHandler
        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 interface IFormThemeHandler
        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 interface IFormThemeHandler
        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 interface IFormThemeHandler
        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. See EFormThemeResourceContext 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.