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.krad.datadictionary.DataDictionaryDefinitionBase;
21 import org.kuali.rice.krad.datadictionary.DataDictionaryException;
22
23 import java.util.ArrayList;
24 import java.util.List;
25
26
27
28
29
30
31
32
33
34
35
36
37
38 @Deprecated
39 public class MaintainableSectionDefinition extends DataDictionaryDefinitionBase {
40 private static final long serialVersionUID = -8615694293159113523L;
41
42 protected String title;
43
44 protected List<MaintainableItemDefinition> maintainableItems = new ArrayList<MaintainableItemDefinition>();
45
46 protected boolean hidden = false;
47
48 protected boolean defaultOpen = true;
49
50 protected String helpUrl;
51
52 public MaintainableSectionDefinition() {}
53
54
55
56
57 public String getTitle() {
58 return title;
59 }
60
61
62
63
64
65
66 @Override
67 public String getId() {
68 if (StringUtils.isBlank(id)) {
69 return title;
70 }
71 return id;
72 }
73
74
75
76
77
78
79
80 public void setTitle(String title) {
81 if (StringUtils.isBlank(title)) {
82 throw new IllegalArgumentException("invalid (blank) title");
83 }
84
85 this.title = title;
86 }
87
88
89
90
91
92 public List<MaintainableItemDefinition> getMaintainableItems() {
93 return maintainableItems;
94 }
95
96
97
98
99
100
101
102 public void completeValidation(Class rootBusinessObjectClass, Class otherBusinessObjectClass) {
103 if (StringUtils.contains(title, ",") && StringUtils.isBlank(id)) {
104 throw new DataDictionaryException("The title for maintainable section \"" + title + "\" for class " + rootBusinessObjectClass.getName() +
105 " contains a comma. In this case, the id property must be defined and it may not contain a comma");
106 }
107 if (StringUtils.contains(id, ",")) {
108 throw new DataDictionaryException("The id for maintainable section \"" + id + "\" for class " + rootBusinessObjectClass.getName() +
109 " contains a comma, which is not allowed.");
110 }
111 for ( MaintainableItemDefinition maintainableItem : maintainableItems ) {
112 maintainableItem.completeValidation(rootBusinessObjectClass, null);
113 }
114 }
115
116 public String toString() {
117 return "MaintainableSectionDefinition '" + getTitle() + "'";
118 }
119
120
121 public boolean isHidden() {
122 return this.hidden;
123 }
124
125
126
127 public void setHidden(boolean hidden) {
128 this.hidden = hidden;
129 }
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168 public void setMaintainableItems(List<MaintainableItemDefinition> maintainableItems) {
169 for ( MaintainableItemDefinition maintainableItem : maintainableItems ) {
170 if (maintainableItem == null) {
171 throw new IllegalArgumentException("invalid (null) maintainableItem");
172 }
173 }
174
175 this.maintainableItems = maintainableItems;
176 }
177
178
179
180
181 public boolean isDefaultOpen() {
182 return this.defaultOpen;
183 }
184
185
186
187
188 public void setDefaultOpen(boolean defaultOpen) {
189 this.defaultOpen = defaultOpen;
190 }
191
192 public String getHelpUrl() {
193 return helpUrl;
194 }
195
196 public void setHelpUrl(String helpUrl) {
197 this.helpUrl = helpUrl;
198 }
199
200 }