1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.docsearch;
17
18 import org.kuali.rice.core.api.uif.DataType;
19 import org.kuali.rice.core.api.uif.RemotableAttributeError;
20 import org.kuali.rice.core.api.uif.RemotableAttributeField;
21 import org.kuali.rice.kew.api.document.DocumentWithContent;
22 import org.kuali.rice.kew.api.document.attribute.DocumentAttribute;
23 import org.kuali.rice.kew.api.document.attribute.DocumentAttributeFactory;
24 import org.kuali.rice.kew.api.document.attribute.WorkflowAttributeDefinition;
25 import org.kuali.rice.kew.api.document.search.DocumentSearchCriteria;
26 import org.kuali.rice.kew.api.extension.ExtensionDefinition;
27 import org.kuali.rice.kew.framework.document.attribute.SearchableAttribute;
28
29 import java.util.ArrayList;
30 import java.util.Collections;
31 import java.util.List;
32
33 public class TestXMLSearchableAttributeString implements SearchableAttribute {
34
35 private static final long serialVersionUID = 7069672825797402460L;
36
37 public static final String SEARCH_STORAGE_KEY = "givenname";
38 public static final String SEARCH_STORAGE_VALUE = "jack";
39
40 @Override
41 public String generateSearchContent(ExtensionDefinition extensionDefinition,
42 String documentTypeName,
43 WorkflowAttributeDefinition attributeDefinition) {
44 return "TestXMLSearchableAttributeString";
45 }
46
47 @Override
48 public List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition,
49 DocumentWithContent documentWithContent) {
50 List<DocumentAttribute> savs = new ArrayList<DocumentAttribute>();
51 savs.add(DocumentAttributeFactory.createStringAttribute(SEARCH_STORAGE_KEY, SEARCH_STORAGE_VALUE));
52 return savs;
53 }
54
55 @Override
56 public List<RemotableAttributeField> getSearchFields(ExtensionDefinition extensionDefinition,
57 String documentTypeName) {
58 List<RemotableAttributeField> fields = new ArrayList<RemotableAttributeField>();
59 RemotableAttributeField.Builder builder = RemotableAttributeField.Builder.create(SEARCH_STORAGE_KEY);
60 builder.setLongLabel("title");
61 builder.setDataType(DataType.STRING);
62 fields.add(builder.build());
63 return fields;
64 }
65
66 @Override
67 public List<RemotableAttributeError> validateDocumentAttributeCriteria(ExtensionDefinition extensionDefinition,
68 DocumentSearchCriteria documentSearchCriteria) {
69 return Collections.emptyList();
70 }
71
72 }