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: DefaultProcessData.java,v 1.2 2006/09/29 12:32:07 drmlipp Exp $
021: *
022: * $Log: DefaultProcessData.java,v $
023: * Revision 1.2 2006/09/29 12:32:07 drmlipp
024: * Consistently using WfMOpen as projct name now.
025: *
026: * Revision 1.1.1.2 2004/08/18 15:17:36 drmlipp
027: * Update to 1.2
028: *
029: * Revision 1.5 2004/02/20 15:56:17 lipp
030: * Added toString for easier debugging.
031: *
032: * Revision 1.4 2003/06/27 08:51:46 lipp
033: * Fixed copyright/license information.
034: *
035: * Revision 1.3 2003/05/07 09:48:33 lipp
036: * Completed asynchronous subflow implementation.
037: *
038: * Revision 1.2 2003/04/24 20:50:13 lipp
039: * Fixed some warnings.
040: *
041: * Revision 1.1 2002/08/20 07:12:43 lipp
042: * Default ProcessData implementation moved.
043: *
044: */
045: package de.danet.an.workflow.api;
046:
047: import java.io.Serializable;
048:
049: import java.util.ArrayList;
050: import java.util.Collections;
051: import java.util.HashMap;
052: import java.util.Iterator;
053: import java.util.List;
054: import java.util.Map;
055:
056: import de.danet.an.workflow.omgcore.ProcessData;
057:
058: /**
059: * This class extends <code>HashMap</code> in order to provide a
060: * default implementation of <code>ProcessData</code>.
061: *
062: * @author <a href="mailto:lipp@danet.de">Michael N. Lipp</a>
063: * @version $Revision: 1.2 $
064: */
065:
066: public class DefaultProcessData extends HashMap implements ProcessData,
067: Serializable {
068:
069: /**
070: * Creates an empty <code>DefaultProcessData</code>.
071: */
072: public DefaultProcessData() {
073: }
074:
075: /**
076: * Creates a <code>DefaultProcessData</code> with the same mapping as
077: * the given map.
078: *
079: * @param procData the process data that are to be placed in this
080: * <code>DefaultProcessData</code>.
081: */
082: public DefaultProcessData(Map procData) {
083: super (procData);
084: }
085:
086: /**
087: * Generate a string representation for debugging purposes.
088: * @return string representation
089: */
090: public String toString() {
091: List keys = new ArrayList(keySet());
092: try {
093: Collections.sort(keys);
094: } catch (Throwable e) {
095: }
096: StringBuffer res = new StringBuffer("ProcessData[");
097: boolean first = true;
098: for (Iterator i = keys.iterator(); i.hasNext();) {
099: String key = (String) i.next();
100: if (!first) {
101: res.append(",");
102: } else {
103: first = false;
104: }
105: res.append(key + "=" + get(key));
106: }
107: res.append("]");
108: return res.toString();
109: }
110: }
|