| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| BaseAttributeValueReader |
|
| 1.25;1.25 |
| 1 | /** | |
| 2 | * Copyright 2005-2011 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.opensource.org/licenses/ecl2.php | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 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 | * A class that implements the required accessors and legacy processing for an attribute value reader. This provides a convenient base class | |
| 26 | * from which other attribute value readers can be derived. | |
| 27 | * | |
| 28 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 29 | */ | |
| 30 | 0 | 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 | 0 | Class<?> attributeType = getType(attributeKey); |
| 38 | 0 | Object rawValue = getValue(attributeKey); |
| 39 | ||
| 40 | 0 | String attributeInValue = rawValue != null ? rawValue.toString() : ""; |
| 41 | 0 | String attributeDataType = DataTypeUtil.determineDataType(attributeType); |
| 42 | 0 | return SQLUtils.getCleanedSearchableValues(attributeInValue, attributeDataType); |
| 43 | } | |
| 44 | ||
| 45 | /** | |
| 46 | * @return the currentName | |
| 47 | */ | |
| 48 | @Override | |
| 49 | public String getAttributeName() { | |
| 50 | 0 | return this.attributeName; |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * @param currentName the currentName to set | |
| 55 | */ | |
| 56 | @Override | |
| 57 | public void setAttributeName(String currentName) { | |
| 58 | 0 | this.attributeName = currentName; |
| 59 | 0 | } |
| 60 | ||
| 61 | /** | |
| 62 | * @return the entryName | |
| 63 | */ | |
| 64 | @Override | |
| 65 | public String getEntryName() { | |
| 66 | 0 | return this.entryName; |
| 67 | } | |
| 68 | ||
| 69 | } |