001: /*
002: * Copyright 2005-2007 The Kuali Foundation.
003: *
004: *
005: * Licensed under the Educational Community License, Version 1.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.opensource.org/licenses/ecl1.php
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package edu.iu.uis.eden.actionitem;
018:
019: import java.sql.Timestamp;
020: import java.util.HashMap;
021: import java.util.Map;
022:
023: import org.apache.commons.beanutils.BeanUtils;
024:
025: import edu.iu.uis.eden.EdenConstants;
026: import edu.iu.uis.eden.KEWServiceLocator;
027: import edu.iu.uis.eden.WorkflowPersistable;
028: import edu.iu.uis.eden.exception.EdenUserNotFoundException;
029: import edu.iu.uis.eden.routeheader.DocumentRouteHeaderValue;
030: import edu.iu.uis.eden.user.WorkflowUser;
031: import edu.iu.uis.eden.user.WorkflowUserId;
032: import edu.iu.uis.eden.util.CodeTranslator;
033: import edu.iu.uis.eden.web.RowStyleable;
034: import edu.iu.uis.eden.workgroup.WorkflowGroupId;
035: import edu.iu.uis.eden.workgroup.Workgroup;
036:
037: /**
038: * This is the model for action items. These are displayed as the action list as well. Mapped to ActionItemService.
039: *
040: * @author rkirkend
041: * @author ewestfal
042: *
043: */
044: public class ActionItem implements WorkflowPersistable, RowStyleable {
045:
046: private static final long serialVersionUID = -1079562205125660151L;
047:
048: private Long actionItemId;
049: private String workflowId;
050: private Timestamp dateAssigned;
051: private String actionRequestCd;
052: private Long actionRequestId;
053: private Long routeHeaderId;
054: private Long workgroupId;
055: private String docTitle;
056: private String docLabel;
057: private String docHandlerURL;
058: private Integer lockVerNbr;
059: private String docName;
060: private Long responsibilityId = new Long(1);
061: private String rowStyleClass;
062: private String roleName;
063: private String delegatorWorkflowId;
064: private Long delegatorWorkgroupId;
065: private String dateAssignedString;
066: private String actionToTake;
067: private String delegationType;
068: private Integer actionItemIndex;
069: private Map customActions = new HashMap();
070:
071: private transient DocumentRouteHeaderValue routeHeader;
072:
073: public Workgroup getWorkgroup() throws EdenUserNotFoundException {
074: return KEWServiceLocator.getWorkgroupService().getWorkgroup(
075: new WorkflowGroupId(workgroupId));
076: }
077:
078: public WorkflowUser getUser() throws EdenUserNotFoundException {
079: return KEWServiceLocator.getUserService().getWorkflowUser(
080: new WorkflowUserId(workflowId));
081: }
082:
083: public String getRecipientTypeCode() {
084: String recipientTypeCode = EdenConstants.ACTION_REQUEST_USER_RECIPIENT_CD;
085: if (getRoleName() != null) {
086: recipientTypeCode = EdenConstants.ACTION_REQUEST_ROLE_RECIPIENT_CD;
087: }
088: if (getWorkgroupId() != null) {
089: recipientTypeCode = EdenConstants.ACTION_REQUEST_WORKGROUP_RECIPIENT_CD;
090: }
091: return recipientTypeCode;
092: }
093:
094: public boolean isWorkgroupItem() {
095: return getWorkgroupId() != null;
096: }
097:
098: public Object copy(boolean preserveKeys) {
099: ActionItem clone = new ActionItem();
100: try {
101: BeanUtils.copyProperties(clone, this );
102: } catch (Exception e) {
103: throw new RuntimeException(e);
104: }
105:
106: return clone;
107: }
108:
109: public void setRowStyleClass(String rowStyleClass) {
110: this .rowStyleClass = rowStyleClass;
111: }
112:
113: public String getRowStyleClass() {
114: return rowStyleClass;
115: }
116:
117: public Long getResponsibilityId() {
118: return responsibilityId;
119: }
120:
121: public void setResponsibilityId(Long responsibilityId) {
122: this .responsibilityId = responsibilityId;
123: }
124:
125: public String getDocName() {
126: return docName;
127: }
128:
129: public void setDocName(String docName) {
130: this .docName = docName;
131: }
132:
133: public String getActionRequestLabel() {
134: return CodeTranslator
135: .getActionRequestLabel(getActionRequestCd());
136: }
137:
138: public DocumentRouteHeaderValue getRouteHeader() {
139: return routeHeader;
140: }
141:
142: public void setRouteHeader(DocumentRouteHeaderValue routeHeader) {
143: this .routeHeader = routeHeader;
144: }
145:
146: public String getActionRequestCd() {
147: return actionRequestCd;
148: }
149:
150: public void setActionRequestCd(String actionRequestCd) {
151: this .actionRequestCd = actionRequestCd;
152: }
153:
154: public Timestamp getDateAssigned() {
155: return dateAssigned;
156: }
157:
158: public void setDateAssigned(Timestamp dateAssigned) {
159: this .dateAssigned = dateAssigned;
160: }
161:
162: public String getWorkflowId() {
163: return workflowId;
164: }
165:
166: public void setWorkflowId(String workflowId) {
167: this .workflowId = workflowId;
168: }
169:
170: public Integer getLockVerNbr() {
171: return lockVerNbr;
172: }
173:
174: public void setLockVerNbr(Integer lockVerNbr) {
175: this .lockVerNbr = lockVerNbr;
176: }
177:
178: public Long getRouteHeaderId() {
179: return routeHeaderId;
180: }
181:
182: public void setRouteHeaderId(Long routeHeaderId) {
183: this .routeHeaderId = routeHeaderId;
184: }
185:
186: public Long getActionItemId() {
187: return actionItemId;
188: }
189:
190: public void setActionItemId(Long actionItemId) {
191: this .actionItemId = actionItemId;
192: }
193:
194: public Long getActionRequestId() {
195: return actionRequestId;
196: }
197:
198: public void setActionRequestId(Long actionRequestId) {
199: this .actionRequestId = actionRequestId;
200: }
201:
202: public String getDocHandlerURL() {
203: return docHandlerURL;
204: }
205:
206: public void setDocHandlerURL(String docHandlerURL) {
207: this .docHandlerURL = docHandlerURL;
208: }
209:
210: public Long getWorkgroupId() {
211: return workgroupId;
212: }
213:
214: public void setWorkgroupId(Long workgroupId) {
215: this .workgroupId = workgroupId;
216: }
217:
218: public String getDocLabel() {
219: return docLabel;
220: }
221:
222: public void setDocLabel(String docLabel) {
223: this .docLabel = docLabel;
224: }
225:
226: public String getDocTitle() {
227: return docTitle;
228: }
229:
230: public void setDocTitle(String docTitle) {
231: this .docTitle = docTitle;
232: }
233:
234: public String getRoleName() {
235: return roleName;
236: }
237:
238: public void setRoleName(String roleName) {
239: this .roleName = roleName;
240: }
241:
242: public String getDelegatorWorkflowId() {
243: return delegatorWorkflowId;
244: }
245:
246: public void setDelegatorWorkflowId(String delegatorWorkflowId) {
247: this .delegatorWorkflowId = delegatorWorkflowId;
248: }
249:
250: public Long getDelegatorWorkgroupId() {
251: return delegatorWorkgroupId;
252: }
253:
254: public void setDelegatorWorkgroupId(Long delegatorWorkgroupId) {
255: this .delegatorWorkgroupId = delegatorWorkgroupId;
256: }
257:
258: public String getDateAssignedString() {
259: if (dateAssignedString == null
260: || dateAssignedString.trim().equals("")) {
261: return EdenConstants.getDefaultDateFormat().format(
262: getDateAssigned());
263: } else {
264: return dateAssignedString;
265: }
266: }
267:
268: public void setDateAssignedString(String dateAssignedString) {
269: this .dateAssignedString = dateAssignedString;
270: }
271:
272: public String getActionToTake() {
273: return actionToTake;
274: }
275:
276: public void setActionToTake(String actionToTake) {
277: this .actionToTake = actionToTake;
278: }
279:
280: public Integer getActionItemIndex() {
281: return actionItemIndex;
282: }
283:
284: public void setActionItemIndex(Integer actionItemIndex) {
285: this .actionItemIndex = actionItemIndex;
286: }
287:
288: public Map getCustomActions() {
289: return customActions;
290: }
291:
292: public void setCustomActions(Map customActions) {
293: this .customActions = customActions;
294: }
295:
296: public String getDelegationType() {
297: return delegationType;
298: }
299:
300: public void setDelegationType(String delegationType) {
301: this.delegationType = delegationType;
302: }
303:
304: }
|