01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.php
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package edu.iu.uis.eden.docsearch;
18:
19: import java.util.ArrayList;
20: import java.util.HashSet;
21: import java.util.Iterator;
22: import java.util.List;
23: import java.util.Set;
24:
25: import edu.iu.uis.eden.web.KeyValueSort;
26:
27: /**
28: *
29: * @author delyea
30: */
31: public class DocumentSearchResult {
32:
33: public static final String PROPERTY_NAME_ROUTE_HEADER_ID = "routeHeaderId";
34: public static final String PROPERTY_NAME_DOC_TYPE_LABEL = "docTypeLabel";
35: public static final String PROPERTY_NAME_DOCUMENT_TITLE = "documentTitle";
36: public static final String PROPERTY_NAME_ROUTE_STATUS_DESC = "docRouteStatusCodeDesc";
37: public static final String PROPERTY_NAME_INITIATOR = "initiator";
38: public static final String PROPERTY_NAME_DATE_CREATED = "dateCreated";
39: public static final String PROPERTY_NAME_ROUTE_LOG = "routeLog";
40:
41: public static final Set<String> PROPERTY_NAME_SET = new HashSet<String>();
42: static {
43: PROPERTY_NAME_SET.add(PROPERTY_NAME_ROUTE_HEADER_ID);
44: PROPERTY_NAME_SET.add(PROPERTY_NAME_DOC_TYPE_LABEL);
45: PROPERTY_NAME_SET.add(PROPERTY_NAME_DOCUMENT_TITLE);
46: PROPERTY_NAME_SET.add(PROPERTY_NAME_ROUTE_STATUS_DESC);
47: PROPERTY_NAME_SET.add(PROPERTY_NAME_INITIATOR);
48: PROPERTY_NAME_SET.add(PROPERTY_NAME_DATE_CREATED);
49: PROPERTY_NAME_SET.add(PROPERTY_NAME_ROUTE_LOG);
50: }
51:
52: private List<KeyValueSort> resultContainers = new ArrayList<KeyValueSort>();
53:
54: /**
55: * @return the resultContainers
56: */
57: public List<KeyValueSort> getResultContainers() {
58: return resultContainers;
59: }
60:
61: /**
62: * @param resultContainers the resultContainers to set
63: */
64: public void setResultContainers(List<KeyValueSort> resultContainers) {
65: this .resultContainers = resultContainers;
66: }
67:
68: /**
69: * @param result - a KeyValueSort object to add to the list
70: */
71: public void addResultContainer(KeyValueSort result) {
72: this .resultContainers.add(result);
73: }
74:
75: /**
76: * Method for the JSP to use to pull in a search result by name
77: * instead of by index location which is unreliable
78: *
79: * @param key - Key of KeyLabelSort trying to be retrieved
80: * @return the matching KeyLabelSort in list of searchable attributes or an empty KeyLabelSort
81: */
82: public KeyValueSort getResultContainer(String key) {
83: if (key != null) {
84: for (Iterator iter = resultContainers.iterator(); iter
85: .hasNext();) {
86: KeyValueSort pair = (KeyValueSort) iter.next();
87: if (key.equals((String) pair.getKey())) {
88: return pair;
89: }
90: }
91: }
92: return new KeyValueSort();
93: }
94: }
|