Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DataDictionaryService |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2005-2007 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl2.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | package org.kuali.rice.kns.service; | |
17 | ||
18 | import java.io.IOException; | |
19 | import java.math.BigDecimal; | |
20 | import java.util.List; | |
21 | import java.util.Map; | |
22 | import java.util.Set; | |
23 | import java.util.regex.Pattern; | |
24 | ||
25 | import org.kuali.rice.kns.bo.BusinessObject; | |
26 | import org.kuali.rice.kns.datadictionary.AttributeSecurity; | |
27 | import org.kuali.rice.kns.datadictionary.DataDictionary; | |
28 | import org.kuali.rice.kns.datadictionary.InactivationBlockingMetadata; | |
29 | import org.kuali.rice.kns.datadictionary.control.ControlDefinition; | |
30 | import org.kuali.rice.kns.datadictionary.mask.Mask; | |
31 | import org.kuali.rice.kns.document.Document; | |
32 | import org.kuali.rice.kns.exception.UnknownDocumentTypeException; | |
33 | import org.kuali.rice.kns.lookup.keyvalues.KeyValuesFinder; | |
34 | import org.kuali.rice.kns.rule.PromptBeforeValidation; | |
35 | import org.kuali.rice.kns.web.format.Formatter; | |
36 | ||
37 | ||
38 | /** | |
39 | * This interface defines the API for interacting with the data dictionary. | |
40 | * | |
41 | * | |
42 | */ | |
43 | public interface DataDictionaryService { | |
44 | /** | |
45 | * Sequentially adds each package named (as a String) in the given List as a source of unique entries to the DataDictionary | |
46 | * being constructed. Duplicate entries among any of the XML files in any of these packages will result in exceptions being | |
47 | * thrown, hence service-initialization failure. | |
48 | * | |
49 | * @param baselinePackages | |
50 | * @throws SourceException if any of the given packages can't be located | |
51 | */ | |
52 | public void setBaselinePackages(List baselinePackages) throws IOException; | |
53 | ||
54 | /** | |
55 | * @return current DataDictionary | |
56 | */ | |
57 | public DataDictionary getDataDictionary(); | |
58 | ||
59 | public void addDataDictionaryLocations(List<String> locations) throws IOException; | |
60 | ||
61 | // /** | |
62 | // * Hook to allow the dataDictionary service to perform any post-build initialization tasks needed before the dataDictionary | |
63 | // * itself will be publicly available. | |
64 | // */ | |
65 | // public void completeInitialization(); | |
66 | ||
67 | /** | |
68 | * the html control type used to render the field | |
69 | */ | |
70 | public ControlDefinition getAttributeControlDefinition(Class businessObjectClass, String attributeName); | |
71 | ||
72 | ||
73 | /** | |
74 | * the display size of the field if text control | |
75 | */ | |
76 | public Integer getAttributeSize(Class businessObjectClass, String attributeName); | |
77 | ||
78 | ||
79 | /** | |
80 | * the max length defined for the given attribute name. | |
81 | */ | |
82 | public Integer getAttributeMaxLength(Class businessObjectClass, String attributeName); | |
83 | ||
84 | ||
85 | /** | |
86 | * the regular expression defined to validate the given attribute name. | |
87 | */ | |
88 | public Pattern getAttributeValidatingExpression(Class businessObjectClass, String attributeName); | |
89 | ||
90 | ||
91 | /** | |
92 | * the label to be used for displaying the attribute. | |
93 | */ | |
94 | public String getAttributeLabel(Class businessObjectClass, String attributeName); | |
95 | ||
96 | ||
97 | /** | |
98 | * the short label to be used for displaying the attribute. | |
99 | */ | |
100 | public String getAttributeShortLabel(Class businessObjectClass, String attributeName); | |
101 | ||
102 | ||
103 | /** | |
104 | * the "label (short label)" used for displaying error messages | |
105 | */ | |
106 | public String getAttributeErrorLabel(Class businessObjectClass, String attributeName); | |
107 | ||
108 | /** | |
109 | * the formatter class used to format the attribute value | |
110 | */ | |
111 | public Class<? extends Formatter> getAttributeFormatter(Class businessObjectClass, String attributeName); | |
112 | ||
113 | ||
114 | /** | |
115 | * indicates whether or not to force input text into uppercase | |
116 | */ | |
117 | public Boolean getAttributeForceUppercase(Class businessObjectClass, String attributeName); | |
118 | ||
119 | /** | |
120 | * short help text for attribute | |
121 | */ | |
122 | public String getAttributeSummary(Class businessObjectClass, String attributeName); | |
123 | ||
124 | /** | |
125 | * detailed help text for attribute | |
126 | */ | |
127 | public String getAttributeDescription(Class businessObjectClass, String attributeName); | |
128 | ||
129 | /** | |
130 | * indicates whether or not the named attribute is required | |
131 | */ | |
132 | public Boolean isAttributeRequired(Class businessObjectClass, String attributeName); | |
133 | ||
134 | /** | |
135 | * indicates whether or not the named attribute is defined in the business object xml | |
136 | */ | |
137 | public Boolean isAttributeDefined(Class businessObjectClass, String attributeName); | |
138 | ||
139 | /** | |
140 | * the Class that returns a values list for this attribute | |
141 | */ | |
142 | public Class<? extends KeyValuesFinder> getAttributeValuesFinderClass(Class businessObjectClass, String attributeName); | |
143 | ||
144 | /** | |
145 | * the label to be used for displaying the collection. | |
146 | */ | |
147 | public String getCollectionLabel(Class businessObjectClass, String collectionName); | |
148 | ||
149 | ||
150 | /** | |
151 | * the short label to be used for displaying the collection. | |
152 | */ | |
153 | public String getCollectionShortLabel(Class businessObjectClass, String collectionName); | |
154 | ||
155 | ||
156 | /** | |
157 | * short help text for collection | |
158 | */ | |
159 | public String getCollectionSummary(Class businessObjectClass, String collectionName); | |
160 | ||
161 | ||
162 | /** | |
163 | * detailed help text for collection | |
164 | */ | |
165 | public String getCollectionDescription(Class businessObjectClass, String collectionName); | |
166 | ||
167 | /** | |
168 | * the html control type used to render the field | |
169 | */ | |
170 | public ControlDefinition getAttributeControlDefinition(String entryName, String attributeName); | |
171 | ||
172 | ||
173 | /** | |
174 | * the display size of the field if text control | |
175 | */ | |
176 | public Integer getAttributeSize(String entryName, String attributeName); | |
177 | ||
178 | ||
179 | /** | |
180 | * the max length defined for the given attribute name. | |
181 | */ | |
182 | public Integer getAttributeMaxLength(String entryName, String attributeName); | |
183 | ||
184 | /** | |
185 | * @param entryName | |
186 | * @param attributeName | |
187 | * @return the exclusive minimum for the specified attribute, or <code>null</code> if none. | |
188 | */ | |
189 | public BigDecimal getAttributeExclusiveMin(String entryName, String attributeName); | |
190 | ||
191 | /** | |
192 | * @param entryName | |
193 | * @param attributeName | |
194 | * @return the inclusive maximum for the specified attribute, or <code>null</code> if none. | |
195 | */ | |
196 | public BigDecimal getAttributeInclusiveMax(String entryName, String attributeName); | |
197 | ||
198 | ||
199 | /** | |
200 | * the regular expression defined to validate the given attribute name. | |
201 | */ | |
202 | public Pattern getAttributeValidatingExpression(String entryName, String attributeName); | |
203 | ||
204 | ||
205 | /** | |
206 | * the label to be used for displaying the attribute. | |
207 | */ | |
208 | public String getAttributeLabel(String entryName, String attributeName); | |
209 | ||
210 | ||
211 | /** | |
212 | * the short label to be used for displaying the attribute. | |
213 | */ | |
214 | public String getAttributeShortLabel(String entryName, String attributeName); | |
215 | ||
216 | ||
217 | /** | |
218 | * the "label (short label)" used for displaying error messages | |
219 | */ | |
220 | public String getAttributeErrorLabel(String entryName, String attributeName); | |
221 | ||
222 | ||
223 | /** | |
224 | * the formatter class used to format the attribute value | |
225 | */ | |
226 | public Class<? extends Formatter> getAttributeFormatter(String entryName, String attributeName); | |
227 | ||
228 | ||
229 | /** | |
230 | * indicates whether or not to force input text into uppercase | |
231 | */ | |
232 | public Boolean getAttributeForceUppercase(String entryName, String attributeName); | |
233 | ||
234 | /** | |
235 | * the AttributeSecurity object defined for the attribute's data value | |
236 | */ | |
237 | public AttributeSecurity getAttributeSecurity(String entryName, String attributeName); | |
238 | ||
239 | /** | |
240 | * short help text for attribute | |
241 | */ | |
242 | public String getAttributeSummary(String entryName, String attributeName); | |
243 | ||
244 | ||
245 | /** | |
246 | * detailed help text for attribute | |
247 | */ | |
248 | public String getAttributeDescription(String entryName, String attributeName); | |
249 | ||
250 | public String getAttributeValidatingErrorMessageKey(String entryName, String attributeName); | |
251 | ||
252 | public String[] getAttributeValidatingErrorMessageParameters(String entryName, String attributeName); | |
253 | ||
254 | /** | |
255 | * indicates whether or not the named attribute is required | |
256 | */ | |
257 | public Boolean isAttributeRequired(String entryName, String attributeName); | |
258 | ||
259 | /** | |
260 | * indicates whether or not the named attribute is defined in the business object xml | |
261 | */ | |
262 | public Boolean isAttributeDefined(String entryName, String attributeName); | |
263 | ||
264 | /** | |
265 | * the Class that returns a values list for this attribute | |
266 | */ | |
267 | public Class<? extends KeyValuesFinder> getAttributeValuesFinderClass(String entryName, String attributeName); | |
268 | ||
269 | /** | |
270 | * the label to be used for displaying the collection. | |
271 | */ | |
272 | public String getCollectionLabel(String entryName, String collectionName); | |
273 | ||
274 | ||
275 | /** | |
276 | * the short label to be used for displaying the collection. | |
277 | */ | |
278 | public String getCollectionShortLabel(String entryName, String collectionName); | |
279 | ||
280 | /** | |
281 | * the element label to be used for displaying the collection. | |
282 | */ | |
283 | public String getCollectionElementLabel(String entryName, String collectionName, Class businessObjectClass); | |
284 | ||
285 | ||
286 | /** | |
287 | * short help text for collection | |
288 | */ | |
289 | public String getCollectionSummary(String entryName, String collectionName); | |
290 | ||
291 | ||
292 | /** | |
293 | * detailed help text for collection | |
294 | */ | |
295 | public String getCollectionDescription(String entryName, String collectionName); | |
296 | ||
297 | ||
298 | /** | |
299 | * @param entryName | |
300 | * @param relationshipName | |
301 | * @return source Class for the given relationship, or null if there is no relationship with that name | |
302 | */ | |
303 | public Class<? extends BusinessObject> getRelationshipSourceClass(String entryName, String relationshipName); | |
304 | ||
305 | /** | |
306 | * @param entryName | |
307 | * @param relationshipName | |
308 | * @return target Class for the given relationship, or null if there is no relationship with that name | |
309 | */ | |
310 | public Class<? extends BusinessObject> getRelationshipTargetClass(String entryName, String relationshipName); | |
311 | ||
312 | /** | |
313 | * @param entryName | |
314 | * @param relationshipName | |
315 | * @return List<String> of source attributeNames for the given relationship, or null if there is no relationship with that name | |
316 | */ | |
317 | public List<String> getRelationshipSourceAttributes(String entryName, String relationshipName); | |
318 | ||
319 | /** | |
320 | * @param entryName | |
321 | * @param relationshipName | |
322 | * @return List<String> of target attributeNames for the given relationship, or null if there is no relationship with that name | |
323 | */ | |
324 | public List<String> getRelationshipTargetAttributes(String entryName, String relationshipName); | |
325 | ||
326 | /** | |
327 | * | |
328 | * returns a Map that specifies the attributes of the relationship | |
329 | * @param entryName - Name of the Business Object entry | |
330 | * @param relationshipName - Name of the relationship | |
331 | * @return Map - Target field as key, source field as value | |
332 | */ | |
333 | public Map<String, String> getRelationshipAttributeMap(String entryName, String relationshipName); | |
334 | ||
335 | /** | |
336 | * returns a list of names for all entries whose source parameter matches the parameter | |
337 | * @param entryName Name of the Business Object entry | |
338 | * @param sourceAttributeName name of the source attribute | |
339 | * @return the names of all entries that use the sourceAttributeName as a primitive attribute | |
340 | */ | |
341 | public List<String> getRelationshipEntriesForSourceAttribute(String entryName, String sourceAttributeName); | |
342 | ||
343 | /** | |
344 | * returns a list of names for all entries whose source parameter matches the parameter | |
345 | * @param entryName Name of the Business Object entry | |
346 | * @param targetAttributeName name of the target attribute | |
347 | * @return the names of all entries that use the targetAttributeName as a primitive attribute | |
348 | */ | |
349 | public List<String> getRelationshipEntriesForTargetAttribute(String entryName, String targetAttributeName); | |
350 | ||
351 | /** | |
352 | * Determines whether there is a relationship defined for the given entry with the given name | |
353 | * @param entryName name of the BO entry | |
354 | * @param relationshipName name of the relationship for the entry | |
355 | * @return true iff there is a relationship with the given name defined for the BO entry in the DD | |
356 | */ | |
357 | public boolean hasRelationship(String entryName, String relationshipName); | |
358 | ||
359 | /** | |
360 | * Returns all of the relationships defined for a BO in the DD | |
361 | * @param name of the BO entry | |
362 | * @return a list of all DD defined mappings | |
363 | */ | |
364 | public List<String> getRelationshipNames(String entryName); | |
365 | ||
366 | // /** | |
367 | // * Returns the list of document class names | |
368 | // * | |
369 | // * @return | |
370 | // */ | |
371 | // public List getDocumentObjectClassnames(); | |
372 | ||
373 | /** | |
374 | * This method returns the user friendly label based on the workflow doc type name | |
375 | * @param documentTypeName | |
376 | * @return label | |
377 | */ | |
378 | public String getDocumentLabelByTypeName(String documentTypeName); | |
379 | ||
380 | /** | |
381 | * This method returns the user friendly label based on the document or business object class | |
382 | * @param documentTypeName | |
383 | * @return label | |
384 | */ | |
385 | public String getDocumentLabelByClass(Class documentOrBusinessObjectClass); | |
386 | ||
387 | /** | |
388 | * Returns the document type name declared in the dd for the given document | |
389 | * class. If no valid document type is found 'null' is returned. | |
390 | * | |
391 | * @param documentClass | |
392 | * @return documentTypeName | |
393 | */ | |
394 | public String getDocumentTypeNameByClass(Class documentClass); | |
395 | ||
396 | /** | |
397 | * Returns the document type name declared in the dd for the given document | |
398 | * class. If no valid document type is found an | |
399 | * {@link UnknownDocumentTypeException} is thrown. | |
400 | * | |
401 | * @param documentClass | |
402 | * @return documentTypeName | |
403 | */ | |
404 | public String getValidDocumentTypeNameByClass(Class documentClass); | |
405 | ||
406 | /** | |
407 | * Returns the document class declared in the dd for the given document type | |
408 | * name. If no document entry is found with given document type name, 'null' | |
409 | * will be returned. | |
410 | * | |
411 | * @param documentTypeName | |
412 | * @return document Class | |
413 | */ | |
414 | public Class<? extends Document> getDocumentClassByTypeName(String documentTypeName); | |
415 | ||
416 | /** | |
417 | * Returns the document class declared in the dd for the given document type | |
418 | * name. If no document entry is found with given document type name, and | |
419 | * {@link UnknownDocumentTypeException} will be thrown. | |
420 | * | |
421 | * @param documentTypeName | |
422 | * @return document Class | |
423 | */ | |
424 | public Class<? extends Document> getValidDocumentClassByTypeName(String documentTypeName); | |
425 | ||
426 | /** | |
427 | * @param document | |
428 | * @return preRulesCheckClass associated with the given document's type | |
429 | */ | |
430 | public Class<? extends PromptBeforeValidation> getPromptBeforeValidationClass(String docTypeName); | |
431 | ||
432 | public Map getDataDictionaryMap(); | |
433 | ||
434 | /** | |
435 | * Returns all of the inactivation blocks registered for a particular business object | |
436 | * | |
437 | * @param inactivationBlockedBusinessObjectClass | |
438 | * @return a set of all registered inactivation blocks for a particular business object | |
439 | */ | |
440 | public Set<InactivationBlockingMetadata> getAllInactivationBlockingDefinitions(Class inactivationBlockedBusinessObjectClass); | |
441 | } |