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 java.util.ArrayList;
19 import java.util.Collections;
20 import java.util.List;
21
22 import org.kuali.rice.core.api.data.DataType;
23 import org.kuali.rice.core.api.uif.RemotableAttributeError;
24 import org.kuali.rice.core.api.uif.RemotableAttributeField;
25 import org.kuali.rice.kew.api.document.DocumentWithContent;
26 import org.kuali.rice.kew.api.document.attribute.DocumentAttribute;
27 import org.kuali.rice.kew.api.document.attribute.DocumentAttributeFactory;
28 import org.kuali.rice.kew.api.document.attribute.WorkflowAttributeDefinition;
29 import org.kuali.rice.kew.api.document.search.DocumentSearchCriteria;
30 import org.kuali.rice.kew.api.extension.ExtensionDefinition;
31 import org.kuali.rice.kew.framework.document.attribute.SearchableAttribute;
32
33 public class MockSearchableAttribute implements SearchableAttribute {
34
35 public static final String SEARCH_CONTENT = "<mockContent>MockSearchableAttribute Search Content</mockContent>";
36
37 @Override
38 public String generateSearchContent(ExtensionDefinition extensionDefinition,
39 String documentTypeName,
40 WorkflowAttributeDefinition attributeDefinition) {
41 return SEARCH_CONTENT;
42 }
43
44 @Override
45 public List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition,
46 DocumentWithContent documentWithContent) {
47 List<DocumentAttribute> savs = new ArrayList<DocumentAttribute>();
48 savs.add(DocumentAttributeFactory.createStringAttribute("MockSearchableAttributeKey", "MockSearchableAttributeValue"));
49 return savs;
50 }
51
52 @Override
53 public List<RemotableAttributeField> getSearchFields(ExtensionDefinition extensionDefinition,
54 String documentTypeName) {
55 List<RemotableAttributeField> fields = new ArrayList<RemotableAttributeField>();
56 RemotableAttributeField.Builder builder = RemotableAttributeField.Builder.create("MockSearchableAttributeKey");
57 builder.setLongLabel("title");
58 builder.setDataType(DataType.STRING);
59 fields.add(builder.build());
60 return fields;
61 }
62
63 @Override
64 public List<RemotableAttributeError> validateDocumentAttributeCriteria(ExtensionDefinition extensionDefinition,
65 DocumentSearchCriteria documentSearchCriteria) {
66 return Collections.emptyList();
67 }
68
69 }