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.docsearch;
018:
019: import java.io.Serializable;
020: import java.util.ArrayList;
021: import java.util.Iterator;
022: import java.util.List;
023:
024: import edu.iu.uis.eden.clientapp.IDocHandler;
025: import edu.iu.uis.eden.web.KeyValueSort;
026: import edu.iu.uis.eden.web.RowStyleable;
027:
028: /**
029: * Bean that representing a row displayed in a document search.
030: *
031: * @author rkirkend
032: */
033: public class DocSearchVO implements Serializable, RowStyleable {
034:
035: private static final long serialVersionUID = 7850758046316186962L;
036: private static String UNKNOWN_ROUTING_STATUS = "UNKNOWN";
037: private static final String URL_SUFFIX = "?"
038: + IDocHandler.COMMAND_PARAMETER + "="
039: + IDocHandler.DOCSEARCH_COMMAND + "&"
040: + IDocHandler.ROUTEHEADER_ID_PARAMETER + "=";
041: private static final String ROUTE_LOG_URL = "EdenServices/GetRouteHeader.do?docId=";
042:
043: private Long routeHeaderId;
044: private String docRouteStatusCode;
045: private java.sql.Timestamp dateCreated;
046: private String documentTitle;
047: private String activeIndicatorCode;
048: private String docTypeLabel;
049: private String initiatorNetworkId;
050: private String initiatorWorkflowId;
051: private String initiatorName;
052: private String initiatorEmailAddress;
053: private String initiatorLastName;
054: private String initiatorFirstName;
055: private String initiatorTransposedName;
056: private String docTypeHandlerUrl;
057: private String rowStyleClass;
058: private String super UserSearch;
059:
060: private List searchableAttributes = new ArrayList();
061:
062: public DocSearchVO() {
063: }
064:
065: public String getSuperUserSearch() {
066: return super UserSearch;
067: }
068:
069: public void setSuperUserSearch(String super UserSearch) {
070: this .super UserSearch = super UserSearch;
071: }
072:
073: public String getDocRouteStatusCode() {
074: return docRouteStatusCode;
075: }
076:
077: public String getDocumentTitle() {
078: return documentTitle;
079: }
080:
081: public Long getRouteHeaderId() {
082: return routeHeaderId;
083: }
084:
085: public void setDocRouteStatusCode(String docRouteStatusCode) {
086: this .docRouteStatusCode = docRouteStatusCode;
087: }
088:
089: public void setDocumentTitle(String documentTitle) {
090: this .documentTitle = documentTitle;
091: }
092:
093: public void setRouteHeaderId(Long routeHeaderId) {
094: this .routeHeaderId = routeHeaderId;
095: }
096:
097: public String getActiveIndicatorCode() {
098: return activeIndicatorCode;
099: }
100:
101: public String getDocTypeLabel() {
102: return docTypeLabel;
103: }
104:
105: public String getDocTypeHandlerUrl() {
106: return docTypeHandlerUrl;
107: }
108:
109: public String getInitiatorWorkflowId() {
110: return initiatorWorkflowId;
111: }
112:
113: public String getInitiatorEmailAddress() {
114: return initiatorEmailAddress;
115: }
116:
117: public String getInitiatorName() {
118: return initiatorName;
119: }
120:
121: public void setActiveIndicatorCode(String activeIndicatorCode) {
122: this .activeIndicatorCode = activeIndicatorCode;
123: }
124:
125: public void setDocTypeLabel(String docTypeLabel) {
126: this .docTypeLabel = docTypeLabel;
127: }
128:
129: public void setDocTypeHandlerUrl(String docTypeHandlerUrl) {
130: this .docTypeHandlerUrl = docTypeHandlerUrl;
131: }
132:
133: public void setInitiatorWorkflowId(String initiatorEmplId) {
134: this .initiatorWorkflowId = initiatorEmplId;
135: }
136:
137: public void setInitiatorEmailAddress(String initiatorEmailAddress) {
138: this .initiatorEmailAddress = initiatorEmailAddress;
139: }
140:
141: public void setInitiatorName(String initiatorName) {
142: this .initiatorName = initiatorName;
143: }
144:
145: public java.sql.Timestamp getDateCreated() {
146: return dateCreated;
147: }
148:
149: public void setDateCreated(java.sql.Timestamp dateCreated) {
150: this .dateCreated = dateCreated;
151: }
152:
153: public String getInitiatorNetworkId() {
154: return initiatorNetworkId;
155: }
156:
157: public void setInitiatorNetworkId(String string) {
158: initiatorNetworkId = string;
159: }
160:
161: public String getInitiatorFirstName() {
162: return initiatorFirstName;
163: }
164:
165: public String getInitiatorLastName() {
166: return initiatorLastName;
167: }
168:
169: public void setInitiatorFirstName(String initiatorFirstName) {
170: this .initiatorFirstName = initiatorFirstName;
171: }
172:
173: public void setInitiatorLastName(String initiatorLastName) {
174: this .initiatorLastName = initiatorLastName;
175: }
176:
177: public String getDocRouteStatusCodeDesc() {
178: if (this .docRouteStatusCode == null
179: || edu.iu.uis.eden.util.CodeTranslator
180: .getRouteStatusLabel(docRouteStatusCode) == null
181: || ""
182: .equalsIgnoreCase(edu.iu.uis.eden.util.CodeTranslator
183: .getRouteStatusLabel(docRouteStatusCode))) {
184: return UNKNOWN_ROUTING_STATUS;
185: } else {
186: return edu.iu.uis.eden.util.CodeTranslator
187: .getRouteStatusLabel(docRouteStatusCode);
188: }
189: }
190:
191: public String getDocHandlerUrl() {
192: if ("".equals(getDocTypeHandlerUrl())) {
193: return "";
194: } else {
195: if (isUsingSuperUserSearch()) {
196: return "SuperUser.do?command=displayFrame&routeHeaderId="
197: + this .getRouteHeaderId().toString();
198: } else {
199: return this .getDocTypeHandlerUrl() + URL_SUFFIX
200: + this .getRouteHeaderId().toString();
201: }
202: }
203: }
204:
205: public boolean isUsingSuperUserSearch() {
206: return "YES".equalsIgnoreCase(super UserSearch);
207: }
208:
209: public String getRouteLogUrl() {
210: return ROUTE_LOG_URL + this .routeHeaderId.toString();
211: }
212:
213: public String getRowStyleClass() {
214: return rowStyleClass;
215: }
216:
217: public void setRowStyleClass(String rowStyleClass) {
218: this .rowStyleClass = rowStyleClass;
219: }
220:
221: public String getInitiatorTransposedName() {
222: return initiatorTransposedName;
223: }
224:
225: public void setInitiatorTransposedName(
226: String initiatorTransposedName) {
227: this .initiatorTransposedName = initiatorTransposedName;
228: }
229:
230: /**
231: * Method for the JSP to use to pull in searchable attributes by name
232: * instead of by index location which is unreliable
233: *
234: * @param key Key of KeyValueSort trying to be retrieved
235: * @return the matching KeyValueSort in list of searchable attributes or an empty KeyValueSort
236: */
237: public KeyValueSort getSearchableAttribute(String key) {
238: KeyValueSort returnPair = new KeyValueSort("", "", "", null);
239: if (key == null) {
240: return returnPair;
241: }
242: for (Iterator iter = searchableAttributes.iterator(); iter
243: .hasNext();) {
244: KeyValueSort pair = (KeyValueSort) iter.next();
245: if (key.equals((String) pair.getKey())) {
246: returnPair = pair;
247: break;
248: }
249: }
250: return returnPair;
251: }
252:
253: public void addSearchableAttribute(KeyValueSort searchableAttribute) {
254: searchableAttributes.add(searchableAttribute);
255: }
256:
257: /**
258: * @param searchableAttributes The searchableAttributes to set.
259: */
260: public void setSearchableAttributes(List searchableAttributes) {
261: this .searchableAttributes = searchableAttributes;
262: }
263:
264: /**
265: * @return Returns the searchableAttributes.
266: */
267: public List getSearchableAttributes() {
268: return searchableAttributes;
269: }
270: }
|