Class WorkflowSessionHelper

java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.workflow.support.WorkflowSessionHelper
All Implemented Interfaces:
LogEnabled, Component, Contextualizable, Serviceable

Helper for workflow in session
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager smanager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • contextualize

      public void contextualize(Context context) throws ContextException
      Specified by:
      contextualize in interface Contextualizable
      Throws:
      ContextException
    • hasChanges

      public boolean hasChanges(String workflowName)
      True if the workflow has non saved changes
      Parameters:
      workflowName - unique name of workflow
      Returns:
      true if there is a session for this workflow
    • getWorkflowLabel

      public I18nizableText getWorkflowLabel(String workflowName)
      Get the label for current workflow
      Parameters:
      workflowName - the workflow's unique name
      Returns:
      the label as String or i18nizableText
    • getWorkflowLabelTranslations

      Get the translations for current workflow names
      Parameters:
      workflowName - the workflow's unique name
      Returns:
      a map with available transitions, key is language, value is translation
    • getTranslations

      Get translations map for current workflow
      Parameters:
      workflowName - the current workflow's id
      Returns:
      the map of traslations, key is i18n key, value is map of language, translation
    • getTranslation

      public Map<String,String> getTranslation(String workflowName, I18nizableText i18nKey)
      Get the translation for this key, null if it doesn't exist
      Parameters:
      workflowName - the worflow's unique id
      i18nKey - the key to get translation for
      Returns:
      the multilangual translation
    • updateTranslations

      public void updateTranslations(String workflowName, I18nizableText labelKey, Map<String,String> translations)
      Update the translations map
      Parameters:
      workflowName - the workflow's unique name
      labelKey - i18n key
      translations - the map of translations (language, translation) to put in the map
    • removeTranslation

      public void removeTranslation(String workflowName, I18nizableText key)
      Remove an entry from the translations map
      Parameters:
      workflowName - the workflow's unique name
      key - the key of the entry to remove
    • getWorkflowNames

      Get the list of workflow names in use
      Returns:
      a set of the names
    • updateWorkflowNames

      public void updateWorkflowNames(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor)
      Update the session workflow names list with current workflow name
      Parameters:
      workflowDescriptor - the current workflow descriptor
    • getWorkflowDescriptor

      public com.opensymphony.workflow.loader.WorkflowDescriptor getWorkflowDescriptor(String workflowName, boolean initSessionIfNull)
      Get workflow descriptor from session if exist, from xml if not
      Parameters:
      workflowName - the current workflow's id
      initSessionIfNull - true to create a new WorkflowToSave if session doesn't have it
      Returns:
      the workflow
    • updateWorkflowDescriptor

      public void updateWorkflowDescriptor(com.opensymphony.workflow.loader.WorkflowDescriptor workflow)
      Update session cache with workflow descriptor changes
      Parameters:
      workflow - the workflow to update
    • duplicateWorkflow

      public com.opensymphony.workflow.loader.WorkflowDescriptor duplicateWorkflow(String newWorkflowName, Map<String,String> labels, String workflowToCloneName)
      Duplicate a workflow
      Parameters:
      newWorkflowName - the unique name for the duplicate
      labels - the duplicate's labels
      workflowToCloneName - the duplicated workflow's name
      Returns:
      the duplicate
    • deleteSession

      public void deleteSession(String workflowName)
      Remove workflow from session
      Parameters:
      workflowName - unique name of the workflow
    • cloneImages

      public void cloneImages(String workflowName)
      Clone kernel workflow images into WEB-INF/workflow_resources with new labels as names
      Parameters:
      workflowName - the current workflow name
    • getOldLabelKeyIfCloned

      Get the original label key used for this element if the workflow is a clone
      Parameters:
      workflowName - the current workflow name
      label - the current label key of the workflow element
      Returns:
      the original label if exist, the same label if not