Class WorkflowSessionHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.workflow.support.WorkflowSessionHelper
- All Implemented Interfaces:
LogEnabled,Component,Contextualizable,Serviceable
public class WorkflowSessionHelper
extends AbstractLogEnabled
implements Component, Serviceable, Contextualizable
Helper for workflow in session
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContextThe contextprotected I18nHelperThe helper for i18n translations and catalogsprotected I18nUtilsI18n Utilsprotected SourceResolverThe source resolverprotected WorkflowHelperThe workflow helperprotected WorkflowLanguageManagerThe workflow language managerstatic final StringThe Avalon role -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcloneImages(String workflowName) Clone kernel workflow images into WEB-INF/workflow_resources with new labels as namesvoidcontextualize(Context context) voiddeleteSession(String workflowName) Remove workflow from sessioncom.opensymphony.workflow.loader.WorkflowDescriptorDuplicate a workflowgetOldLabelKeyIfCloned(String workflowName, I18nizableText label) Get the original label key used for this element if the workflow is a clonegetTranslation(String workflowName, I18nizableText i18nKey) Get the translation for this key, null if it doesn't existgetTranslations(String workflowName) Get translations map for current workflowcom.opensymphony.workflow.loader.WorkflowDescriptorgetWorkflowDescriptor(String workflowName, boolean initSessionIfNull) Get workflow descriptor from session if exist, from xml if notgetWorkflowLabel(String workflowName) Get the label for current workflowgetWorkflowLabelTranslations(String workflowName) Get the translations for current workflow namesGet the list of workflow names in usebooleanhasChanges(String workflowName) True if the workflow has non saved changesvoidinitWorkflowDescriptor(com.opensymphony.workflow.loader.WorkflowDescriptor workflow) Init session cache with workflow descriptor changesvoidremoveTranslation(String workflowName, I18nizableText key) Remove an entry from the translations mapvoidservice(ServiceManager smanager) voidupdateTranslations(String workflowName, I18nizableText labelKey, Map<String, String> translations) Update the translations mapvoidupdateWorkflowDescriptor(com.opensymphony.workflow.loader.WorkflowDescriptor workflow) Update session cache with workflow descriptor changesvoidupdateWorkflowNames(com.opensymphony.workflow.loader.WorkflowDescriptor workflowDescriptor) Update the session workflow names list with current workflow nameMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The Avalon role -
_workflowLanguageManager
The workflow language manager -
_context
The context -
_i18nUtils
I18n Utils -
_workflowHelper
The workflow helper -
_i18nHelper
The helper for i18n translations and catalogs -
_sourceResolver
The source resolver
-
-
Constructor Details
-
WorkflowSessionHelper
public WorkflowSessionHelper()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
contextualize
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
hasChanges
True if the workflow has non saved changes- Parameters:
workflowName- unique name of workflow- Returns:
trueif there is a session for this workflow
-
getWorkflowLabel
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
Get the translation for this key, null if it doesn't exist- Parameters:
workflowName- the worflow's unique idi18nKey- 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 namelabelKey- i18n keytranslations- the map of translations (language, translation) to put in the map
-
removeTranslation
Remove an entry from the translations map- Parameters:
workflowName- the workflow's unique namekey- 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 idinitSessionIfNull-trueto create a new WorkflowToSave if session doesn't have it- Returns:
- the workflow
-
initWorkflowDescriptor
Init session cache with workflow descriptor changes- Parameters:
workflow- the workflow to init
-
updateWorkflowDescriptor
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 duplicatedWorkflowName) Duplicate a workflow- Parameters:
newWorkflowName- the unique name for the duplicatelabels- the duplicate's labelsduplicatedWorkflowName- the duplicated workflow's name- Returns:
- the duplicate
-
deleteSession
Remove workflow from session- Parameters:
workflowName- unique name of the workflow
-
cloneImages
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 namelabel- the current label key of the workflow element- Returns:
- the original label if exist, the same label if not
-