View Javadoc

1   /*
2    * Copyright 2005-2007 The Kuali Foundation
3    *
4    *
5    * Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in
6    * compliance with the License. You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS
11   * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
12   * language governing permissions and limitations under the License.
13   */
14  package org.kuali.rice.kew.docsearch;
15  
16  import org.kuali.rice.kew.rule.WorkflowAttributeValidationError;
17  import org.kuali.rice.kns.web.ui.Row;
18  
19  import java.io.Serializable;
20  import java.util.Arrays;
21  import java.util.List;
22  import java.util.Map;
23  
24  
25  /**
26   * SearchableAttribute must implement this interface
27   *
28   * @author Kuali Rice Team (rice.collab@kuali.org)
29   */
30  public interface SearchableAttribute extends Serializable {
31  
32      public static final String SEARCH_WILDCARD_CHARACTER = "*";
33      public static final String SEARCH_WILDCARD_CHARACTER_REGEX_ESCAPED = "\\" + SEARCH_WILDCARD_CHARACTER;
34  
35      public static final String DATA_TYPE_STRING = "string";
36      public static final String DATA_TYPE_DATE = "datetime";
37      public static final String DATA_TYPE_LONG = "long";
38      public static final String DATA_TYPE_FLOAT = "float";
39  
40      public static final String DEFAULT_SEARCHABLE_ATTRIBUTE_TYPE_NAME = DATA_TYPE_STRING;
41  
42      public static final String DEFAULT_RANGE_SEARCH_LOWER_BOUND_LABEL = "From";
43      public static final String DEFAULT_RANGE_SEARCH_UPPER_BOUND_LABEL = "To";
44  
45      public static final String RANGE_LOWER_BOUND_PROPERTY_PREFIX = "rangeLowerBoundKeyPrefix_";
46      public static final String RANGE_UPPER_BOUND_PROPERTY_PREFIX = "rangeUpperBoundKeyPrefix_";
47  
48      public static final List SEARCHABLE_ATTRIBUTE_BASE_CLASS_LIST = Arrays.asList(SearchableAttributeStringValue.class, SearchableAttributeFloatValue.class, SearchableAttributeLongValue.class,
49              SearchableAttributeDateTimeValue.class);
50  
51      /**
52       * this gives the xml representation of the attribute; returning a standard java xml object might be a better
53       * approach here
54       *
55       * @param documentSearchContext
56       * @return
57       */
58      public String getSearchContent(DocumentSearchContext documentSearchContext);
59  
60      /**
61       * this will return the loaded data objects for storage in workflow�s database to be related to the document the
62       * attributes xml content was loaded with
63       *
64       * @param documentSearchContext
65       * @return
66       */
67      public List<SearchableAttributeValue> getSearchStorageValues(DocumentSearchContext documentSearchContext);
68  
69      /**
70       * this will return a list of field objects to be rendered in the docsearch interface
71       *
72       * @param documentSearchContext
73       * @return
74       */
75      public List<Row> getSearchingRows(DocumentSearchContext documentSearchContext);
76  
77      /**
78       * this will return a list of error objects if the user has made an input error
79       *
80       * @param paramMap map
81       * @param searchContext document search context
82       * @return list of workflow attribute validation errors
83       */
84      public List<WorkflowAttributeValidationError> validateUserSearchInputs(
85      		Map<Object, Object> paramMap, DocumentSearchContext searchContext);
86  }