1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.datadictionary;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.datadictionary.DataDictionaryDefinitionBase;
20 import org.kuali.rice.krad.datadictionary.DataDictionaryException;
21
22 import java.util.ArrayList;
23 import java.util.List;
24
25
26
27
28
29
30
31
32
33
34
35
36
37 @Deprecated
38 public class MaintainableSectionDefinition extends DataDictionaryDefinitionBase {
39 private static final long serialVersionUID = -8615694293159113523L;
40
41 protected String title;
42
43 protected List<MaintainableItemDefinition> maintainableItems = new ArrayList<MaintainableItemDefinition>();
44
45 protected boolean hidden = false;
46
47 protected boolean defaultOpen = true;
48
49 protected String helpUrl;
50
51 public MaintainableSectionDefinition() {}
52
53
54
55
56 public String getTitle() {
57 return title;
58 }
59
60
61
62
63
64
65 @Override
66 public String getId() {
67 if (StringUtils.isBlank(id)) {
68 return title;
69 }
70 return id;
71 }
72
73
74
75
76
77
78
79 public void setTitle(String title) {
80 if (StringUtils.isBlank(title)) {
81 throw new IllegalArgumentException("invalid (blank) title");
82 }
83
84 this.title = title;
85 }
86
87
88
89
90
91 public List<MaintainableItemDefinition> getMaintainableItems() {
92 return maintainableItems;
93 }
94
95
96
97
98
99
100
101 public void completeValidation(Class rootBusinessObjectClass, Class otherBusinessObjectClass) {
102 if (StringUtils.contains(title, ",") && StringUtils.isBlank(id)) {
103 throw new DataDictionaryException("The title for maintainable section \"" + title + "\" for class " + rootBusinessObjectClass.getName() +
104 " contains a comma. In this case, the id property must be defined and it may not contain a comma");
105 }
106 if (StringUtils.contains(id, ",")) {
107 throw new DataDictionaryException("The id for maintainable section \"" + id + "\" for class " + rootBusinessObjectClass.getName() +
108 " contains a comma, which is not allowed.");
109 }
110 for ( MaintainableItemDefinition maintainableItem : maintainableItems ) {
111 maintainableItem.completeValidation(rootBusinessObjectClass, null);
112 }
113 }
114
115 public String toString() {
116 return "MaintainableSectionDefinition '" + getTitle() + "'";
117 }
118
119
120 public boolean isHidden() {
121 return this.hidden;
122 }
123
124
125
126 public void setHidden(boolean hidden) {
127 this.hidden = hidden;
128 }
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 public void setMaintainableItems(List<MaintainableItemDefinition> maintainableItems) {
168 for ( MaintainableItemDefinition maintainableItem : maintainableItems ) {
169 if (maintainableItem == null) {
170 throw new IllegalArgumentException("invalid (null) maintainableItem");
171 }
172 }
173
174 this.maintainableItems = maintainableItems;
175 }
176
177
178
179
180 public boolean isDefaultOpen() {
181 return this.defaultOpen;
182 }
183
184
185
186
187 public void setDefaultOpen(boolean defaultOpen) {
188 this.defaultOpen = defaultOpen;
189 }
190
191 public String getHelpUrl() {
192 return helpUrl;
193 }
194
195 public void setHelpUrl(String helpUrl) {
196 this.helpUrl = helpUrl;
197 }
198
199 }