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