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 public CollectionDefinition() {
46
47 }
48
49 public String getName() {
50 return name;
51 }
52
53 public void setName(String name) {
54 if (StringUtils.isBlank(name)) {
55 throw new IllegalArgumentException("invalid (blank) name");
56 }
57 this.name = name;
58 }
59
60 public String getLabel() {
61 return label;
62 }
63
64 public void setLabel(String label) {
65 if (StringUtils.isBlank(label)) {
66 throw new IllegalArgumentException("invalid (blank) label");
67 }
68 this.label = label;
69 }
70
71
72
73
74 public String getShortLabel() {
75 return (shortLabel != null) ? shortLabel : label;
76 }
77
78 public void setShortLabel(String shortLabel) {
79 if (StringUtils.isBlank(shortLabel)) {
80 throw new IllegalArgumentException("invalid (blank) shortLabel");
81 }
82 this.shortLabel = shortLabel;
83 }
84
85
86
87
88
89 public String getElementLabel() {
90 return elementLabel;
91 }
92
93
94
95
96
97
98 public void setElementLabel(String elementLabel) {
99 this.elementLabel = elementLabel;
100 }
101
102 public String getSummary() {
103 return summary;
104 }
105
106
107
108
109
110 public void setSummary(String summary) {
111 this.summary = summary;
112 }
113
114 public String getDescription() {
115 return description;
116 }
117
118
119
120
121
122 public void setDescription(String description) {
123 this.description = description;
124 }
125
126
127
128
129
130 public String getDataObjectClass() {
131 return this.dataObjectClass;
132 }
133
134
135
136
137 public void setDataObjectClass(String dataObjectClass) {
138 this.dataObjectClass = dataObjectClass;
139 }
140
141
142
143
144
145
146 public void completeValidation(Class rootBusinessObjectClass, Class otherBusinessObjectClass) {
147 if (!DataDictionary.isCollectionPropertyOf(rootBusinessObjectClass, name)) {
148 throw new AttributeValidationException("property '" + name + "' is not a collection property of class '" + rootBusinessObjectClass + "' (" + "" + ")");
149 }
150 }
151
152
153
154
155
156 @Override
157 public String toString() {
158 return "CollectionDefinition for collection " + getName();
159 }
160
161
162
163
164 @Override
165 public Integer getMaximumNumberOfElements() {
166 return this.maxOccurs;
167 }
168
169
170
171
172 @Override
173 public Integer getMinimumNumberOfElements() {
174 return this.minOccurs;
175 }
176
177
178
179
180 public Integer getMinOccurs() {
181 return this.minOccurs;
182 }
183
184
185
186
187 public void setMinOccurs(Integer minOccurs) {
188 this.minOccurs = minOccurs;
189 }
190
191
192
193
194 public Integer getMaxOccurs() {
195 return this.maxOccurs;
196 }
197
198
199
200
201 public void setMaxOccurs(Integer maxOccurs) {
202 this.maxOccurs = maxOccurs;
203 }
204
205 }