KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > entities > mydesktop > WorkflowStepVO


1 /* ===============================================================================
2 *
3 * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4 *
5 * ===============================================================================
6 *
7 * Copyright (C) Mattias Bogeblad
8 *
9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License version 2, as published by the
11 * Free Software Foundation. See the file LICENSE.html for more information.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19 * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20 *
21 * ===============================================================================
22 */

23
24 package org.infoglue.cms.entities.mydesktop;
25
26 import java.util.ArrayList JavaDoc;
27 import java.util.Collections JavaDoc;
28 import java.util.Date JavaDoc;
29 import java.util.List JavaDoc;
30
31 import org.infoglue.cms.entities.kernel.BaseEntityVO;
32 import org.infoglue.cms.util.ConstraintExceptionBuffer;
33
34 /**
35  * This is the general action description object. Can be used by any workflow engine hopefully.
36  *
37  * @author Mattias Bogeblad
38  */

39
40 public class WorkflowStepVO implements BaseEntityVO
41 {
42     private static final long serialVersionUID = 1L;
43
44     private WorkflowVO workflow;
45     private Long JavaDoc workflowId;
46     private Integer JavaDoc id;
47     private Integer JavaDoc stepId;
48     private String JavaDoc name;
49     private String JavaDoc status;
50     private String JavaDoc owner;
51     private String JavaDoc caller;
52     private Date JavaDoc startDate;
53     private Date JavaDoc finishDate;
54     private List JavaDoc actions = new ArrayList JavaDoc();
55
56     public WorkflowStepVO() {}
57     public WorkflowStepVO(final WorkflowVO workflow)
58     {
59         this.workflow = workflow;
60     }
61     
62     public WorkflowVO getWorkflow()
63     {
64         return this.workflow;
65     }
66     
67     public Integer JavaDoc getId()
68     {
69         return this.id;
70     }
71
72     public void setId(Integer JavaDoc id)
73     {
74         this.id = id;
75     }
76
77     public Long JavaDoc getWorkflowId()
78     {
79         return workflowId;
80     }
81
82     public void setWorkflowId(Long JavaDoc workflowId)
83     {
84         this.workflowId = workflowId;
85     }
86
87     public Integer JavaDoc getStepId()
88     {
89         return this.stepId;
90     }
91
92     public void setStepId(Integer JavaDoc stepId)
93     {
94         this.stepId = stepId;
95     }
96
97     public String JavaDoc getName()
98     {
99         return name;
100     }
101
102     public void setName(String JavaDoc name)
103     {
104         this.name = name;
105     }
106
107     public String JavaDoc getOwner()
108     {
109         return owner;
110     }
111
112     public void setOwner(String JavaDoc owner)
113     {
114         this.owner = owner;
115     }
116
117     public String JavaDoc getCaller()
118     {
119         return caller;
120     }
121
122     public void setCaller(String JavaDoc caller)
123     {
124         this.caller = caller;
125     }
126
127     public Date JavaDoc getFinishDate()
128     {
129         return this.finishDate;
130     }
131
132     public Date JavaDoc getStartDate()
133     {
134         return this.startDate;
135     }
136
137     public String JavaDoc getStatus()
138     {
139         return this.status;
140     }
141
142     public void setFinishDate(Date JavaDoc finishDate)
143     {
144         this.finishDate = finishDate;
145     }
146
147     public void setStartDate(Date JavaDoc startDate)
148     {
149         this.startDate = startDate;
150     }
151
152     public void setStatus(String JavaDoc status)
153     {
154         this.status = status;
155     }
156
157     public List JavaDoc getActions()
158     {
159         return Collections.unmodifiableList(actions);
160     }
161
162     /**
163      * Adds the given action to this step, associating this step with the given action.
164      * @param action a WorkflowActionVO representing a workflow action
165      */

166     public void addAction(WorkflowActionVO action)
167     {
168         if (actions == null)
169             actions = new ArrayList JavaDoc();
170
171         action.setStep(this);
172         actions.add(action);
173     }
174
175     /**
176      * Indicates whether this step has an owner
177      * @return true if owner is not null and owner.length() > 0, otherwise returns false
178      */

179     public boolean hasOwner()
180     {
181         return owner != null && owner.length() > 0;
182     }
183
184     /**
185      * Indicates whether this step is owned by the given user.
186      * @param user a user
187      * @return true if user matches owner, otherwise returns false.
188      */

189     public boolean isOwner(String JavaDoc user)
190     {
191         return (owner == null) ? owner == user : owner.equalsIgnoreCase(user);
192     }
193
194     public ConstraintExceptionBuffer validate()
195     {
196         return new ConstraintExceptionBuffer();
197     }
198
199     public String JavaDoc toString()
200     {
201         return new StringBuffer JavaDoc(getClass().getName())
202                 .append(" stepId=").append(stepId)
203                 .append(" name=").append(name)
204                 .append(" status=").append(status)
205                 .append(" owner=").append(owner)
206                 .append(" caller=").append(caller)
207                 .append(" startDate=").append(startDate)
208                 .append(" finishDate=").append(finishDate)
209                 .append(" id=").append(id)
210                 .append(" workflowId=").append(workflowId).toString();
211     }
212 }
213
Popular Tags