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