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