|  1 |     | 
     | 
  |  2 |     | 
     | 
  |  3 |     | 
     | 
  |  4 |     | 
     | 
  |  5 |     | 
     | 
  |  6 |     | 
     | 
  |  7 |     | 
     | 
  |  8 |     | 
     | 
  |  9 |     | 
     | 
  |  10 |     | 
     | 
  |  11 |     | 
     | 
  |  12 |     | 
     | 
  |  13 |     | 
     | 
  |  14 |     | 
     | 
  |  15 |     | 
     | 
  |  16 |     | 
     | 
  |  17 |     | 
   package org.kuali.rice.kns.datadictionary;  | 
  |  18 |     | 
     | 
  |  19 |     | 
   import org.apache.commons.lang.StringUtils;  | 
  |  20 |     | 
   import org.kuali.rice.kns.datadictionary.exception.AttributeValidationException;  | 
  |  21 |     | 
   import org.kuali.rice.kns.datadictionary.validation.capability.CollectionSizeConstrainable;  | 
  |  22 |     | 
     | 
  |  23 |     | 
     | 
  |  24 |     | 
     | 
  |  25 |     | 
     | 
  |  26 |     | 
     | 
  |  27 |     | 
     | 
  |  28 |     | 
     | 
  |  29 |     | 
   public class CollectionDefinition extends DataDictionaryDefinitionBase implements CollectionSizeConstrainable{ | 
  |  30 |     | 
       private static final long serialVersionUID = -2644072136271281041L;  | 
  |  31 |     | 
         | 
  |  32 |     | 
       protected String dataObjectClass;  | 
  |  33 |     | 
       protected String name;  | 
  |  34 |     | 
       protected String label;  | 
  |  35 |     | 
       protected String shortLabel;  | 
  |  36 |     | 
       protected String elementLabel;  | 
  |  37 |     | 
         | 
  |  38 |     | 
       protected String summary;  | 
  |  39 |     | 
     | 
  |  40 |     | 
           protected String description;  | 
  |  41 |     | 
         | 
  |  42 |     | 
           protected Integer minOccurs;  | 
  |  43 |     | 
           protected Integer maxOccurs;  | 
  |  44 |     | 
     | 
  |  45 |    0 |        public CollectionDefinition() { | 
  |  46 |     | 
                 | 
  |  47 |    0 |        }  | 
  |  48 |     | 
     | 
  |  49 |     | 
       public String getName() { | 
  |  50 |    0 |            return name;  | 
  |  51 |     | 
       }  | 
  |  52 |     | 
     | 
  |  53 |     | 
       public void setName(String name) { | 
  |  54 |    0 |            if (StringUtils.isBlank(name)) { | 
  |  55 |    0 |                throw new IllegalArgumentException("invalid (blank) name"); | 
  |  56 |     | 
           }  | 
  |  57 |    0 |            this.name = name;  | 
  |  58 |    0 |        }  | 
  |  59 |     | 
     | 
  |  60 |     | 
       public String getLabel() { | 
  |  61 |    0 |            return label;  | 
  |  62 |     | 
       }  | 
  |  63 |     | 
     | 
  |  64 |     | 
       public void setLabel(String label) { | 
  |  65 |    0 |            if (StringUtils.isBlank(label)) { | 
  |  66 |    0 |                throw new IllegalArgumentException("invalid (blank) label"); | 
  |  67 |     | 
           }  | 
  |  68 |    0 |            this.label = label;  | 
  |  69 |    0 |        }  | 
  |  70 |     | 
     | 
  |  71 |     | 
         | 
  |  72 |     | 
     | 
  |  73 |     | 
     | 
  |  74 |     | 
       public String getShortLabel() { | 
  |  75 |    0 |            return (shortLabel != null) ? shortLabel : label;  | 
  |  76 |     | 
       }  | 
  |  77 |     | 
     | 
  |  78 |     | 
       public void setShortLabel(String shortLabel) { | 
  |  79 |    0 |            if (StringUtils.isBlank(shortLabel)) { | 
  |  80 |    0 |                throw new IllegalArgumentException("invalid (blank) shortLabel"); | 
  |  81 |     | 
           }  | 
  |  82 |    0 |            this.shortLabel = shortLabel;  | 
  |  83 |    0 |        }  | 
  |  84 |     | 
     | 
  |  85 |     | 
         | 
  |  86 |     | 
     | 
  |  87 |     | 
     | 
  |  88 |     | 
     | 
  |  89 |     | 
       public String getElementLabel() { | 
  |  90 |    0 |            return elementLabel;  | 
  |  91 |     | 
       }  | 
  |  92 |     | 
     | 
  |  93 |     | 
         | 
  |  94 |     | 
     | 
  |  95 |     | 
     | 
  |  96 |     | 
     | 
  |  97 |     | 
     | 
  |  98 |     | 
       public void setElementLabel(String elementLabel) { | 
  |  99 |    0 |            this.elementLabel = elementLabel;  | 
  |  100 |    0 |        }  | 
  |  101 |     | 
     | 
  |  102 |     | 
       public String getSummary() { | 
  |  103 |    0 |            return summary;  | 
  |  104 |     | 
       }  | 
  |  105 |     | 
     | 
  |  106 |     | 
         | 
  |  107 |     | 
     | 
  |  108 |     | 
     | 
  |  109 |     | 
     | 
  |  110 |     | 
       public void setSummary(String summary) { | 
  |  111 |    0 |            this.summary = summary;  | 
  |  112 |    0 |        }  | 
  |  113 |     | 
     | 
  |  114 |     | 
       public String getDescription() { | 
  |  115 |    0 |            return description;  | 
  |  116 |     | 
       }  | 
  |  117 |     | 
     | 
  |  118 |     | 
         | 
  |  119 |     | 
     | 
  |  120 |     | 
     | 
  |  121 |     | 
     | 
  |  122 |     | 
       public void setDescription(String description) { | 
  |  123 |    0 |            this.description = description;  | 
  |  124 |    0 |        }  | 
  |  125 |     | 
         | 
  |  126 |     | 
                | 
  |  127 |     | 
         | 
  |  128 |     | 
     | 
  |  129 |     | 
     | 
  |  130 |     | 
           public String getDataObjectClass() { | 
  |  131 |    0 |                    return this.dataObjectClass;  | 
  |  132 |     | 
           }  | 
  |  133 |     | 
     | 
  |  134 |     | 
             | 
  |  135 |     | 
     | 
  |  136 |     | 
     | 
  |  137 |     | 
           public void setDataObjectClass(String dataObjectClass) { | 
  |  138 |    0 |                    this.dataObjectClass = dataObjectClass;  | 
  |  139 |    0 |            }  | 
  |  140 |     | 
     | 
  |  141 |     | 
             | 
  |  142 |     | 
     | 
  |  143 |     | 
     | 
  |  144 |     | 
     | 
  |  145 |     | 
     | 
  |  146 |     | 
       public void completeValidation(Class rootBusinessObjectClass, Class otherBusinessObjectClass) { | 
  |  147 |    0 |            if (!DataDictionary.isCollectionPropertyOf(rootBusinessObjectClass, name)) { | 
  |  148 |    0 |                throw new AttributeValidationException("property '" + name + "' is not a collection property of class '" + rootBusinessObjectClass + "' (" + "" + ")"); | 
  |  149 |     | 
           }  | 
  |  150 |    0 |        }  | 
  |  151 |     | 
     | 
  |  152 |     | 
     | 
  |  153 |     | 
         | 
  |  154 |     | 
     | 
  |  155 |     | 
     | 
  |  156 |     | 
       @Override  | 
  |  157 |     | 
       public String toString() { | 
  |  158 |    0 |            return "CollectionDefinition for collection " + getName();  | 
  |  159 |     | 
       }  | 
  |  160 |     | 
     | 
  |  161 |     | 
             | 
  |  162 |     | 
     | 
  |  163 |     | 
     | 
  |  164 |     | 
           @Override  | 
  |  165 |     | 
           public Integer getMaximumNumberOfElements() { | 
  |  166 |    0 |                    return this.maxOccurs;  | 
  |  167 |     | 
           }  | 
  |  168 |     | 
     | 
  |  169 |     | 
             | 
  |  170 |     | 
     | 
  |  171 |     | 
     | 
  |  172 |     | 
           @Override  | 
  |  173 |     | 
           public Integer getMinimumNumberOfElements() { | 
  |  174 |    0 |                    return this.minOccurs;  | 
  |  175 |     | 
           }  | 
  |  176 |     | 
     | 
  |  177 |     | 
         | 
  |  178 |     | 
     | 
  |  179 |     | 
     | 
  |  180 |     | 
           public Integer getMinOccurs() { | 
  |  181 |    0 |                    return this.minOccurs;  | 
  |  182 |     | 
           }  | 
  |  183 |     | 
     | 
  |  184 |     | 
             | 
  |  185 |     | 
     | 
  |  186 |     | 
     | 
  |  187 |     | 
           public void setMinOccurs(Integer minOccurs) { | 
  |  188 |    0 |                    this.minOccurs = minOccurs;  | 
  |  189 |    0 |            }  | 
  |  190 |     | 
     | 
  |  191 |     | 
             | 
  |  192 |     | 
     | 
  |  193 |     | 
     | 
  |  194 |     | 
           public Integer getMaxOccurs() { | 
  |  195 |    0 |                    return this.maxOccurs;  | 
  |  196 |     | 
           }  | 
  |  197 |     | 
     | 
  |  198 |     | 
             | 
  |  199 |     | 
     | 
  |  200 |     | 
     | 
  |  201 |     | 
           public void setMaxOccurs(Integer maxOccurs) { | 
  |  202 |    0 |                    this.maxOccurs = maxOccurs;  | 
  |  203 |    0 |            }  | 
  |  204 |     | 
     | 
  |  205 |     | 
   }  |