Coverage Report - org.kuali.rice.kns.datadictionary.AttributeDefinitionBase
 
Classes in this File Line Coverage Branch Coverage Complexity
AttributeDefinitionBase
0%
0/30
0%
0/8
1.467
 
 1  
 /*
 2  
  * Copyright 2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 1.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/ecl1.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.kns.datadictionary;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.kuali.rice.kns.datadictionary.validation.capability.ExistenceConstrainable;
 20  
 
 21  
 /**
 22  
  * Common class for attribute definitions in the DataDictionary, which contains
 23  
  * information relating to the display, validation, and general maintenance of a
 24  
  * specific attribute of an entry. An attribute can be a simple or complex attribute.
 25  
  *  
 26  
  */
 27  0
 public abstract class AttributeDefinitionBase extends DataDictionaryDefinitionBase implements ExistenceConstrainable{
 28  
 
 29  
         protected String name;
 30  
 
 31  
         protected String label;
 32  
         protected String shortLabel;
 33  
         protected String displayLabelAttribute;
 34  
 
 35  
         protected String messageKey;        
 36  
         protected String summary;
 37  
         
 38  
         //Note: This is the actual constraint text that appears below field
 39  
         protected String constraint;
 40  
         
 41  
         protected String description;
 42  
         
 43  0
         protected Boolean required = Boolean.FALSE;
 44  
         
 45  
         public String getName() {
 46  0
                 return name;
 47  
         }
 48  
 
 49  
         /*
 50  
          * name = name of attribute
 51  
          */
 52  
         public void setName(String name) {
 53  0
                 if (StringUtils.isBlank(name)) {
 54  0
                         throw new IllegalArgumentException("invalid (blank) name");
 55  
                 }
 56  0
                 this.name = name;
 57  0
         }
 58  
 
 59  
         public String getLabel() {
 60  0
                 return label;
 61  
         }
 62  
 
 63  
         /**
 64  
          * The label element is the field or collection name that will be shown on
 65  
          * inquiry and maintenance screens. This will be overridden by presence of
 66  
          * displayLabelAttribute element.
 67  
          */
 68  
         public void setLabel(String label) {
 69  0
                 if (StringUtils.isBlank(label)) {
 70  0
                         throw new IllegalArgumentException("invalid (blank) label");
 71  
                 }
 72  0
                 this.label = label;
 73  0
         }
 74  
 
 75  
         /**
 76  
          * @return the shortLabel, or the label if no shortLabel has been set
 77  
          */
 78  
         public String getShortLabel() {
 79  0
                 return (shortLabel != null) ? shortLabel : getLabel();
 80  
         }
 81  
 
 82  
         /**
 83  
          * @return the shortLabel directly, without substituting in the label
 84  
          */
 85  
         protected String getDirectShortLabel() {
 86  0
                 return shortLabel;
 87  
         }
 88  
 
 89  
         /**
 90  
          * The shortLabel element is the field or collection name that will be used
 91  
          * in applications when a shorter name (than the label element) is required.
 92  
          * This will be overridden by presence of displayLabelAttribute element.
 93  
          */
 94  
         public void setShortLabel(String shortLabel) {
 95  0
                 if (StringUtils.isBlank(shortLabel)) {
 96  0
                         throw new IllegalArgumentException("invalid (blank) shortLabel");
 97  
                 }
 98  0
                 this.shortLabel = shortLabel;
 99  0
         }
 100  
         
 101  
         /**
 102  
          * The required element allows values of "true" or "false". A value of
 103  
          * "true" indicates that a value must be entered for this business object
 104  
          * when creating or editing a new business object.
 105  
          */
 106  
         public void setRequired(Boolean required) {
 107  0
                 this.required = required;
 108  0
         }
 109  
 
 110  
         @Override
 111  
         public Boolean isRequired() {
 112  0
                 return this.required;
 113  
         }
 114  
         
 115  
         public String getSummary() {
 116  0
                 return summary;
 117  
         }
 118  
 
 119  
         /**
 120  
          * The summary element is used to provide a short description of the
 121  
          * attribute or collection. This is designed to be used for help purposes.
 122  
          */
 123  
         public void setSummary(String summary) {
 124  0
                 this.summary = summary;
 125  0
         }
 126  
 
 127  
         public String getDescription() {
 128  0
                 return description;
 129  
         }
 130  
 
 131  
         /**
 132  
          * The description element is used to provide a long description of the
 133  
          * attribute or collection. This is designed to be used for help purposes.
 134  
          */
 135  
         public void setDescription(String description) {
 136  0
                 this.description = description;
 137  0
         }
 138  
         
 139  
         public String getDisplayLabelAttribute() {
 140  0
                 return displayLabelAttribute;
 141  
         }
 142  
 
 143  
         /**
 144  
          * The displayLabelAttribute element is used to indicate that the label and
 145  
          * short label should be obtained from another attribute.
 146  
          * 
 147  
          * The label element and short label element defined for this attribute will
 148  
          * be overridden. Instead, the label and short label values will be obtained
 149  
          * by referencing the corresponding values from the attribute indicated by
 150  
          * this element.
 151  
          */
 152  
         public void setDisplayLabelAttribute(String displayLabelAttribute) {
 153  0
                 this.displayLabelAttribute = displayLabelAttribute;
 154  0
         }
 155  
 
 156  
 }