001: /**
002: *
003: */package org.emforge.jbpm;
004:
005: import org.apache.commons.lang.StringUtils;
006:
007: /**
008: * Contains all special BPM variables
009: *
010: * @author szakusov, 06.02.2008: Implemented to keep all special BPM variables in one place
011: * @todo Change variable names so they will have "_" in the prefix
012: * @todo Check if the _AssignedTo variable is still required?
013: * @todo Update http://www.emforge.org/wiki/SpecialVariablesUsedInProcessDefinition
014: */
015: public enum BpmVariable {
016:
017: OWNER("Owner", "Represents the task owner", true, true), ASSIGNTO(
018: "AssignTo", "Represents the step owner", true, true), ASSIGNEDTO(
019: "_AssignedTo", "Represents the step owner", true, true), PRIORITY(
020: "_Priority", "Represents the task priority", true, true), PROJECT(
021: "_Project",
022: "Represents the project name the task is connected to",
023: true, true), MILESTONE("_Milestone",
024: "Represents the milestone name the task is connected to",
025: false, true), TITLE("_Title", "Represents the task title",
026: true, true), DUEDATE("_ProcessDueDate",
027: "Represents the task dead-line", true, true);
028:
029: private String m_variable; // variable name
030: private String m_description; // variable purpose
031: private boolean m_autoCreation; // is created by EmForge or not
032: private boolean m_autoDisplaying; // is displayed at task page or not
033:
034: /**
035: * @param i_variable
036: * @param i_description
037: * @param i_autoCreation
038: * @param i_autoDisplaying
039: * @param i_usedByReports
040: */
041: private BpmVariable(String i_variable, String i_description,
042: boolean i_autoCreation, boolean i_autoDisplaying) {
043:
044: m_variable = i_variable;
045: m_description = i_description;
046: m_autoCreation = i_autoCreation;
047: m_autoDisplaying = i_autoDisplaying;
048: }
049:
050: /**
051: * @return Variable name
052: */
053: public String getVariable() {
054:
055: return m_variable;
056: }
057:
058: /**
059: * @return
060: */
061: public String getDescription() {
062:
063: return m_description;
064: }
065:
066: /**
067: * @return
068: */
069: public boolean isAutoCreation() {
070:
071: return m_autoCreation;
072: }
073:
074: /**
075: * @return
076: */
077: public boolean isAutoDisplaying() {
078:
079: return m_autoDisplaying;
080: }
081:
082: /**
083: * @param i_variable
084: * @return
085: */
086: public static BpmVariable getItem(String i_variable) {
087:
088: BpmVariable result = null;
089:
090: for (BpmVariable role : BpmVariable.values()) {
091: if (StringUtils.equals(role.m_variable, i_variable)) {
092: result = role;
093: break;
094: }
095: }
096:
097: return result;
098: }
099:
100: /**
101: * @see java.lang.Enum#toString()
102: */
103: @Override
104: public String toString() {
105:
106: return m_variable + " - " + m_description
107: + "(created by default: " + m_autoCreation
108: + ", always displayed: " + m_autoDisplaying + ")";
109: }
110: }
|