001: /*
002: * This file is part of the WfMOpen project.
003: * Copyright (C) 2001-2003 Danet GmbH (www.danet.de), GS-AN.
004: * All rights reserved.
005: *
006: * This program is free software; you can redistribute it and/or modify
007: * it under the terms of the GNU General Public License as published by
008: * the Free Software Foundation; either version 2 of the License, or
009: * (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: * $Id: DefaultCreateProcessAuditEvent.java,v 1.2 2006/09/29 12:32:08 drmlipp Exp $
021: *
022: * $Log: DefaultCreateProcessAuditEvent.java,v $
023: * Revision 1.2 2006/09/29 12:32:08 drmlipp
024: * Consistently using WfMOpen as projct name now.
025: *
026: * Revision 1.1.1.1 2003/06/30 20:05:15 drmlipp
027: * Initial import
028: *
029: * Revision 1.8 2003/06/27 08:51:45 lipp
030: * Fixed copyright/license information.
031: *
032: * Revision 1.7 2003/03/31 16:50:28 huaiyang
033: * Logging using common-logging.
034: *
035: * Revision 1.6 2003/02/11 08:49:55 lipp
036: * Shortened toString repr.
037: *
038: * Revision 1.5 2002/10/16 08:40:19 barzik
039: * new constructors to allow recreation by history
040: *
041: * Revision 1.4 2002/10/02 11:27:07 barzik
042: * bug fixes and more ...
043: *
044: * Revision 1.3 2002/10/01 16:06:00 lipp
045: * Event queue activated.
046: *
047: * Revision 1.2 2002/10/01 11:03:14 barzik
048: * add toString()
049: *
050: * Revision 1.1 2002/10/01 09:10:38 lipp
051: * AuditEvent handling restructured.
052: *
053: * Revision 1.3 2002/10/01 06:45:23 barzik
054: * no message
055: *
056: * Revision 1.2 2002/09/30 12:42:05 barzik
057: * audit event handling using base event information
058: *
059: * Revision 1.1 2002/09/24 12:23:02 barzik
060: * Initial implementation
061: *
062: */
063:
064: package de.danet.an.workflow.domain;
065:
066: import de.danet.an.workflow.omgcore.WfAuditEvent;
067: import de.danet.an.workflow.omgcore.WfCreateProcessAuditEvent;
068:
069: /**
070: * A <code>DefaultCreateProcessAuditEvent</code> implements an audit
071: * record with information related to the creation of a process. If
072: * the process is created as a sub-process of another process that is
073: * synchronized with the main process via a <code>WfActivity</code>
074: * requester, information on the requester is recorded.
075: */
076: public class DefaultCreateProcessAuditEvent extends DefaultAuditEvent
077: implements WfCreateProcessAuditEvent {
078:
079: private static final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory
080: .getLog(DefaultCreateProcessAuditEvent.class);
081:
082: /**
083: * The attribute <code>pActivityKey</code>. It identifies the
084: * activity which is the requester for the newly created process.
085: */
086: private String pActivityKey = null;
087:
088: /**
089: * The attribute <code>pProcessKey</code>. It identifies the
090: * process that contains parent activity.
091: */
092: private String pProcessKey = null;
093:
094: /**
095: * The attribute <code>pProcessName</code>. It identifies the
096: * process name that contains parent activity.
097: */
098: private String pProcessName = null;
099:
100: /**
101: * The attribute <code>pProcessMgrName</code>. It identifies the
102: * process manager of the parent process.
103: */
104: private String pProcessMgrName = null;
105:
106: /**
107: * The attribute <code>pProcessMgrVersion</code>. It identifies the
108: * version of the process manager of the parent process.
109: */
110: private String pProcessMgrVersion;
111:
112: /**
113: * Creates a new <code>DefaultCreateProcessAuditEvent</code>
114: * assigning the given attributes.
115: * @param baseInfo a <code>WfAuditEvent</code> containing base
116: * information for the event.
117: * @param reqActData data from the requesting activity (if
118: * the requester is an activity, else <code>null</code>).
119: */
120: public DefaultCreateProcessAuditEvent(WfAuditEvent baseInfo,
121: WfAuditEvent reqActData) {
122: // setup base attributes
123: super (baseInfo);
124:
125: if (reqActData != null) {
126: // specific attributes
127: pActivityKey = reqActData.activityKey();
128: pProcessKey = reqActData.processKey();
129: pProcessName = reqActData.processName();
130: pProcessMgrName = reqActData.processMgrName();
131: pProcessMgrVersion = reqActData.processMgrVersion();
132: }
133: }
134:
135: /**
136: * Creates a new <code>DefaultCreateProcessAuditEvent</code>
137: * assigning the given attributes.
138: * @param baseInfo a <code>WfAuditEvent</code> containing base
139: * information for the event.
140: * @param actKey the value for the attribute <code>pActivityKey</code>
141: * @param procKey the value for the attribute <code>pProcessKey</code>
142: * @param procName the value for the attribute <code>pProcessName</code>
143: * @param procMgrName the value for the attribute
144: * <code>pProcessMgrName</code>
145: * @param procMgrVersion the value for the attribute
146: * <code>pProcessMgrVersion</code>
147: */
148: public DefaultCreateProcessAuditEvent(WfAuditEvent baseInfo,
149: String actKey, String procKey, String procName,
150: String procMgrName, String procMgrVersion) {
151:
152: // setup base attributes
153: super (baseInfo);
154:
155: // specific attributes
156: pActivityKey = actKey;
157: pProcessKey = procKey;
158: pProcessName = procName;
159: pProcessMgrName = procMgrName;
160: pProcessMgrVersion = procMgrVersion;
161: }
162:
163: /**
164: * Creates a new <code>DefaultCreateProcessAuditEvent</code> with
165: * the given source and all other attributes copied from the given
166: * event.
167: * @param source the value for the source attribute.
168: * @param baseInfo a <code>DefaultCreateProcessAuditEvent</code>
169: * containing further information for the event.
170: */
171: private DefaultCreateProcessAuditEvent(Object source,
172: DefaultCreateProcessAuditEvent baseInfo) {
173: super (source, baseInfo);
174:
175: // specific attributes
176: pActivityKey = baseInfo.pActivityKey;
177: pProcessKey = baseInfo.pProcessKey;
178: pProcessName = baseInfo.pProcessName;
179: pProcessMgrName = baseInfo.pProcessMgrName;
180: pProcessMgrVersion = baseInfo.pProcessMgrVersion;
181: }
182:
183: /**
184: * Return a new audit event object with the source attribute
185: * replaced with the given object.
186: * @param source the new source attribute.
187: * @return the new audit event.
188: */
189: public DefaultAuditEvent replaceSource(Object source) {
190: return new DefaultCreateProcessAuditEvent(source, this );
191: }
192:
193: /**
194: * Returns the current value of the attribute <code>pActivityKey</code>.
195: * @return the current value of the attribute.
196: */
197: public String pActivityKey() {
198: return pActivityKey;
199: }
200:
201: /**
202: * Returns the current value of the attribute <code>pProcessKey</code>.
203: * @return the current value of the attribute.
204: */
205: public String pProcessKey() {
206: return pProcessKey;
207: }
208:
209: /**
210: * Returns the current value of the attribute <code>pProcessName</code>.
211: * @return the current value of the attribute.
212: */
213: public String pProcessName() {
214: return pProcessName;
215: }
216:
217: /**
218: * Returns the current value of the attribute
219: * <code>pProcessMgrName</code>.
220: * @return the current value of the attribute.
221: */
222: public String pProcessMgrName() {
223: return pProcessMgrName;
224: }
225:
226: /**
227: * Returns the current value of the attribute
228: * <code>pProcessMgrVersion</code>.
229: * @return the current value of the attribute.
230: */
231: public String pProcessMgrVersion() {
232: return pProcessMgrVersion;
233: }
234:
235: /**
236: * Returns a textual representation of the event.
237: * @return the textual representation
238: */
239: public String toString() {
240: String event = "WfCreateProcessAuditEvent[";
241: return event + super .toString() + ", parentActivityKey="
242: + pActivityKey + ", parentProcessKey=" + pProcessKey
243: + ", parentProcessName=" + pProcessName
244: + ", parentProcessManagerName=" + pProcessMgrName
245: + ", parentProcessManagerVersion=" + pProcessMgrVersion
246: + "]";
247: }
248: }
|