Class WorkflowProviderHelper


  • public class WorkflowProviderHelper
    extends Object
    Helper methods for implementing a IWorkflowProvider.
    Since:
    7.0.0
    Author:
    XIMA MEDIA GmbH
    • Constructor Detail

      • WorkflowProviderHelper

        public WorkflowProviderHelper()
    • Method Detail

      • computeAllClientCounters

        public static List<ClientCounter> computeAllClientCounters​(IEntityContext ec,
                                                                   Mandant client)
        Parameters:
        ec - Entity context for accessing the database.
        client - Client to which the project with the workflow belongs.
        Returns:
        All counters available for the given client.
      • computeAllClientResources

        public static List<MandantRessource> computeAllClientResources​(IEntityContext ec,
                                                                       Mandant client)
        Parameters:
        ec - Entity context for accessing the database.
        client - Client to which the project with the workflow belongs.
        Returns:
        All client files available for the given client.
      • computeAllDatabaseConnections

        public static List<DatenbankZugriff> computeAllDatabaseConnections​(IEntityContext ec,
                                                                           Mandant client)
        Parameters:
        ec - Entity context for accessing the database.
        client - Client to which the project with the workflow belongs.
        Returns:
        All database connections available for the given client.
      • computeAllWebDavConnections

        public static List<WebDavAccess> computeAllWebDavConnections​(IEntityContext ec,
                                                                     Mandant client)
        Parameters:
        ec - Entity context for accessing the database.
        client - Client to which the project with the workflow belongs.
        Returns:
        All WebDav connections available for the given client.
      • computeAllDatabaseQueries

        public static List<Datenquelle> computeAllDatabaseQueries​(IEntityContext ec,
                                                                  Mandant client)
        Parameters:
        ec - Entity context for accessing the database.
        client - Client to which the project with the workflow belongs.
        Returns:
        All database queries available for the given client.
      • computeAllFormElements

        public static List<String> computeAllFormElements​(IEntityContext ec,
                                                          Mandant client,
                                                          Projekt project,
                                                          FormPersist persistOverride)
        Parameters:
        ec - Entity context for accessing the database.
        client - Client to which the project with the workflow belongs.
        project - A project with a form for which to find its containing form elements.
        persistOverride - Optional form persist to use. When not given, the form is read from the given project.
        Returns:
        A list with the names of all form elements from the form of the given project.
      • computeAllInboxes

        public static List<Postfach> computeAllInboxes​(IEntityContext ec,
                                                       Mandant client)
        Parameters:
        ec - Entity context for accessing the database.
        client - Client to which the project with the workflow belongs.
        Returns:
        All inboxes available for the given client.
      • computeAllLdapConnections

        public static List<LDAPZugriff> computeAllLdapConnections​(IEntityContext ec,
                                                                  Mandant client)
        Parameters:
        ec - Entity context for accessing the database.
        client - Client to which the project with the workflow belongs.
        Returns:
        All LDAP connections available for the given client.
      • computeAllLdapQueries

        public static List<LDAPAbfrage> computeAllLdapQueries​(IEntityContext ec,
                                                              Mandant client)
        Parameters:
        ec - Entity context for accessing the database.
        client - Client to which the project with the workflow belongs.
        Returns:
        All LDAP queries available for the given client.
      • computeAllNodesOfType

        public static List<INodeWithName> computeAllNodesOfType​(IWorkflowValidationEnvironmentData envData,
                                                                WorkflowElementIndex elementIndex,
                                                                String type)
        Parameters:
        envData - Environment data with the current client, project, etc.
        elementIndex - Element index with all nodes and triggers.
        type - Type of the nodes to find. Either from the list of builtin node types, or from a node plugin.
        Returns:
        A list of all nodes of the given type, together with their names.
      • computeAllProjectResources

        public static List<ProjektRessource> computeAllProjectResources​(IEntityContext ec,
                                                                        Projekt project)
        Parameters:
        ec - Entity context for accessing the database.
        project - A project for which to find its files.
        Returns:
        All form files available for the given client.
      • computeAllQualifiedSubmitButtons

        public static List<IWorkflowQualifiedSubmitButton> computeAllQualifiedSubmitButtons​(IEntityContext ec,
                                                                                            Mandant client,
                                                                                            Projekt project,
                                                                                            Locale locale,
                                                                                            FormPersist persistOverride)
        Finds all qualified form submit button from the form of the given project.
        Parameters:
        ec - Entity context for accessing the database.
        client - Client to which the project with the workflow belongs.
        project - A project with a form for which to find its submit buttons.
        locale - Locale for generating the display names of each button.
        persistOverride - Optional form persist to use. When not given, the form is read from the given project.
        Returns:
        A list of all qualified submit button of the given form.
      • computeAllStateModels

        public static List<WorkflowStateModel> computeAllStateModels​(IEntityContext ec,
                                                                     WorkflowVersion workflowVersion,
                                                                     Locale locale)
        Parameters:
        ec - Entity context for accessing the database.
        workflowVersion - Workflow version to process.
        locale - Locale for the display name of each state.
        Returns:
        All workflow states available for the workflow version.
      • computeAllSubmitButtons

        public static List<IWorkflowSubmitButton> computeAllSubmitButtons​(IEntityContext ec,
                                                                          Mandant client,
                                                                          Projekt project,
                                                                          Locale locale,
                                                                          FormPersist persistOverride)
        Finds all form submit button from the form of the given project.
        Parameters:
        ec - Entity context for accessing the database.
        client - Client to which the project with the workflow belongs.
        project - A project with a form for which to find its submit buttons.
        locale - Locale for generating the display names of each button.
        persistOverride - Optional form persist to use. When not given, the form is read from the given project.
        Returns:
        A list of all submit button of the given form.
      • computeAllTasks

        public static List<ITaskWithName> computeAllTasks​(IWorkflowValidationEnvironmentData envData,
                                                          WorkflowElementIndex elementIndex,
                                                          UUID taskToExclude)
        Parameters:
        envData - Environment data with the current client, project, etc.
        elementIndex - Element index with all nodes and triggers.
        taskToExclude - An optional UUID of a WorkflowTask to exclude from the returned result.
        Returns:
        A list of all tasks, together with their names, but without the given task to exclude.
      • computeAllTriggersOfType

        public static List<ITriggerWithName> computeAllTriggersOfType​(IWorkflowValidationEnvironmentData envData,
                                                                      WorkflowElementIndex elementIndex,
                                                                      String type,
                                                                      UUID taskToExclude)
        Parameters:
        envData - Environment data with the current client, project, etc.
        elementIndex - Element index with all nodes and triggers.
        type - Type of the triggers to find. Either from the list of builtin trigger types, or from a trigger plugin.
        taskToExclude - An optional UUID of a task from which to exclude its triggers in the returned result.
        Returns:
        A list of all triggers of the given type, together with their names, but excluding triggers which belong to the given task.
      • computeAllUploadElements

        public static List<String> computeAllUploadElements​(IEntityContext ec,
                                                            Projekt project)
        Parameters:
        ec - Entity context for accessing the database.
        project - A project for which to find all form upload elements.
        Returns:
        A list with the name of each upload element from the form of the project.
      • computeAllUserGroups

        public static List<BenutzerGruppe> computeAllUserGroups​(IEntityContext ec,
                                                                Mandant client)
        Parameters:
        ec - Entity context for accessing the database.
        client - Client to which the project with the workflow belongs.
        Returns:
        All user groups available for the given client.
      • computeAllDirectClientAuthorizations

        public static List<DirectClientAuthorization> computeAllDirectClientAuthorizations​(IEntityContext ec,
                                                                                           Mandant client)
        Parameters:
        ec - Entity context for accessing the database.
        client - Client to which the project with the workflow belongs.
        Returns:
        All direct client authorizations available for the given client.
      • computeAvailableResources

        public static List<? extends de.xima.cmn.validation.spec.IChoiceEntry<ResourceItem>> computeAvailableResources​(List<ProjektRessource> projectResources,
                                                                                                                       List<MandantRessource> clientResources,
                                                                                                                       List<String> uploadElements,
                                                                                                                       List<INodeWithName> providingActions,
                                                                                                                       boolean includeForm,
                                                                                                                       boolean includeClient,
                                                                                                                       boolean includeExternal,
                                                                                                                       boolean includeAttachmentSearch,
                                                                                                                       boolean includeUpload,
                                                                                                                       boolean includeProvidingAction,
                                                                                                                       String[] extensions,
                                                                                                                       Locale locale)
        Parameters:
        projectResources - a list of form resources
        clientResources - a list of client resources
        uploadElements - a list of upload element names
        providingActions - a list of previous file-providing actions
        includeForm - if true, the form resources selection is added to the result list
        includeClient - if true, the client resources selection is added to the result list
        includeExternal - if true, a selection for an URL resource is added to the result list
        includeAttachmentSearch - if true, a selection for an attachment filename search is added to the result list
        includeUpload - if true, the file upload elements are added to the result list
        includeProvidingAction - if true, the providing file elements from previous action are added to the result list
        extensions - an array of allowed file extensions
        locale - the current locale
        Returns:
        a list of computed SelectItems
      • computeDeadNodes

        public static Set<NodeKey> computeDeadNodes​(WorkflowFlowAnalysis analysis,
                                                    ProcessModel processModel)
        Computes the set of all nodes in a program represented by the abstract syntax tree of WorkflowNodes. A dead node is a node which is not contained in any possible execution path starting at the root node.
        Parameters:
        analysis - Workflow analysis for the workflow process.
        processModel - Process model with a list of tasks to check for dead nodes.
        Returns:
        A set of dead nodes that can never be reached when the workflow is executed.
      • computeFlowAnalysis

        public static <TElement extends IWorkflowNodeTypeProviding & IActiveFlagProvidingWorkflowFlowAnalysis computeFlowAnalysis​(List<IElementWithTask<TElement>> rootNodes,
                                                                                                                                    ITreeAccessor<TElement,​UUID> accessor,
                                                                                                                                    Mandant client)
        Computes the flow analysis for the program represented by the given root nodes.
        Type Parameters:
        TElement - Sub type of the tasks to analyze.
        Parameters:
        rootNodes - List of tasks for which to compute the analysis.
        accessor - Adapter for the tree structure represented by the workflow nodes, starting at he root not.
        client - Client to which the project with the workflow belongs.
        Returns:
        The flow analysis for he given tasks.
      • computeInstalledCharsets

        public static List<Charset> computeInstalledCharsets()
        Returns:
        A list of all charsets available on the system.
      • computeInstalledFontNames

        public static List<String> computeInstalledFontNames()
        Returns:
        A list of all fonts installed on the system.
      • computeNonOrderableAuthenticatorConfigs

        public static List<BaseConfigViewModel> computeNonOrderableAuthenticatorConfigs​(IEntityContext ec,
                                                                                        Mandant client,
                                                                                        Locale locale,
                                                                                        boolean kerberosActive,
                                                                                        boolean ntlmActive)
        Parameters:
        ec - Current entity context for accessing the database.
        client - Client for which to compute the authenticators.
        locale - Locale for the authenticator names.
        kerberosActive - Whether Kerberos is available. Affects whether Kerberos-based authenticators are added.
        ntlmActive - Whether NTLM is available. Affects whether NTLM-based authenticators are added.
        Returns:
        All non-orderable authenticators available to the given client.
      • computeOrderableAuthenticatorConfigs

        public static List<BaseConfigViewModel> computeOrderableAuthenticatorConfigs​(IEntityContext ec,
                                                                                     Mandant client,
                                                                                     Locale locale,
                                                                                     boolean kerberosActive,
                                                                                     boolean ntlmActive)
        Parameters:
        ec - Current entity context for accessing the database.
        client - Client for which to compute the authenticators.
        locale - Locale for the authenticator names.
        kerberosActive - Whether Kerberos is available. Affects whether Kerberos-based authenticators are added.
        ntlmActive - Whether NTLM is available. Affects whether NTLM-based authenticators are added.
        Returns:
        All orderable authenticators available to the given client.
      • computeProvidingNodes

        public static List<INodeWithName> computeProvidingNodes​(Mandant client,
                                                                Iterable<IWorkflowElementWithDeserializedModel<?,​WorkflowNode>> wrappers)
        Computes a list of nodes which provide files, e.g. which create and make available files when executed.
        Parameters:
        client - Client to which the project with the workflow belongs.
        wrappers - A list of all workflow nodes together with the deserialized properties model of each node.
        Returns:
        A list of all nodes from the given node map which can provide files.
      • computeProvidingNodes

        public static List<INodeWithName> computeProvidingNodes​(Mandant client,
                                                                Map<NodeKey,​NodeModel> nodeMap,
                                                                Function<Map.Entry<NodeKey,​NodeModel>,​?> getData)
        Computes a list of nodes which provide files, e.g. which create and make available files when executed.
        Parameters:
        client - Client to which the project with the workflow belongs.
        nodeMap - Map between the key of each WorkflowNode and the model for that node.
        getData - Function for obtaining the deserialized properties mode of a given node
        Returns:
        A list of all nodes from the given node map which can provide files.
      • computeProvidingPredecessors

        public static List<NodeKey> computeProvidingPredecessors​(Mandant client,
                                                                 IWorkflowFlowAnalysis analysis,
                                                                 NodeKey target,
                                                                 Map<NodeKey,​NodeModel> index,
                                                                 FlowGraphFilter.Backward filter)
        Finds all previous nodes that can provide files for the given target node.
        Parameters:
        client - Current client.
        analysis - Execution analysis that was performed on the model
        target - Node for which to find previous file providing nodes.
        index - Map between a node key and the corresponding node.
        filter - Filter for flow graph when checking for predecessors, see FlowGraphFilters for some common filters.
        Returns:
        All previous nodes that can provide files for the given target node.
      • computeStandardSupportedCharsets

        public static List<Charset> computeStandardSupportedCharsets()
        Returns:
        A list of Charset that are supported by most systems and can safely be used as select options.
      • computeTextTemplatesByCategory

        public static List<Textbaustein> computeTextTemplatesByCategory​(IEntityContext ec,
                                                                        Mandant client,
                                                                        ETextbausteinKategorie cat)
        Parameters:
        ec - Entity context for accessing the database.
        client - Client to which the project with the workflow belongs.
        cat - Text template category to which to limit the returned templates. Must not be null.
        Returns:
        All text templates of the given type that available for the given client.
      • computeTriggerName

        public static ITriggerWithName computeTriggerName​(UUID taskUuid,
                                                          TriggerModel trigger,
                                                          Map<ElementKey,​com.alibaba.fastjson.JSONObject> paramsMap,
                                                          Mandant client)
        Parameters:
        taskUuid - UUID of a WorkflowTask.
        trigger - The trigger set for the task.
        paramsMap - Custom parameters of the trigger.
        client - Client to which the project with the workflow belongs.
        Returns:
        The name of the given trigger. A ITriggerHandler may customize how to obtain the name.
      • computeTriggerNames

        public static List<ITriggerWithName> computeTriggerNames​(Mandant client,
                                                                 FlowchartElementIndex elementIndex,
                                                                 Map<ElementKey,​com.alibaba.fastjson.JSONObject> paramsMap,
                                                                 Iterable<TriggerKey> triggerKeys)
        Parameters:
        client - Client to which the project with the workflow belongs.
        elementIndex - Element index with all nodes and triggers.
        paramsMap - Map between the key of each WorkflowTrigger mapped to the Custom parameters of that trigger.
        triggerKeys - A list of triggers for which to compute the names.
        Returns:
        The name for each trigger from the given trigger keys. A ITriggerHandler may customize how to obtain the name.
      • createEntityRefsWithNameSelectItems

        public static <T extends IUUIDEntity & INameProviding & IDescriptionProvidingList<? extends de.xima.cmn.validation.spec.IChoiceEntry<EntityRef>> createEntityRefsWithNameSelectItems​(List<T> entities,
                                                                                                                                                                                               String labelEntities,
                                                                                                                                                                                               String labelOthers,
                                                                                                                                                                                               String labelName)
        Creates a list of choice entries with an EntityRef for each entity, and an additional entry for a EntityRef.forNameValue(String). The entities are placed in one IChoiceGroup, and the name entry in a separate choice group.
        Type Parameters:
        T - Type of the entities.
        Parameters:
        entities - Entities to process.
        labelEntities - Localized name for the choice group with the entities.
        labelOthers - Localized name for the choice group with the name entry.
        labelName - Localized name of the name entry.
        Returns:
        A list of choice entries with an EntityRef for each entity, and an additional entry for a EntityRef.forNameValue(String).
      • createNodeSelectItems

        public static List<? extends de.xima.cmn.validation.spec.IChoiceEntry<NodeKey>> createNodeSelectItems​(List<INodeWithName> nodes)
        Creates select items for the UI from the given list of workflow node. The label is the INamedElement.getName(), the value is INodeWithName.getElement().
        Parameters:
        nodes - Nodes to convert into select items.
        Returns:
        The list of nodes, converted to select items for the UI.
      • createQualifiedSubmitButtonSelectItems

        public static List<? extends de.xima.cmn.validation.spec.IChoiceEntry<QualifiedSubmitButton>> createQualifiedSubmitButtonSelectItems​(List<IWorkflowQualifiedSubmitButton> submitButtons,
                                                                                                                                             Locale locale)
        Creates select items for the UI from the given list of form submit buttons. The label is computed from the element name, the technical name and the display name of the submit button. The value is a QualifiedSubmitButton.
        Parameters:
        submitButtons - List of submit buttons to convert.
        locale - Locale to use for creating the label of each select option.
        Returns:
        The list of submit buttons, converted to select items for the UI.
      • createSelectItemsWithoutDescription

        public static <T extends IUUIDEntity & INameProvidingList<? extends de.xima.cmn.validation.spec.IChoiceEntry<UuidEntityRef>> createSelectItemsWithoutDescription​(List<T> entities)
        Creates select items for the UI from the given list of entities. The label is INameProviding.getName(), the value is a UuidEntityRef for the entity. The description of the select items is left empty.
        Type Parameters:
        T - Type of the entities.
        Parameters:
        entities - List of entities of convert to select items.
        Returns:
        The list of entities, converted to select items for the UI.
      • createStateSelectItems

        public static List<? extends de.xima.cmn.validation.spec.IChoiceEntry<UuidEntityRef>> createStateSelectItems​(List<WorkflowStateModel> states)
        Creates select items for the UI from the given list of workflow states. The label is WorkflowState.getName(), the value is a UuidEntityRef for the state.
        Parameters:
        states - List of entities of convert to select items.
        Returns:
        The list of states, converted to select items for the UI.
      • createSubmitButtonSelectItems

        public static List<? extends de.xima.cmn.validation.spec.IChoiceEntry<String>> createSubmitButtonSelectItems​(List<IWorkflowSubmitButton> submitButtons,
                                                                                                                     Locale locale)
        Creates select items for the UI from the given list of form submit buttons. The label is computed from the display name of the submit button. The value is a IWorkflowSubmitButton.
        Parameters:
        submitButtons - List of submit buttons to convert.
        locale - Locale to use for creating the label of each select option.
        Returns:
        The list of submit buttons, converted to select items for the UI.
      • createTaskSelectItems

        public static List<? extends de.xima.cmn.validation.spec.IChoiceEntry<UUID>> createTaskSelectItems​(List<ITaskWithName> tasks)
        Creates select items for the UI from the given list of WorkflowTasks. The label is INamedElement.getName(), the value is ITaskWithName.getElement().
        Parameters:
        tasks - List of tasks to convert to select items.
        Returns:
        The list of tasks, converted to select items for the UI.
      • createUploadElementSelectItems

        public static List<? extends de.xima.cmn.validation.spec.IChoiceEntry<String>> createUploadElementSelectItems​(List<String> uploadElements)
        Creates select items for the UI from the given list of form upload elements.
        Parameters:
        uploadElements - List of form upload element names.
        Returns:
        The list of upload elements, converted to select items for the UI.