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.enhydra.shark.api.client.wfmc.audit;
051:
052: import java.util.Date;
053:
054: import org.enhydra.shark.api.client.wfmc.wapi.WMProcessDefinitionState;
055:
056: /**
057: * Section 9.1 of the Interface 5 WFMC standards
058: * When the state of the process definition is changed, the information is
059: * written to the audit data. A state change may occur as the result of a
060: * State Change API command or as the result of internal WFM Engine operations.
061: * This would correspond to the WMChangeProcessDefinitionState, which allows
062: * process definitions to be changed temporarily to a specific states, such as
063: * disabled or enabled.
064: *
065: * @author Antony Lodge
066: */
067: public class WMAChangeProcessDefinitionState extends WMAAuditBase {
068: static final long serialVersionUID = -1690595508698119387L;
069:
070: private int _newProcessDefinitionState;
071: private int _previousProcessDefinitionState;
072:
073: protected static String valueOf(int state) {
074: return state == -1 ? null : WMProcessDefinitionState.valueOf(
075: state).toString();
076: }
077:
078: protected static int valueOf(String state) {
079: return state == null ? -1 : WMProcessDefinitionState.valueOf(
080: state).value();
081: }
082:
083: public WMAChangeProcessDefinitionState() {
084: }
085:
086: public WMAChangeProcessDefinitionState(String processDefinitionId,
087: int processState, WMAEventCode eventCode, String domainId,
088: String nodeId, String userId, String roleId,
089: Date timestamp, int newProcessDefinitionState,
090: int previousProcessDefinitionState) {
091:
092: super (processDefinitionId, null, null, null, null, null,
093: processState, eventCode, domainId, nodeId, userId,
094: roleId, timestamp);
095: _newProcessDefinitionState = newProcessDefinitionState;
096: _previousProcessDefinitionState = previousProcessDefinitionState;
097: }
098:
099: public WMAChangeProcessDefinitionState(String processDefinitionId,
100: int processState, WMAEventCode eventCode, String domainId,
101: String nodeId, String userId, String roleId,
102: Date timestamp, byte accountCode, short extensionNumber,
103: byte extensionType, short extensionLength,
104: short extensionCodePage, Object extensionContent,
105: int newProcessDefinitionState,
106: int previousProcessDefinitionState) {
107:
108: super (processDefinitionId, null, null, null, null, null,
109: processState, eventCode, domainId, nodeId, userId,
110: roleId, timestamp, accountCode, extensionNumber,
111: extensionType, extensionLength, extensionCodePage,
112: extensionContent);
113: _newProcessDefinitionState = newProcessDefinitionState;
114: _previousProcessDefinitionState = previousProcessDefinitionState;
115: }
116:
117: /**
118: *
119: * @return New state for the process definition
120: */
121: public String getNewProcessDefinitionState() {
122: return valueOf(_newProcessDefinitionState);
123: }
124:
125: /**
126: *
127: * @param newProcessDefinitionState New state for the process definition
128: */
129: public void setNewProcessDefinitionState(
130: String newProcessDefinitionState) {
131: _newProcessDefinitionState = valueOf(newProcessDefinitionState);
132: }
133:
134: /**
135: *
136: * @return Previous state for process definition
137: */
138: public String getPreviousProcessDefinitionState() {
139: return valueOf(_previousProcessDefinitionState);
140: }
141:
142: /**
143: *
144: * @param previousProcessDefinitionState Previous state for process definition
145: */
146: public void setPreviousProcessDefinitionState(
147: String previousProcessDefinitionState) {
148:
149: _previousProcessDefinitionState = valueOf(previousProcessDefinitionState);
150: }
151:
152: public String toString() {
153: return "WMAChangeProcessDefinitionState[cwadPrefix="
154: + formatCwadPrefix() + ", newProcessDefinitionState="
155: + getNewProcessDefinitionState()
156: + ", previousProcessDefinitionState="
157: + getPreviousProcessDefinitionState() + ", cwadSuffix="
158: + formatCwadSuffix() + ']';
159: }
160: }
|