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