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.joda.time.DateTime;
19 import org.kuali.rice.core.api.uif.DataType;
20 import org.kuali.rice.core.api.uif.RemotableAttributeError;
21 import org.kuali.rice.core.api.uif.RemotableAttributeField;
22 import org.kuali.rice.kew.api.document.DocumentWithContent;
23 import org.kuali.rice.kew.api.document.attribute.DocumentAttribute;
24 import org.kuali.rice.kew.api.document.attribute.DocumentAttributeFactory;
25 import org.kuali.rice.kew.api.document.attribute.WorkflowAttributeDefinition;
26 import org.kuali.rice.kew.api.document.search.DocumentSearchCriteria;
27 import org.kuali.rice.kew.api.extension.ExtensionDefinition;
28 import org.kuali.rice.kew.framework.document.attribute.SearchableAttribute;
29
30 import java.util.ArrayList;
31 import java.util.Collections;
32 import java.util.List;
33
34 public class TestXMLSearchableAttributeDateTime implements SearchableAttribute {
35
36 private static final long serialVersionUID = 1479059967548234181L;
37
38 public static final String SEARCH_STORAGE_KEY = "testDateTimeKey";
39 public static final Long SEARCH_STORAGE_VALUE_IN_MILLS = (new Long("1173995646535"));
40 public static final DateTime SEARCH_STORAGE_VALUE = new DateTime(SEARCH_STORAGE_VALUE_IN_MILLS.longValue());
41
42 @Override
43 public String generateSearchContent(ExtensionDefinition extensionDefinition,
44 String documentTypeName,
45 WorkflowAttributeDefinition attributeDefinition) {
46 return "TestXMLSearchableAttributeDateTime";
47 }
48
49 @Override
50 public List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition,
51 DocumentWithContent documentWithContent) {
52 List<DocumentAttribute> savs = new ArrayList<DocumentAttribute>();
53 savs.add(DocumentAttributeFactory.createDateTimeAttribute(SEARCH_STORAGE_KEY, SEARCH_STORAGE_VALUE));
54 return savs;
55 }
56
57 @Override
58 public List<RemotableAttributeField> getSearchFields(ExtensionDefinition extensionDefinition,
59 String documentTypeName) {
60 List<RemotableAttributeField> fields = new ArrayList<RemotableAttributeField>();
61 RemotableAttributeField.Builder builder = RemotableAttributeField.Builder.create(SEARCH_STORAGE_KEY);
62 builder.setLongLabel("title");
63 builder.setDataType(DataType.DATE);
64 fields.add(builder.build());
65 return fields;
66 }
67
68 @Override
69 public List<RemotableAttributeError> validateDocumentAttributeCriteria(ExtensionDefinition extensionDefinition,
70 DocumentSearchCriteria documentSearchCriteria) {
71 return Collections.emptyList();
72 }
73
74 }