com.atlassian.jira.workflow
Class WorkflowUtil

java.lang.Object
  extended by com.atlassian.jira.workflow.WorkflowUtil

public class WorkflowUtil
extends java.lang.Object


Constructor Summary
WorkflowUtil()
           
 
Method Summary
static void addToExistingTransientArgs(java.util.Map transientArgs, java.lang.String key, java.util.List list)
          This method adds to an existing list stored in the transient args map.
static void checkInvalidCharacters(java.lang.String fieldValue, java.lang.String fieldName, ErrorCollection errorCollection)
          JRA-4429 (prevent invalid characters)
static java.lang.String cloneWorkflowName(java.lang.String currentName)
           
static java.lang.String convertDescriptorToXML(com.opensymphony.workflow.loader.WorkflowDescriptor descriptor)
          Converts a WorkflowDescriptor to XML.
static com.opensymphony.workflow.loader.WorkflowDescriptor convertXMLtoWorkflowDescriptor(java.lang.String workflowDescriptorXML)
          Converts a string representation of a workflow XML into the WorkflowDescriptor object representation.
static java.lang.String getGlobalMetaAttributeForIssue(org.ofbiz.core.entity.GenericValue issue, java.lang.String metaKey)
          Return a meta attribute applying to a whole workflow (ie.
static java.lang.String getMetaAttributeForIssue(org.ofbiz.core.entity.GenericValue issue, java.lang.String metaKey)
          Return a workflow meta attribute for the current state of an issue.
static java.util.Map getMetaAttributesForIssue(org.ofbiz.core.entity.GenericValue issue)
          Get all meta attributes for an issue's current state.
static java.util.List getMetaAttributesForIssue(org.ofbiz.core.entity.GenericValue issue, java.lang.String metaKeyPrefix)
          Return all meta attribute values whose key starts with a certain prefix.
static int getNextId(java.util.List descriptors)
          Get the next usable ID value for a given list of descriptors.
static int getNextId(java.util.List descriptors, int start)
          Get the next usable ID value for a given list of descriptors and a start point.
static java.lang.String getWorkflowDisplayName(JiraWorkflow workflow)
          Appends "(Draft)" to the end of the workflow name for an draft workflow.
static java.lang.String getWorkflowTransitionDescription(com.opensymphony.workflow.loader.ActionDescriptor descriptor)
          Get the translated description of the workflow transition.
static java.lang.String getWorkflowTransitionDisplayName(com.opensymphony.workflow.loader.ActionDescriptor descriptor)
          Get the translated display name of a workflow transition.
static java.lang.String interpolateProjectKey(org.ofbiz.core.entity.GenericValue project, java.lang.String groupName)
          Variable interpolation.
static boolean isAcceptableName(java.lang.String workflowName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkflowUtil

public WorkflowUtil()
Method Detail

addToExistingTransientArgs

public static void addToExistingTransientArgs(java.util.Map transientArgs,
                                              java.lang.String key,
                                              java.util.List list)
This method adds to an existing list stored in the transient args map.

If the existing list does not exist, the new list is just added - otherwise the new list is added to the old list, and the result readded to the transientArgs map.


getNextId

public static int getNextId(java.util.List descriptors)
Get the next usable ID value for a given list of descriptors.


getNextId

public static int getNextId(java.util.List descriptors,
                            int start)
Get the next usable ID value for a given list of descriptors and a start point.


interpolateProjectKey

public static java.lang.String interpolateProjectKey(org.ofbiz.core.entity.GenericValue project,
                                                     java.lang.String groupName)
Variable interpolation. Eg. given a project TestProject and groupName '${pkey}-users', will return 'TP-users', or null if groupName is null


getGlobalMetaAttributeForIssue

public static java.lang.String getGlobalMetaAttributeForIssue(org.ofbiz.core.entity.GenericValue issue,
                                                              java.lang.String metaKey)
Return a meta attribute applying to a whole workflow (ie. right under the start tag).


getMetaAttributeForIssue

public static java.lang.String getMetaAttributeForIssue(org.ofbiz.core.entity.GenericValue issue,
                                                        java.lang.String metaKey)
Return a workflow meta attribute for the current state of an issue.


getMetaAttributesForIssue

public static java.util.List getMetaAttributesForIssue(org.ofbiz.core.entity.GenericValue issue,
                                                       java.lang.String metaKeyPrefix)
Return all meta attribute values whose key starts with a certain prefix. For example, given: 3 jira-qa jira-administrators

Prefix 'jira.permission.subtasks.comment.group' would return {'jira-qa', 'jira-administrators'}. Unfortunately OSWorkflow does not allow multiple meta attributes with the same name.


getMetaAttributesForIssue

public static java.util.Map getMetaAttributesForIssue(org.ofbiz.core.entity.GenericValue issue)
Get all meta attributes for an issue's current state.


convertDescriptorToXML

public static java.lang.String convertDescriptorToXML(com.opensymphony.workflow.loader.WorkflowDescriptor descriptor)
Converts a WorkflowDescriptor to XML.

Parameters:
descriptor - The WorkflowDescriptor to convert
Returns:
An XML representation of the workflowdescritpor passed in.

isAcceptableName

public static boolean isAcceptableName(java.lang.String workflowName)

checkInvalidCharacters

public static void checkInvalidCharacters(java.lang.String fieldValue,
                                          java.lang.String fieldName,
                                          ErrorCollection errorCollection)
JRA-4429 (prevent invalid characters)


convertXMLtoWorkflowDescriptor

public static com.opensymphony.workflow.loader.WorkflowDescriptor convertXMLtoWorkflowDescriptor(java.lang.String workflowDescriptorXML)
                                                                                          throws com.opensymphony.workflow.FactoryException
Converts a string representation of a workflow XML into the WorkflowDescriptor object representation.

Parameters:
workflowDescriptorXML - the XML representation of an OSWorkflow
Returns:
the WorkflowDescriptor that represents the workflow.
Throws:
com.opensymphony.workflow.FactoryException - thrown if the XML is malformed or can not be converted to the object representation.

getWorkflowDisplayName

public static java.lang.String getWorkflowDisplayName(JiraWorkflow workflow)
Appends "(Draft)" to the end of the workflow name for an draft workflow.

Parameters:
workflow - The workflow to create the display name for.
Returns:
A String with the workflow name plus an optional (Draft).

cloneWorkflowName

public static java.lang.String cloneWorkflowName(java.lang.String currentName)

getWorkflowTransitionDisplayName

public static java.lang.String getWorkflowTransitionDisplayName(com.opensymphony.workflow.loader.ActionDescriptor descriptor)
Get the translated display name of a workflow transition.

Parameters:
descriptor - The action descriptor to get the name of
Returns:
The name of the transition.

getWorkflowTransitionDescription

public static java.lang.String getWorkflowTransitionDescription(com.opensymphony.workflow.loader.ActionDescriptor descriptor)
Get the translated description of the workflow transition.

Parameters:
descriptor - The action descriptor to get the description of
Returns:
the translated description of the workflow transition.


Copyright © 2002-2011 Atlassian. All Rights Reserved.