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: DefaultAssignmentAuditEvent.java,v 1.2 2006/09/29 12:32:08 drmlipp Exp $
021: *
022: * $Log: DefaultAssignmentAuditEvent.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/08 09:46:07 barzik
039: * Releasing resources requires NULL setting as the new resource
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.WfAssignmentAuditEvent;
067: import de.danet.an.workflow.omgcore.WfAuditEvent;
068:
069: /**
070: * A <code>DefaultAssignmentAuditEvent</code> implements an audit record of
071: * assignment change information for either the status of an
072: * assignment change for a <code>WfActivity</code> or when an exisiting
073: * assignment is reassigned to another resource.
074: */
075: public class DefaultAssignmentAuditEvent extends DefaultAuditEvent
076: implements WfAssignmentAuditEvent {
077:
078: private static final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory
079: .getLog(DefaultAssignmentAuditEvent.class);
080:
081: /**
082: * The attribute <code>oldResourceKey</code>. It identifies the
083: * resource associated with the assignment before the change.
084: * If the assignment was newly created, the value is <code>null</code>.
085: * Hence, setting the attribute is optional.
086: */
087: private String oldResourceKey = null;
088:
089: /**
090: * The attribute <code>newResourceKey</code>. It identifies the
091: * resource associated with the assignment after the change.
092: * Setting the attribute is mandatory.
093: */
094: private String newResourceKey = null;
095:
096: /**
097: * The attribute <code>oldResourceName</code>. It identifies the
098: * resource's name associated with the assignment before the change.
099: * If the assignment was newly created, the value is <code>null</code>.
100: * Hence, setting the attribute is optional.
101: */
102: private String oldResourceName = null;
103:
104: /**
105: * The attribute <code>newResourceName</code>. It identifies the
106: * resource's name associated with the assignment after the change.
107: * Setting the attribute is mandatory.
108: */
109: private String newResourceName = null;
110:
111: /**
112: * Creates a new <code>DefaultAssignmentAuditEvent</code>
113: * assigning the given attributes.
114: * @param baseInfo a <code>WfAuditEvent</code> containing further
115: * information for the event.
116: * @param oldResourceKey the attribute <code>oldResourceKey</code>.
117: * @param newResourceKey the attribute <code>newResourceKey</code>.
118: * @param oldResourceName the attribute <code>oldResourceName</code>.
119: * @param newResourceName the attribute <code>newResourceName</code>.
120: */
121: public DefaultAssignmentAuditEvent(WfAuditEvent baseInfo,
122: String oldResourceKey, String newResourceKey,
123: String oldResourceName, String newResourceName) {
124: // setup base attributes
125: super (baseInfo);
126:
127: // specialized attributes
128: this .oldResourceKey = oldResourceKey;
129: this .newResourceKey = newResourceKey;
130: this .oldResourceName = oldResourceName;
131: this .newResourceName = newResourceName;
132: }
133:
134: /**
135: * Creates a new <code>DefaultAssignmentAuditEvent</code> with the
136: * given source and all other attributes copied from the given
137: * event.
138: * @param source the value for the source attribute.
139: * @param baseInfo a <code>DefaultAssignmentAuditEvent</code>
140: * containing further information for the event.
141: */
142: private DefaultAssignmentAuditEvent(Object source,
143: DefaultAssignmentAuditEvent baseInfo) {
144: super (source, baseInfo);
145:
146: // specialized attributes
147: oldResourceKey = baseInfo.oldResourceKey;
148: newResourceKey = baseInfo.newResourceKey;
149: oldResourceName = baseInfo.oldResourceName;
150: newResourceName = baseInfo.newResourceName;
151: }
152:
153: /**
154: * Return a new audit event object with the source attribute
155: * replaced with the given object.
156: * @param source the new source attribute.
157: * @return the new audit event.
158: */
159: public DefaultAuditEvent replaceSource(Object source) {
160: return new DefaultAssignmentAuditEvent(source, this );
161: }
162:
163: /**
164: * Returns the current value of the attribute
165: * <code>oldResourceKey</code>.
166: * @return the current value of the attribute.
167: */
168: public String oldResourceKey() {
169: return oldResourceKey;
170: }
171:
172: /**
173: * Returns the current value of the attribute
174: * <code>newResourceKey</code>.
175: * @return the current value of the attribute.
176: */
177: public String newResourceKey() {
178: return newResourceKey;
179: }
180:
181: /**
182: * Returns the current value of the attribute
183: * <code>oldResourceName</code>.
184: * @return the current value of the attribute.
185: */
186: public String oldResourceName() {
187: return oldResourceName;
188: }
189:
190: /**
191: * Returns the current value of the attribute
192: * <code>newResourceName</code>.
193: * @return the current value of the attribute.
194: */
195: public String newResourceName() {
196: return newResourceName;
197: }
198:
199: /**
200: * Returns a textual representation of the event.
201: * @return the textual representation
202: */
203: public String toString() {
204: String event = "WfAssignmentAuditEvent[";
205: return event + super .toString() + ", oldResourceKey="
206: + oldResourceKey + ", newResourceKey=" + newResourceKey
207: + ", oldResourceName=" + oldResourceName
208: + ", newResourceName=" + newResourceName + "]";
209: }
210: }
|