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