1 /* 2 * Copyright 2008 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.ole.sys.document.validation.impl; 17 18 import org.kuali.ole.sys.document.validation.ValidationFieldConvertible; 19 20 /** 21 * A simple class to create field conversions to specify in validations. 22 */ 23 public class ValidationFieldConversion implements ValidationFieldConvertible { 24 private String sourceEventProperty; 25 private String targetValidationProperty; 26 /** 27 * Gets the sourceEventProperty attribute, the property of the event to transfer to the validation 28 * @return Returns the sourceEventProperty. 29 */ 30 public String getSourceEventProperty() { 31 return sourceEventProperty; 32 } 33 /** 34 * Sets the sourceEventProperty attribute value, the property of the event to transfer to the validation 35 * @param sourceEventProperty The sourceEventProperty to set. 36 */ 37 public void setSourceEventProperty(String sourceEventProperty) { 38 this.sourceEventProperty = cleanParameterProperty(sourceEventProperty); 39 } 40 /** 41 * Gets the targetValidationProperty attribute, the property on the validation to transfer information from the event to 42 * @return Returns the targetValidationProperty. 43 */ 44 public String getTargetValidationProperty() { 45 return targetValidationProperty; 46 } 47 /** 48 * Sets the targetValidationProperty attribute value, the property on the validation to transfer information from the event to 49 * @param targetValidationProperty The targetValidationProperty to set. 50 */ 51 public void setTargetValidationProperty(String targetValidationProperty) { 52 this.targetValidationProperty = targetValidationProperty; 53 } 54 55 /** 56 * Removes extraneous information from a single property 57 * @param property a property name to clean up 58 * @return a cleaned up parameter property 59 */ 60 private String cleanParameterProperty(String property) { 61 return (property.startsWith("event.") ? property.replaceFirst("^event\\.", "") : property); 62 } 63 }