001: package org.wfmc.audit;
002:
003: import org.wfmc.wapi.WMWorkItemState;
004:
005: import java.util.Date;
006:
007: /**
008: * Change Work Item State Audit Data.
009: *
010: * @author Antony Lodge
011: */
012: public class WMAChangeWorkItemStateData extends WMAAuditBase {
013: private static final long serialVersionUID = 7025075993712917031L;
014:
015: private int _workItemState;
016: private int _previousWorkItemState;
017:
018: protected static String valueOf(int state) {
019: return state == -1 ? null : WMWorkItemState.valueOf(state)
020: .toString();
021: }
022:
023: protected static int valueOf(String state) {
024: return state == null ? -1 : WMWorkItemState.valueOf(state)
025: .value();
026: }
027:
028: public WMAChangeWorkItemStateData() {
029: }
030:
031: /**
032: * Constructor that takes all fields (including the CWADPrefix).
033: *
034: * @param processDefinitionId
035: * @param activityDefinitionId
036: * @param initialProcessInstanceId
037: * @param currentProcessInstanceId
038: * @param activityInstanceId
039: * @param workItemId
040: * @param processState
041: * @param eventCode
042: * @param domainId
043: * @param nodeId
044: * @param userId
045: * @param roleId
046: * @param timestamp
047: * @param workItemState
048: * @param previousWorkItemState
049: */
050: public WMAChangeWorkItemStateData(String processDefinitionId,
051: String activityDefinitionId,
052: String initialProcessInstanceId,
053: String currentProcessInstanceId, String activityInstanceId,
054: String workItemId, int processState,
055: WMAEventCode eventCode, String domainId, String nodeId,
056: String userId, String roleId, Date timestamp,
057: int workItemState, int previousWorkItemState) {
058:
059: super (processDefinitionId, activityDefinitionId,
060: initialProcessInstanceId, currentProcessInstanceId,
061: activityInstanceId, workItemId, processState,
062: eventCode, domainId, nodeId, userId, roleId, timestamp);
063: _workItemState = workItemState;
064: _previousWorkItemState = previousWorkItemState;
065: }
066:
067: /**
068: * Constructor that takes all fields (including the CWADPrefix and
069: * CWADSuffix).
070: *
071: * @param processDefinitionId
072: * @param activityDefinitionId
073: * @param initialProcessInstanceId
074: * @param currentProcessInstanceId
075: * @param activityInstanceId
076: * @param workItemId
077: * @param processState
078: * @param eventCode
079: * @param domainId
080: * @param nodeId
081: * @param userId
082: * @param roleId
083: * @param timestamp
084: * @param accountCode
085: * @param extensionNumber
086: * @param extensionType
087: * @param extensionLength
088: * @param extensionCodePage
089: * @param extensionContent
090: * @param workItemState
091: * @param previousWorkItemState
092: */
093: public WMAChangeWorkItemStateData(String processDefinitionId,
094: String activityDefinitionId,
095: String initialProcessInstanceId,
096: String currentProcessInstanceId, String activityInstanceId,
097: String workItemId, int processState,
098: WMAEventCode eventCode, String domainId, String nodeId,
099: String userId, String roleId, Date timestamp,
100: byte accountCode, short extensionNumber,
101: byte extensionType, short extensionLength,
102: short extensionCodePage, Object extensionContent,
103: int workItemState, int previousWorkItemState) {
104:
105: super (processDefinitionId, activityDefinitionId,
106: initialProcessInstanceId, currentProcessInstanceId,
107: activityInstanceId, workItemId, processState,
108: eventCode, domainId, nodeId, userId, roleId, timestamp,
109: accountCode, extensionNumber, extensionType,
110: extensionLength, extensionCodePage, extensionContent);
111: _workItemState = workItemState;
112: _previousWorkItemState = previousWorkItemState;
113: }
114:
115: /**
116: * @return State of the work item
117: */
118: public String getWorkItemState() {
119: return valueOf(_workItemState);
120: }
121:
122: /**
123: * @param workItemState State of the work item
124: */
125: public void setWorkItemState(String workItemState) {
126: _workItemState = valueOf(workItemState);
127: }
128:
129: /**
130: * @return State of the work item
131: */
132: public String getPreviousWorkItemState() {
133: return valueOf(_previousWorkItemState);
134: }
135:
136: /**
137: * @param workItemState State of the work item
138: */
139: public void setPreviousWorkItemState(String workItemState) {
140: _previousWorkItemState = valueOf(workItemState);
141: }
142:
143: public String toString() {
144: return "WMAChangeWorkItemStateData[cwadPrefix="
145: + formatCwadPrefix() + ", workItemState="
146: + getWorkItemState() + ", previousWorkItemState="
147: + getPreviousWorkItemState() + ", cwadSuffix="
148: + formatCwadSuffix() + ']';
149: }
150: }
|