001: /*
002: * JBoss, Home of Professional Open Source
003: * Copyright 2005, JBoss Inc., and individual contributors as indicated
004: * by the @authors tag. See the copyright.txt in the distribution for a
005: * full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jbpm.taskmgmt.def;
023:
024: import java.io.*;
025: import java.util.*;
026:
027: import org.jbpm.instantiation.*;
028: import org.jbpm.util.EqualsUtil;
029:
030: /**
031: * is a process role (aka participant).
032: */
033: public class Swimlane implements Serializable {
034:
035: private static final long serialVersionUID = 1L;
036:
037: long id = 0;
038: protected String name = null;
039: protected String actorIdExpression = null;
040: protected String pooledActorsExpression = null;
041: protected Delegation assignmentDelegation = null;
042: protected TaskMgmtDefinition taskMgmtDefinition = null;
043: protected Set tasks = null;
044:
045: public Swimlane() {
046: }
047:
048: public Swimlane(String name) {
049: this .name = name;
050: }
051:
052: /**
053: * sets the taskMgmtDefinition unidirectionally. use TaskMgmtDefinition.addSwimlane to create
054: * a bidirectional relation.
055: */
056: public void setTaskMgmtDefinition(
057: TaskMgmtDefinition taskMgmtDefinition) {
058: this .taskMgmtDefinition = taskMgmtDefinition;
059: }
060:
061: // tasks ////////////////////////////////////////////////////////////////////
062:
063: public void addTask(Task task) {
064: if (tasks == null)
065: tasks = new HashSet();
066: tasks.add(task);
067: task.setSwimlane(this );
068: }
069:
070: public Set getTasks() {
071: return tasks;
072: }
073:
074: // equals ///////////////////////////////////////////////////////////////////
075: // hack to support comparing hibernate proxies against the real objects
076: // since this always falls back to ==, we don't need to overwrite the hashcode
077: public boolean equals(Object o) {
078: return EqualsUtil.equals(this , o);
079: }
080:
081: public void setActorIdExpression(String actorIdExpression) {
082: this .actorIdExpression = actorIdExpression;
083: // Note: combination of actorIdExpression and pooledActorsExpression is allowed
084: // this.pooledActorsExpression = null;
085: this .assignmentDelegation = null;
086: }
087:
088: public void setPooledActorsExpression(String pooledActorsExpression) {
089: // Note: combination of actorIdExpression and pooledActorsExpression is allowed
090: // this.actorIdExpression = null;
091: this .pooledActorsExpression = pooledActorsExpression;
092: this .assignmentDelegation = null;
093: }
094:
095: public void setAssignmentDelegation(Delegation assignmentDelegation) {
096: // assignment expressions and assignmentDelegation are mutually exclusive
097: this .actorIdExpression = null;
098: this .pooledActorsExpression = null;
099: this .assignmentDelegation = assignmentDelegation;
100: }
101:
102: // getters and setters //////////////////////////////////////////////////////
103:
104: public TaskMgmtDefinition getTaskMgmtDefinition() {
105: return taskMgmtDefinition;
106: }
107:
108: public String getActorIdExpression() {
109: return actorIdExpression;
110: }
111:
112: public String getPooledActorsExpression() {
113: return pooledActorsExpression;
114: }
115:
116: public Delegation getAssignmentDelegation() {
117: return assignmentDelegation;
118: }
119:
120: public String getName() {
121: return name;
122: }
123:
124: public long getId() {
125: return id;
126: }
127: }
|