1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.datadictionary.validation;
17
18 import org.kuali.rice.core.framework.persistence.jdbc.sql.SQLUtils;
19 import org.kuali.rice.krad.datadictionary.exception.AttributeValidationException;
20 import org.kuali.rice.krad.util.DataTypeUtil;
21
22 import java.util.List;
23
24
25
26
27
28
29
30 public abstract class BaseAttributeValueReader implements AttributeValueReader {
31
32 protected String entryName;
33 protected String attributeName;
34
35 @Override
36 public List<String> getCleanSearchableValues(String attributeKey) throws AttributeValidationException {
37 Class<?> attributeType = getType(attributeKey);
38 Object rawValue = getValue(attributeKey);
39
40 String attributeInValue = rawValue != null ? rawValue.toString() : "";
41 String attributeDataType = DataTypeUtil.determineDataType(attributeType);
42 return SQLUtils.getCleanedSearchableValues(attributeInValue, attributeDataType);
43 }
44
45
46
47
48 @Override
49 public String getAttributeName() {
50 return this.attributeName;
51 }
52
53
54
55
56 @Override
57 public void setAttributeName(String currentName) {
58 this.attributeName = currentName;
59 }
60
61
62
63
64 @Override
65 public String getEntryName() {
66 return this.entryName;
67 }
68
69 @Override
70 public abstract AttributeValueReader clone();
71
72 }