001: /*--
002:
003: Copyright (C) 2002 Anthony Eden.
004: All rights reserved.
005:
006: Redistribution and use in source and binary forms, with or without
007: modification, are permitted provided that the following conditions
008: are met:
009:
010: 1. Redistributions of source code must retain the above copyright
011: notice, this list of conditions, and the following disclaimer.
012:
013: 2. Redistributions in binary form must reproduce the above copyright
014: notice, this list of conditions, and the disclaimer that follows
015: these conditions in the documentation and/or other materials
016: provided with the distribution.
017:
018: 3. The names "OBE" and "Open Business Engine" must not be used to
019: endorse or promote products derived from this software without prior
020: written permission. For written permission, please contact
021: me@anthonyeden.com.
022:
023: 4. Products derived from this software may not be called "OBE" or
024: "Open Business Engine", nor may "OBE" or "Open Business Engine"
025: appear in their name, without prior written permission from
026: Anthony Eden (me@anthonyeden.com).
027:
028: In addition, I request (but do not require) that you include in the
029: end-user documentation provided with the redistribution and/or in the
030: software itself an acknowledgement equivalent to the following:
031: "This product includes software developed by
032: Anthony Eden (http://www.anthonyeden.com/)."
033:
034: THIS SOFTWARE IS PROVIdED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
035: WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
036: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
037: DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
038: INDIRECT, INCIdENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
039: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
040: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
041: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
042: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
043: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
044: POSSIBILITY OF SUCH DAMAGE.
045:
046: For more information on OBE, please see <http://obe.sourceforge.net/>.
047:
048: */
049:
050: package org.wfmc.audit;
051:
052: import org.wfmc.wapi.WMActivityInstanceState;
053:
054: import java.util.Date;
055:
056: /**
057: * Change Activity Instance State Audit Data.
058: *
059: * @author Antony Lodge
060: */
061: public class WMAChangeActivityInstanceStateData extends WMAAuditBase {
062: private static final long serialVersionUID = 3105870611884980114L;
063:
064: private String _activityDefinitionBusinessName;
065: private String _applicationId;
066: private int _newActivityState;
067: private int _previousActivityState;
068:
069: protected static String valueOf(int state) {
070: return state == -1 ? null : WMActivityInstanceState.valueOf(
071: state).toString();
072: }
073:
074: protected static int valueOf(String state) {
075: return state == null ? -1 : WMActivityInstanceState.valueOf(
076: state).value();
077: }
078:
079: public WMAChangeActivityInstanceStateData() {
080: }
081:
082: public WMAChangeActivityInstanceStateData(
083: String processDefinitionId, String activityDefinitionId,
084: String initialProcessInstanceId,
085: String currentProcessInstanceId, String activityInstanceId,
086: int processState, WMAEventCode eventCode, String domainId,
087: String nodeId, String userId, String roleId,
088: Date timestamp, String activityDefinitionBusinessName,
089: String applicationId, int newActivityState,
090: int previousActivityState) {
091:
092: super (processDefinitionId, activityDefinitionId,
093: initialProcessInstanceId, currentProcessInstanceId,
094: activityInstanceId, null, processState, eventCode,
095: domainId, nodeId, userId, roleId, timestamp);
096: _activityDefinitionBusinessName = activityDefinitionBusinessName;
097: _applicationId = applicationId;
098: _newActivityState = newActivityState;
099: _previousActivityState = previousActivityState;
100: }
101:
102: public WMAChangeActivityInstanceStateData(
103: String processDefinitionId, String activityDefinitionId,
104: String initialProcessInstanceId,
105: String currentProcessInstanceId, String activityInstanceId,
106: int processState, WMAEventCode eventCode, String domainId,
107: String nodeId, String userId, String roleId,
108: Date timestamp, byte accountCode, short extensionNumber,
109: byte extensionType, short extensionLength,
110: short extensionCodePage, Object extensionContent,
111: String activityDefinitionBusinessName,
112: String applicationId, int newActivityState,
113: int previousActivityState) {
114:
115: super (processDefinitionId, activityDefinitionId,
116: initialProcessInstanceId, currentProcessInstanceId,
117: activityInstanceId, null, processState, eventCode,
118: domainId, nodeId, userId, roleId, timestamp,
119: accountCode, extensionNumber, extensionType,
120: extensionLength, extensionCodePage, extensionContent);
121: _activityDefinitionBusinessName = activityDefinitionBusinessName;
122: _applicationId = applicationId;
123: _newActivityState = newActivityState;
124: _previousActivityState = previousActivityState;
125: }
126:
127: /**
128: * @return Business name of the Activity
129: */
130: public String getActivityDefinitionBusinessName() {
131: return _activityDefinitionBusinessName;
132: }
133:
134: /**
135: * @param activityDefinitionBusinessName Business name of the Activity
136: */
137: public void setActivityDefinitionBusinessName(
138: String activityDefinitionBusinessName) {
139:
140: _activityDefinitionBusinessName = activityDefinitionBusinessName;
141: }
142:
143: /**
144: * @return Id of the application associated with this activity
145: */
146: public String getApplicationId() {
147: return _applicationId;
148: }
149:
150: /**
151: * @param applicationId Id of application associated with this activity
152: */
153: public void setApplicationId(String applicationId) {
154: _applicationId = applicationId;
155: }
156:
157: /**
158: * @return New Activity State
159: */
160: public String getNewActivityState() {
161: return valueOf(_newActivityState);
162: }
163:
164: /**
165: * @param newActivityState New Activity State
166: */
167: public void setNewActivityState(String newActivityState) {
168: _newActivityState = valueOf(newActivityState);
169: }
170:
171: /**
172: * @return Previous Activity State
173: */
174: public String getPreviousActivityState() {
175: return valueOf(_previousActivityState);
176: }
177:
178: /**
179: * @param previousActivityState Previous Activity State
180: */
181: public void setPreviousActivityState(String previousActivityState) {
182: _previousActivityState = valueOf(previousActivityState);
183: }
184:
185: public String toString() {
186: return "WMAChangeActivityInstanceStateData[cwadPrefix="
187: + formatCwadPrefix()
188: + ", activityDefinitionBusinessName='"
189: + _activityDefinitionBusinessName + '\''
190: + ", applicationId=" + _applicationId
191: + ", newActivityState=" + getNewActivityState()
192: + ", previousActivityState="
193: + getPreviousActivityState() + ", cwadSuffix="
194: + formatCwadSuffix() + ']';
195: }
196: }
|