| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| BaseConstraint |
|
| 1.0;1 |
| 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.constraint; | |
| 17 | ||
| 18 | import java.util.List; | |
| 19 | ||
| 20 | import javax.xml.bind.annotation.XmlAccessType; | |
| 21 | import javax.xml.bind.annotation.XmlAccessorType; | |
| 22 | import javax.xml.bind.annotation.XmlElement; | |
| 23 | ||
| 24 | ||
| 25 | /** | |
| 26 | * A class that implements the required accessor for label keys. This provides a convenient base class | |
| 27 | * from which other constraints can be derived. | |
| 28 | * | |
| 29 | * This class is a direct copy of one that was in Kuali Student. | |
| 30 | * | |
| 31 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 32 | * @since 1.1 | |
| 33 | */ | |
| 34 | @XmlAccessorType(XmlAccessType.FIELD) | |
| 35 | public class BaseConstraint implements Constraint { | |
| 36 | @XmlElement | |
| 37 | protected String labelKey; | |
| 38 | @XmlElement | |
| 39 | protected Boolean applyClientSide; | |
| 40 | ||
| 41 | List<String> validationMessageParams; | |
| 42 | ||
| 43 | 0 | public BaseConstraint(){ |
| 44 | 0 | applyClientSide = Boolean.valueOf(true); |
| 45 | 0 | } |
| 46 | ||
| 47 | /** | |
| 48 | * LabelKey should be a single word key. This key is used to find a message to use for this | |
| 49 | * constraint from available messages. The key is also used for defining/retrieving validation method | |
| 50 | * names when applicable for ValidCharactersContraints. | |
| 51 | * | |
| 52 | * If a comma separated list of keys is used, a message will be generated that is a comma separated list of | |
| 53 | * the messages retrieved for each key. | |
| 54 | * | |
| 55 | * @see ValidCharactersConstraint | |
| 56 | * | |
| 57 | * @return | |
| 58 | */ | |
| 59 | public String getLabelKey() { | |
| 60 | 0 | return labelKey; |
| 61 | } | |
| 62 | ||
| 63 | public void setLabelKey(String labelKey) { | |
| 64 | 0 | this.labelKey = labelKey; |
| 65 | 0 | } |
| 66 | ||
| 67 | /** | |
| 68 | * If this is true, the constraint should be applied on the client side when the user interacts with | |
| 69 | * a field - if this constraint can be interpreted for client side use. Default is true. | |
| 70 | * @return the applyClientSide | |
| 71 | */ | |
| 72 | public Boolean getApplyClientSide() { | |
| 73 | 0 | return this.applyClientSide; |
| 74 | } | |
| 75 | ||
| 76 | /** | |
| 77 | * @param applyClientSide the applyClientSide to set | |
| 78 | */ | |
| 79 | public void setApplyClientSide(Boolean applyClientSide) { | |
| 80 | 0 | this.applyClientSide = applyClientSide; |
| 81 | 0 | } |
| 82 | ||
| 83 | ||
| 84 | /** | |
| 85 | * Parameters to be used in the string retrieved by this constraint's labelKey, ordered by number of | |
| 86 | * the param | |
| 87 | * @return the validationMessageParams | |
| 88 | */ | |
| 89 | public List<String> getValidationMessageParams() { | |
| 90 | 0 | return this.validationMessageParams; |
| 91 | } | |
| 92 | ||
| 93 | /** | |
| 94 | * @param validationMessageParams the validationMessageParams to set | |
| 95 | */ | |
| 96 | public void setValidationMessageParams(List<String> validationMessageParams) { | |
| 97 | 0 | this.validationMessageParams = validationMessageParams; |
| 98 | 0 | } |
| 99 | ||
| 100 | ||
| 101 | } |