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 java.util.Date;
053:
054: /**
055: * Abstract base class for all audit data classes.
056: *
057: * @author Antony Lodge
058: */
059: public abstract class WMAAuditBase extends WMAAuditEntry implements
060: CWADSuffix {
061: private static final long serialVersionUID = -1365880456646128382L;
062:
063: // CWADSuffix fields.
064: private byte _accountCode;
065: private short _extensionNumber;
066: private byte _extensionType;
067: private short _extensionLength;
068: private short _extensionCodePage;
069: private Object _extensionContent;
070:
071: /**
072: * Empty constructor to enable subclass JavaBean compliance.
073: */
074: protected WMAAuditBase() {
075: }
076:
077: /**
078: * Constructor that takes all the CWADPrefix fields.
079: *
080: * @param processDefinitionId
081: * @param activityDefinitionId
082: * @param initialProcessInstanceId
083: * @param currentProcessInstanceId
084: * @param activityInstanceId
085: * @param workItemId
086: * @param processState
087: * @param eventCode
088: * @param domainId
089: * @param nodeId
090: * @param userId
091: * @param roleId
092: * @param timestamp
093: */
094: protected WMAAuditBase(String processDefinitionId,
095: String activityDefinitionId,
096: String initialProcessInstanceId,
097: String currentProcessInstanceId, String activityInstanceId,
098: String workItemId, int processState,
099: WMAEventCode eventCode, String domainId, String nodeId,
100: String userId, String roleId, Date timestamp) {
101:
102: super (processDefinitionId, activityDefinitionId,
103: initialProcessInstanceId, currentProcessInstanceId,
104: activityInstanceId, workItemId, processState,
105: eventCode, domainId, nodeId, userId, roleId, timestamp);
106: }
107:
108: /**
109: * Constructor that takes all the CWADPrefix and CWADSuffix fields.
110: *
111: * @param processDefinitionId
112: * @param activityDefinitionId
113: * @param initialProcessInstanceId
114: * @param currentProcessInstanceId
115: * @param activityInstanceId
116: * @param workItemId
117: * @param processState
118: * @param eventCode
119: * @param domainId
120: * @param nodeId
121: * @param userId
122: * @param roleId
123: * @param timestamp
124: * @param accountCode
125: * @param extensionNumber
126: * @param extensionType
127: * @param extensionLength
128: * @param extensionCodePage
129: * @param extensionContent
130: */
131: protected WMAAuditBase(String processDefinitionId,
132: String activityDefinitionId,
133: String initialProcessInstanceId,
134: String currentProcessInstanceId, String activityInstanceId,
135: String workItemId, int processState,
136: WMAEventCode eventCode, String domainId, String nodeId,
137: String userId, String roleId, Date timestamp,
138: byte accountCode, short extensionNumber,
139: byte extensionType, short extensionLength,
140: short extensionCodePage, Object extensionContent) {
141:
142: super (processDefinitionId, activityDefinitionId,
143: initialProcessInstanceId, currentProcessInstanceId,
144: activityInstanceId, workItemId, processState,
145: eventCode, domainId, nodeId, userId, roleId, timestamp);
146: _accountCode = accountCode;
147: _extensionNumber = extensionNumber;
148: _extensionType = extensionType;
149: _extensionLength = extensionLength;
150: _extensionCodePage = extensionCodePage;
151: _extensionContent = extensionContent;
152: }
153:
154: /**
155: * @param p Prefix information
156: * @param s Suffix information.
157: */
158: protected WMAAuditBase(CWADPrefix p, CWADSuffix s) {
159: super (p.getProcessDefinitionId(), p.getActivityDefinitionId(),
160: p.getInitialProcessInstanceId(), p
161: .getCurrentProcessInstanceId(), p
162: .getActivityInstanceId(), p.getWorkItemId(),
163: valueOf(p.getProcessState()), p.getEventCode(), p
164: .getDomainId(), p.getNodeId(), p.getUserId(), p
165: .getRoleId(), p.getTimestamp());
166: String informationId = p.getInformationId();
167: if (informationId != null)
168: setInformationId(informationId);
169: setCwadSuffix(s);
170: }
171:
172: /**
173: * @return The audit data suffix information.
174: */
175: public CWADSuffix getCwadSuffix() {
176: return this ;
177: }
178:
179: /**
180: * @param suffix
181: */
182: public final void setCwadSuffix(CWADSuffix suffix) {
183: _accountCode = suffix.getAccountCode();
184: _extensionNumber = suffix.getExtensionNumber();
185: _extensionType = suffix.getExtensionType();
186: _extensionLength = suffix.getExtensionLength();
187: _extensionCodePage = suffix.getExtensionCodePage();
188: _extensionContent = suffix.getExtensionContent();
189: }
190:
191: public String formatCwadSuffix() {
192: return "CWADSuffix[" + "accountCode=" + _accountCode
193: + ", extensionNumber=" + _extensionNumber
194: + ", extensionType=" + _extensionType
195: + ", extensionLength=" + _extensionLength
196: + ", extensionCodePage=" + _extensionCodePage
197: + ", extensionContent=" + _extensionContent + ']';
198: }
199:
200: /**
201: * @return Accounting Code used for item of work
202: */
203: public byte getAccountCode() {
204: return _accountCode;
205: }
206:
207: /**
208: * @param accountCode Accounting Code used for item of work
209: */
210: public void setAccountCode(byte accountCode) {
211: _accountCode = accountCode;
212: }
213:
214: /**
215: * @return Number of extensions in suffix information
216: */
217: public short getExtensionNumber() {
218: return _extensionNumber;
219: }
220:
221: /**
222: * @param extensionNumber Number of extensions in suffix information
223: */
224: public void setExtensionNumber(short extensionNumber) {
225: _extensionNumber = extensionNumber;
226: }
227:
228: /**
229: * @return Type of extension
230: */
231: public byte getExtensionType() {
232: return _extensionType;
233: }
234:
235: /**
236: * @param extensionType Type of extension
237: */
238: public void setExtensionType(byte extensionType) {
239: _extensionType = extensionType;
240: }
241:
242: /**
243: * @return Total length of extension values
244: */
245: public short getExtensionLength() {
246: return _extensionLength;
247: }
248:
249: /**
250: * @param extensionLength Total length of extension values
251: */
252: public void setExtensionLength(short extensionLength) {
253: _extensionLength = extensionLength;
254: }
255:
256: /**
257: * @return The code page used by this audit extension.
258: */
259: public short getExtensionCodePage() {
260: return _extensionCodePage;
261: }
262:
263: /**
264: * @param extensionCodePage
265: */
266: public void setExtensionCodePage(short extensionCodePage) {
267: _extensionCodePage = extensionCodePage;
268: }
269:
270: /**
271: * @return Content, defined by Extension Type and Length
272: */
273: public Object getExtensionContent() {
274: return _extensionContent;
275: }
276:
277: /**
278: * @param extensionContent Content, defined by Extension Type and Length
279: */
280: public void setExtensionContent(Object extensionContent) {
281: _extensionContent = extensionContent;
282: }
283: }
|