View Javadoc

1   /*
2    * Copyright 2005-2008 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  
18  package org.kuali.rice.kew.docsearch;
19  
20  import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
21  import org.kuali.rice.kew.rule.WorkflowAttributeValidationError;
22  import org.kuali.rice.kns.web.ui.Field;
23  import org.kuali.rice.kns.web.ui.Row;
24  
25  import java.util.ArrayList;
26  import java.util.List;
27  import java.util.Map;
28  
29  
30  public class MockSearchableAttribute implements SearchableAttribute {
31  
32      public String getSearchContent(DocumentSearchContext documentSearchContext) {
33          return "MockSearchableAttribute Search Content";
34      }
35  
36      public List<SearchableAttributeValue> getSearchStorageValues(DocumentSearchContext documentSearchContext) {
37          List<SearchableAttributeValue> savs = new ArrayList<SearchableAttributeValue>();
38          SearchableAttributeValue sav = new SearchableAttributeStringValue();
39          sav.setRouteHeader(new DocumentRouteHeaderValue());
40          sav.setSearchableAttributeKey("MockSearchableAttributeKey");
41          sav.setupAttributeValue("MockSearchableAttributeValue");
42          savs.add(sav);
43          return savs;
44      }
45  
46      public List<Row> getSearchingRows(DocumentSearchContext documentSearchContext) {
47          List<Field> fields = new ArrayList<Field>();
48          Field myField = new Field("MockSearchableAttributeKey","title");
49          myField.setFieldDataType((new SearchableAttributeStringValue()).getAttributeDataType());
50          fields.add(myField);
51          Row row = new Row(fields);
52          List<Row> rows = new ArrayList<Row>();
53          rows.add(row);
54          return rows;
55      }
56  
57      public List<WorkflowAttributeValidationError> validateUserSearchInputs(Map<Object, Object> paramMap, DocumentSearchContext documentSearchContext) {
58          return new ArrayList<WorkflowAttributeValidationError>(0);
59      }
60  }