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
31 public abstract class BaseAttributeValueReader implements AttributeValueReader {
32
33 protected String entryName;
34 protected String attributeName;
35
36 @Override
37 public List<String> getCleanSearchableValues(String attributeKey) throws AttributeValidationException {
38 Class<?> attributeType = getType(attributeKey);
39 Object rawValue = getValue(attributeKey);
40
41 String attributeInValue = rawValue != null ? rawValue.toString() : "";
42 String attributeDataType = DataTypeUtil.determineDataType(attributeType);
43 return SQLUtils.getCleanedSearchableValues(attributeInValue, attributeDataType);
44 }
45
46
47
48
49 @Override
50 public String getAttributeName() {
51 return this.attributeName;
52 }
53
54
55
56
57 @Override
58 public void setAttributeName(String currentName) {
59 this.attributeName = currentName;
60 }
61
62
63
64
65 @Override
66 public String getEntryName() {
67 return this.entryName;
68 }
69
70 @Override
71 public abstract AttributeValueReader clone();
72
73 }