Workflow Attributes Management

Overview

Minyaa Workflow Attributes helps you for editing the Workflow Meta-attributes in Step or Transition descriptors.

Meta-attributes are a way to apply some configuration in JIRA. By example, jira.issue.editable allows or denies Issue edition.

But in practice, the exercice is no so easy :

  • You have to know which attribute are available, using the correct syntax ... (jira.issue.editable or jira.editable.issue) or spent some (more) time on JIRA documentation of JIRA or in any other useful blog/forum of JIRA Community...
  • You have to enter the try correct value, respecting the wanted format

Goal of Workflow Attributes Management

The goal is twice :
  • to provide a list of supported Meta-Attributes,
  • to provide for edition, a dedicated editor for most of type of supported Meta-Attributes.
A set of supported Meta-Attributes is predefined with the plugin, each with their default editor. The process as follow for adding a Meta-Attributes is as follow ...
  1. When accessing the Step or Transition Meta-Attributes page, an asynchronous access will modify the default editor and provide a list of available Meta-Attributes.

    List of Meta-Attributes
  2. When selecting any Meta-Attributes, the correct editor is displayed. Currently provided editors are :

    • String editor (same as default one)

      Editor for String Meta-Attribute
    • Boolean editor

      Editor for Boolean Meta-Attribute
    • Condition Editor (including Boolean) for some Meta-Attributes provided by Minyaa, related to permissions on issue operations

      Editor for Boolean / Condition Meta-Attribute
    • UserByStep Editor (see here for details)

      Editor for UserByStep Meta-Attribute
  3. Select/Edit the value and add it! Less risk to make a typo error in the Meta-Attributes

How to extend Meta-Attributes Editors

To append a new Meta-Attributes Editors, you will have to process as follow ...
  • Create a Velocity template providing the Attrbibute Editor

    See below the Boolean editor

    <td class="fieldLabelArea">$i18n.getText("minyaa.workflows.attribute.booleanValue")</td>
    <td class="fieldValueArea">
    	<input type="radio" name="metaAttributeBooleanValue" id="attributeRadioValue1" size="30" value="true" /><label for="attributeRadioValue1">&nbsp;$i18n.getText("admin.common.words.true")</label>
    	<input type="radio" name="metaAttributeBooleanValue" id="attributeRadioValue2" size="30" value="false" /><label for="attributeRadioValue2">&nbsp;$i18n.getText("admin.common.words.false")</label><br />
    </td>


  • Create a Javascript applying the edited value into the Input field.

    ... always for Boolean editor

    jQuery(document).ready(function(){
    	MYAAWA.namespace("MYAAWA.Editors.editMetaBoolean");
    	MYAAWA.Editors.editMetaBoolean.init = function(inputValue) {
    		var editedValue = AJS.$("[name='metaAttributeBooleanValue']");
    		var onChanged = function(event) {
    			inputValue.val(event.target.value);
    		};
    		MYAAWA.Editors.editMetaBoolean.onChanged = onChanged; 
    		editedValue.change(MYAAWA.Editors.editMetaBoolean.onChanged);
    	};
    });


  • Define a Web Resource for this JS file. It has to be in dependency with MYAA_WorkflowsAttribute.js

    ... again for Boolean editor

    <web-resource key="MYAA_editMetaBoolean" name="MYAA-editMetaBoolean">
    		<dependency>jira.plugin.minyaa.workflows.attributes:MYAA_WorkflowsAttributes</dependency>
    		<resource type="download" name="editMetaBoolean.js" location="com/minyaa/workflows/js/MYAA.editMetaBoolean.js">
    			<property key="content-type" value="text/javascript"/>
    		</resource>
    		<context>atl.admin</context>
    	</web-resource>


  • and finally, defined the meta-editor, specifying the related Velocity template

    ... a last one for Boolean editor

    <meta-editor key="editMetaBoolean" name="Edit Meta Attribute as Boolean">
    		<resource type="velocity" name="edit" location="com/minyaa/workflows/templates/meta-attributes-edit-boolean.vm"/>
    	</meta-editor>


How to extend Meta-Attributes

To extend the list of displayed Meta-Attributes depending on the list of supported process as follow ... Use the custom plugin module-type meta-attribute
<meta-attribute key="sampleAttribute" name="sample.attribute" isUnique="false"  valueEditorKey="jira.plugin.minyaa.workflows.attributes:editMetaBoolean" >
        <description key="sample.attribute.desc">Do nothing !.</description>
		<scope 	initialAction="true" 
				globalAction="true"
				commonAction="true"
				stepAction="true"
				initialStep="true"
				normalStep="true"
				finalStep="true"
				/>
	</meta-attribute>


Where ...
  • isUnique specifies if the attribute may be use more than one time by Step of Transition (Not yet completely supported),
  • valueEditorKey specifies the editor to use. Use the complete key.
  • scope specifies if the attribute can be use as Step Meta-Attribute or Transition Meta-Attribute

    Different types of Step and Action are possible, but will managed only by Minyaa Workflows Designer
Meta-Attributes may be also added through a Plugin Component. The Component will have to implement the interface MetaAttributesProvider as follow ...
public class YourMetaAttributesProvider implements MetaAttributesProvider {

	private MetaAttributeManager metaAttributeManager;
	
	public WorkflowMetaAttributesProvider(MetaAttributeManager metaAttributeManager) {
		this.metaAttributeManager = metaAttributeManager;
		metaAttributeManager.addMetaAttributesProvider(this);
	}
	
	public void refresh() {
		MetaAttributeModule metaAttributeModule; 
		
		metaAttributeModule = new MetaAttributeModule("sample.step.attribute");
		metaAttributeModule.appendDescription("Do nothing special").appendScopes(metaAttributeManager.getAllAvailableStepScopes());
		metaAttributeModule.appendValueEditorKey("jira.plugin.minyaa.workflows.attributes:editMetaBoolean");
		metaAttributeManager.addMetaAttributes(metaAttributeModule);

		metaAttributeModule = new MetaAttributeModule("new.boolean.action.attribute");
		metaAttributeModule.appendDescription("Define if it is True or False !!!").appendScopes(metaAttributeManager.getAllAvailableActionScopes());
		metaAttributeModule.appendValueEditorKey(MetaAttributeManager.META_VALUE_EDITOR_BOOLEAN_KEY);
		metaAttributeManager.addMetaAttributes(metaAttributeModule);
	}
}