001: /*
002: * Copyright 2005-2006 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.clientapp.vo;
018:
019: import java.io.Serializable;
020: import java.util.ArrayList;
021: import java.util.Calendar;
022: import java.util.Iterator;
023: import java.util.List;
024:
025: import org.apache.log4j.Logger;
026:
027: import edu.iu.uis.eden.engine.node.KeyValuePair;
028: import edu.iu.uis.eden.routeheader.DocumentRouteHeaderValue;
029: import edu.iu.uis.eden.util.Utilities;
030:
031: /**
032: * Transport object for the {@link DocumentRouteHeaderValue}. Represents a document to the
033: * client programmer
034: *
035: * @author rkirkend
036: * @author ewestfal
037: *
038: * @workflow.webservice-object
039: */
040: public class RouteHeaderVO implements Serializable {
041: private static final Logger LOG = Logger
042: .getLogger(RouteHeaderVO.class);
043:
044: static final long serialVersionUID = -677289794727007572L;
045:
046: private Long routeHeaderId;
047: private String docRouteStatus;
048: private Calendar dateCreated;
049: private Calendar dateLastModified;
050: private Calendar dateApproved;
051: private Calendar dateFinalized;
052: //private String docContent;
053: private String docTitle;
054: private String appDocId;
055: private String overrideInd;
056: private UserVO initiator;
057: private UserVO routedByUser;
058: private Integer docRouteLevel;
059: //private String[] nodeNames;
060: private String currentRouteNodeNames;
061: private Integer docVersion;
062: /**
063: * @deprecated this is unreliable user docTypeId to retrieve document type
064: */
065: private String docTypeName;
066: private String documentUrl;
067: private boolean fyiRequested;
068: private boolean ackRequested;
069: private boolean approveRequested;
070: private boolean completeRequested;
071: private boolean userBlanketApprover;
072: private Long docTypeId;
073: //private DocumentContentVO documentContent = new DocumentContentVO();
074: private ValidActionsVO validActions;
075:
076: //** Modify for adding notes to web service. Modify Date: April 7, 2006
077: private NoteVO[] notes = null;
078: private NoteVO[] notesToDelete = null;
079: //** Modify ends
080:
081: /**
082: * Probably needs to be an array for web services
083: */
084: private List variables = new ArrayList();
085:
086: public RouteHeaderVO() {
087: }
088:
089: public String getCurrentRouteNodeNames() {
090: return currentRouteNodeNames;
091: }
092:
093: public void setCurrentRouteNodeNames(String currentRouteNodeNames) {
094: this .currentRouteNodeNames = currentRouteNodeNames;
095: }
096:
097: public String getAppDocId() {
098: return appDocId;
099: }
100:
101: public void setAppDocId(String appDocId) {
102: this .appDocId = appDocId;
103: }
104:
105: public Calendar getDateApproved() {
106: return dateApproved;
107: }
108:
109: public void setDateApproved(Calendar dateApproved) {
110: this .dateApproved = dateApproved;
111: }
112:
113: public Calendar getDateCreated() {
114: return dateCreated;
115: }
116:
117: public void setDateCreated(Calendar dateCreated) {
118: this .dateCreated = dateCreated;
119: }
120:
121: public Calendar getDateFinalized() {
122: return dateFinalized;
123: }
124:
125: public void setDateFinalized(Calendar dateFinalized) {
126: this .dateFinalized = dateFinalized;
127: }
128:
129: public Calendar getDateLastModified() {
130: return dateLastModified;
131: }
132:
133: public void setDateLastModified(Calendar dateLastModified) {
134: this .dateLastModified = dateLastModified;
135: }
136:
137: public Integer getDocRouteLevel() {
138: return docRouteLevel;
139: }
140:
141: public void setDocRouteLevel(Integer docRouteLevel) {
142: this .docRouteLevel = docRouteLevel;
143: }
144:
145: public String getDocRouteStatus() {
146: return docRouteStatus;
147: }
148:
149: public void setDocRouteStatus(String docRouteStatus) {
150: this .docRouteStatus = docRouteStatus;
151: }
152:
153: public String getDocTitle() {
154: return docTitle;
155: }
156:
157: public void setDocTitle(String docTitle) {
158: this .docTitle = docTitle;
159: }
160:
161: /**
162: * @deprecated this is unreliable user docTypeId to retrieve document type
163: */
164: public String getDocTypeName() {
165: return docTypeName;
166: }
167:
168: /**
169: * @deprecated this is unreliable user docTypeId to retrieve document type
170: */
171: public void setDocTypeName(String docTypeName) {
172: this .docTypeName = docTypeName;
173: }
174:
175: public String getDocumentUrl() {
176: return documentUrl;
177: }
178:
179: public void setDocumentUrl(String documentUrl) {
180: this .documentUrl = documentUrl;
181: }
182:
183: public Integer getDocVersion() {
184: return docVersion;
185: }
186:
187: public void setDocVersion(Integer docVersion) {
188: this .docVersion = docVersion;
189: }
190:
191: public UserVO getInitiator() {
192: return initiator;
193: }
194:
195: public void setInitiator(UserVO initiator) {
196: this .initiator = initiator;
197: }
198:
199: public UserVO getRoutedByUser() {
200: return routedByUser;
201: }
202:
203: public void setRoutedByUser(UserVO routedByUser) {
204: this .routedByUser = routedByUser;
205: }
206:
207: public String getOverrideInd() {
208: return overrideInd;
209: }
210:
211: public void setOverrideInd(String overrideInd) {
212: this .overrideInd = overrideInd;
213: }
214:
215: public Long getRouteHeaderId() {
216: return routeHeaderId;
217: }
218:
219: public void setRouteHeaderId(Long routeHeaderId) {
220: this .routeHeaderId = routeHeaderId;
221: }
222:
223: public boolean isAckRequested() {
224: return ackRequested;
225: }
226:
227: public void setAckRequested(boolean ackRequested) {
228: this .ackRequested = ackRequested;
229: }
230:
231: public boolean isApproveRequested() {
232: return approveRequested;
233: }
234:
235: public void setApproveRequested(boolean approveRequested) {
236: this .approveRequested = approveRequested;
237: }
238:
239: public boolean isCompleteRequested() {
240: return completeRequested;
241: }
242:
243: public void setCompleteRequested(boolean completeRequested) {
244: this .completeRequested = completeRequested;
245: }
246:
247: public boolean isFyiRequested() {
248: return fyiRequested;
249: }
250:
251: public void setFyiRequested(boolean fyiRequested) {
252: this .fyiRequested = fyiRequested;
253: }
254:
255: public boolean isUserBlanketApprover() {
256: return userBlanketApprover;
257: }
258:
259: public void setUserBlanketApprover(boolean userBlanketApprover) {
260: this .userBlanketApprover = userBlanketApprover;
261: }
262:
263: public Long getDocTypeId() {
264: return docTypeId;
265: }
266:
267: public void setDocTypeId(Long docTypeId) {
268: this .docTypeId = docTypeId;
269: }
270:
271: // ** Modify for adding notes to web service. Modify Date: April 7, 2006
272: public NoteVO[] getNotes() {
273: return notes;
274: }
275:
276: public void setNotes(NoteVO[] notes) {
277: this .notes = notes;
278: }
279:
280: public NoteVO[] getNotesToDelete() {
281: return notesToDelete;
282: }
283:
284: public void setNotesToDelete(NoteVO[] notesToDelete) {
285: this .notesToDelete = notesToDelete;
286: }
287:
288: // ** Modify Ends
289:
290: private KeyValuePair findVariable(String name) {
291: Iterator it = variables.iterator();
292: while (it.hasNext()) {
293: KeyValuePair kvp = (KeyValuePair) it.next();
294: if (Utilities.equals(kvp.getKey(), name)) {
295: return kvp;
296: }
297: }
298: return null;
299: }
300:
301: public String getVariable(String name) {
302: KeyValuePair kvp = findVariable(name);
303: if (kvp == null)
304: return null;
305: return kvp.getValue();
306: }
307:
308: public void setVariable(String name, String value) {
309: KeyValuePair kvp = findVariable(name);
310: LOG.debug("# variables: " + variables.size());
311: if (kvp == null) {
312: if (value == null) {
313: LOG.debug("null value set for variable: " + name);
314: return;
315: }
316: LOG
317: .debug("adding variable: '" + name + "'='" + value
318: + "'");
319: kvp = new KeyValuePair();
320: kvp.setKey(name);
321: kvp.setValue(value);
322: variables.add(kvp);
323: } else {
324: // values do not need to be removed from the VO
325: // in fact they CAN'T be, as the DocumentRouteHeaderValue
326: // must observe the null value so the removal actually
327: // propagates (otherwise DocumentRouteHeaderValue can't
328: // guess what you wanted to remove...the alternative is
329: // to just reset all the vars wholesale but that requires
330: // a slightly more complicated implementation (to distinguish
331: // non-variable state in the state table) and is fraught
332: // with peril in general)
333: //if (value == null) {
334: // LOG.error("Removing value: " + kvp.getKey() + "=" + kvp.getValue());
335: // variables.remove(kvp);
336: //} else {
337: LOG.debug("setting variable '" + name + "' to value '"
338: + value + "'");
339: kvp.setValue(value);
340: //}
341: }
342: }
343:
344: public List getVariables() {
345: return variables;
346: }
347:
348: public ValidActionsVO getValidActions() {
349: return validActions;
350: }
351:
352: public void setValidActions(ValidActionsVO validActions) {
353: this.validActions = validActions;
354: }
355: }
|