View Javadoc

1   /*
2    * Copyright 2005-2007 The Kuali Foundation
3    * 
4    * 
5    * Licensed under the Educational Community License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    * 
9    * http://www.opensource.org/licenses/ecl2.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 org.kuali.rice.kew.docsearch;
18  
19  import org.kuali.rice.kew.util.KEWPropertyConstants;
20  import org.kuali.rice.kew.web.KeyValueSort;
21  
22  import java.io.Serializable;
23  import java.util.ArrayList;
24  import java.util.List;
25  import java.util.Set;
26  
27  
28  /**
29   *
30   * @author Kuali Rice Team (rice.collab@kuali.org)
31   */
32  public class DocumentSearchResult implements Serializable {
33      private static final long serialVersionUID = -1255359695353320685L;
34      
35  	// following much match documentation for XML result processor attribute
36      /**
37       *@deprecated - USE {@link KEWPropertyConstants#DOC_SEARCH_RESULT_PROPERTY_NAME_ROUTE_HEADER_ID} INSTEAD
38       */
39      public static final String PROPERTY_NAME_ROUTE_HEADER_ID = KEWPropertyConstants.DOC_SEARCH_RESULT_PROPERTY_NAME_ROUTE_HEADER_ID;
40      /**
41       *@deprecated - USE {@link KEWPropertyConstants#DOC_SEARCH_RESULT_PROPERTY_NAME_DOC_TYPE_LABEL} INSTEAD
42       */
43      public static final String PROPERTY_NAME_DOC_TYPE_LABEL = KEWPropertyConstants.DOC_SEARCH_RESULT_PROPERTY_NAME_DOC_TYPE_LABEL;
44      /**
45       *@deprecated - USE {@link KEWPropertyConstants#DOC_SEARCH_RESULT_PROPERTY_NAME_DOCUMENT_TITLE} INSTEAD
46       */
47      public static final String PROPERTY_NAME_DOCUMENT_TITLE = KEWPropertyConstants.DOC_SEARCH_RESULT_PROPERTY_NAME_DOCUMENT_TITLE;
48      /**
49       *@deprecated - USE {@link KEWPropertyConstants#DOC_SEARCH_RESULT_PROPERTY_NAME_ROUTE_STATUS_DESC} INSTEAD
50       */
51      public static final String PROPERTY_NAME_ROUTE_STATUS_DESC = KEWPropertyConstants.DOC_SEARCH_RESULT_PROPERTY_NAME_ROUTE_STATUS_DESC; 
52      /**
53       *@deprecated - USE {@link KEWPropertyConstants#DOC_SEARCH_RESULT_PROPERTY_NAME_INITIATOR} INSTEAD
54       */
55  	public static final String PROPERTY_NAME_INITIATOR = KEWPropertyConstants.DOC_SEARCH_RESULT_PROPERTY_NAME_INITIATOR;
56      /**
57       *@deprecated - USE {@link KEWPropertyConstants#DOC_SEARCH_RESULT_PROPERTY_NAME_DATE_CREATED} INSTEAD
58       */
59  	public static final String PROPERTY_NAME_DATE_CREATED = KEWPropertyConstants.DOC_SEARCH_RESULT_PROPERTY_NAME_DATE_CREATED;
60      /**
61       *@deprecated - USE {@link KEWPropertyConstants#DOC_SEARCH_RESULT_PROPERTY_NAME_ROUTE_LOG} INSTEAD
62       */
63  	public static final String PROPERTY_NAME_ROUTE_LOG = KEWPropertyConstants.DOC_SEARCH_RESULT_PROPERTY_NAME_ROUTE_LOG;
64  	
65      /**
66       *@deprecated - USE {@link KEWPropertyConstants#DOC_SEARCH_RESULT_PROPERTY_NAME_SET} INSTEAD
67       */
68  	public static final Set<String> PROPERTY_NAME_SET = KEWPropertyConstants.DOC_SEARCH_RESULT_PROPERTY_NAME_SET;
69  	
70  	private List<KeyValueSort> resultContainers = new ArrayList<KeyValueSort>();
71  
72  	/**
73  	 * @return the resultContainers
74  	 */
75  	public List<KeyValueSort> getResultContainers() {
76  		return resultContainers;
77  	}
78  
79  	/**
80  	 * @param resultContainers the resultContainers to set
81  	 */
82  	public void setResultContainers(List<KeyValueSort> resultContainers) {
83  		this.resultContainers = resultContainers;
84  	}
85  
86  	/**
87  	 * @param result - a KeyValueSort object to add to the list 
88  	 */
89  	public void addResultContainer(KeyValueSort result) {
90  		this.resultContainers.add(result);
91  	}
92  	
93      /**
94       * Method for the JSP to use to pull in a search result by name
95       * instead of by index location which is unreliable
96       * 
97       * @param key - Key of KeyLabelSort trying to be retrieved
98       * @return  the matching KeyLabelSort in list of searchable attributes or an empty KeyLabelSort
99       */
100     public KeyValueSort getResultContainer(String key) {
101     	if (key != null) {
102             for (KeyValueSort resultContainer : resultContainers)
103             {
104                 if (key.equals(resultContainer.getKey()))
105                 {
106                     return resultContainer;
107                 }
108             }
109     	}
110     	return new KeyValueSort();
111     }
112 }