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: TransitionDefinition.java,v 1.5 2007/05/03 21:58:19 mlipp Exp $
021: *
022: * $Log: TransitionDefinition.java,v $
023: * Revision 1.5 2007/05/03 21:58:19 mlipp
024: * Internal refactoring for making better use of local EJBs.
025: *
026: */
027:
028: package de.danet.an.workflow.domain;
029:
030: import java.io.Serializable;
031:
032: import de.danet.an.workflow.api.Activity;
033: import de.danet.an.workflow.api.Transition;
034: import de.danet.an.workflow.internalapi.ExtActivityLocal;
035: import de.danet.an.workflow.localapi.ActivityLocal;
036: import de.danet.an.workflow.localapi.TransitionLocal;
037:
038: /**
039: * Represents a transition between two activities. The activities are
040: * identified by their primary key class.
041: */
042: public class TransitionDefinition implements Serializable, Transition {
043:
044: /** The id of the process. */
045: private String pid = null;
046:
047: /** The id of the transition. */
048: private String id = null;
049:
050: /** The id of the transition group. */
051: private String group = null;
052:
053: /** The order of the transition. */
054: private int order = 0;
055:
056: /** The source activity. */
057: private Activity fromAct;
058:
059: /** The destination activity. */
060: private Activity toAct;
061:
062: /** The type of condition. */
063: private int condType = COND_TYPE_CONDITION;
064:
065: /** The condition of this transition. */
066: private String condition = null;
067:
068: /*
069: * Default constructor.
070: * @param transDef a transition definition
071: */
072: public TransitionDefinition(TransitionDefinitionLocal transDef) {
073: pid = transDef.processId();
074: id = transDef.id();
075: group = transDef.group();
076: order = transDef.order();
077: fromAct = ((ExtActivityLocal) transDef.from()).toActivity();
078: toAct = ((ExtActivityLocal) transDef.to()).toActivity();
079: condType = transDef.conditionType();
080: condition = transDef.condition();
081: }
082:
083: /* Comment copied from interface. */
084: public String id() {
085: return id;
086: }
087:
088: /* Comment copied from interface. */
089: public String group() {
090: return group;
091: }
092:
093: /* Comment copied from interface. */
094: public int order() {
095: return order;
096: }
097:
098: /* Comment copied from interface. */
099: public Activity from() {
100: return fromAct;
101: }
102:
103: /* Comment copied from interface. */
104: public Activity to() {
105: return toAct;
106: }
107:
108: /* Comment copied from interface. */
109: public int conditionType() {
110: return condType;
111: }
112:
113: /* Comment copied from interface. */
114: public String condition() {
115: return condition;
116: }
117:
118: /**
119: * equals() method of this class.
120: * @param o Object to compare
121: * @return <code>true</code>, if the compareTo() method
122: * is 0 for fromAct and toAct
123: */
124: public boolean equals(Object o) {
125: TransitionDefinition e = (TransitionDefinition) o;
126: return pid.equals(e.pid) && id.equals(e.id);
127: }
128:
129: /**
130: * hashCode() method of this class.
131: * @return hashCode
132: */
133: public int hashCode() {
134: return id.hashCode();
135: }
136:
137: /**
138: * @return string represantation of the transition
139: */
140: public String toString() {
141: return "Transition[id=" + id + ",group=" + group + ",order="
142: + order + ",from=" + fromAct + ",to=" + toAct
143: + ",condition: " + condition + "]";
144: }
145:
146: }
|