001: /*
002: * Copyright 2005-2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.kuali.core.service;
017:
018: import java.math.BigDecimal;
019: import java.util.List;
020: import java.util.Map;
021: import java.util.regex.Pattern;
022:
023: import org.kuali.core.datadictionary.DataDictionary;
024: import org.kuali.core.datadictionary.control.ControlDefinition;
025: import org.kuali.core.datadictionary.exception.SourceException;
026: import org.kuali.core.datadictionary.mask.Mask;
027:
028: /**
029: * This interface defines the API for interacting with the data dictionary.
030: *
031: *
032: */
033: public interface DataDictionaryService {
034: /**
035: * Sequentially adds each package named (as a String) in the given List as a source of unique entries to the DataDictionary
036: * being constructed. Duplicate entries among any of the XML files in any of these packages will result in exceptions being
037: * thrown, hence service-initialization failure.
038: *
039: * @param baselinePackages
040: * @throws SourceException if any of the given packages can't be located
041: */
042: public void setBaselinePackages(List baselinePackages);
043:
044: /**
045: * @return current DataDictionary
046: */
047: public DataDictionary getDataDictionary();
048:
049: public void addDataDictionaryLocations(List<String> locations);
050:
051: // /**
052: // * Hook to allow the dataDictionary service to perform any post-build initialization tasks needed before the dataDictionary
053: // * itself will be publicly available.
054: // */
055: // public void completeInitialization();
056:
057: /**
058: * the html control type used to render the field
059: */
060: public ControlDefinition getAttributeControlDefinition(
061: Class businessObjectClass, String attributeName);
062:
063: /**
064: * the display size of the field if text control
065: */
066: public Integer getAttributeSize(Class businessObjectClass,
067: String attributeName);
068:
069: /**
070: * the max length defined for the given attribute name.
071: */
072: public Integer getAttributeMaxLength(Class businessObjectClass,
073: String attributeName);
074:
075: /**
076: * the regular expression defined to validate the given attribute name.
077: */
078: public Pattern getAttributeValidatingExpression(
079: Class businessObjectClass, String attributeName);
080:
081: /**
082: * the label to be used for displaying the attribute.
083: */
084: public String getAttributeLabel(Class businessObjectClass,
085: String attributeName);
086:
087: /**
088: * the short label to be used for displaying the attribute.
089: */
090: public String getAttributeShortLabel(Class businessObjectClass,
091: String attributeName);
092:
093: /**
094: * the "label (short label)" used for displaying error messages
095: */
096: public String getAttributeErrorLabel(Class businessObjectClass,
097: String attributeName);
098:
099: /**
100: * the formatter class used to format the attribute value
101: */
102: public Class getAttributeFormatter(Class businessObjectClass,
103: String attributeName);
104:
105: /**
106: * indicates whether or not to force input text into uppercase
107: */
108: public Boolean getAttributeForceUppercase(
109: Class businessObjectClass, String attributeName);
110:
111: /**
112: * the workgroup name (if specified) who has permission to view values for the field
113: */
114: public String getAttributeDisplayWorkgroup(
115: Class businessObjectClass, String attributeName);
116:
117: /**
118: * the Mask object defined for masking the attribute's data value
119: */
120: public Mask getAttributeDisplayMask(Class businessObjectClass,
121: String attributeName);
122:
123: /**
124: * short help text for attribute
125: */
126: public String getAttributeSummary(Class businessObjectClass,
127: String attributeName);
128:
129: /**
130: * detailed help text for attribute
131: */
132: public String getAttributeDescription(Class businessObjectClass,
133: String attributeName);
134:
135: /**
136: * indicates whether or not the named attribute is required
137: */
138: public Boolean isAttributeRequired(Class businessObjectClass,
139: String attributeName);
140:
141: /**
142: * indicates whether or not the named attribute is defined in the business object xml
143: */
144: public Boolean isAttributeDefined(Class businessObjectClass,
145: String attributeName);
146:
147: /**
148: * the Class that returns a values list for this attribute
149: */
150: public Class getAttributeValuesFinderClass(
151: Class businessObjectClass, String attributeName);
152:
153: /**
154: * the label to be used for displaying the collection.
155: */
156: public String getCollectionLabel(Class businessObjectClass,
157: String collectionName);
158:
159: /**
160: * the short label to be used for displaying the collection.
161: */
162: public String getCollectionShortLabel(Class businessObjectClass,
163: String collectionName);
164:
165: /**
166: * short help text for collection
167: */
168: public String getCollectionSummary(Class businessObjectClass,
169: String collectionName);
170:
171: /**
172: * detailed help text for collection
173: */
174: public String getCollectionDescription(Class businessObjectClass,
175: String collectionName);
176:
177: /**
178: * the html control type used to render the field
179: */
180: public ControlDefinition getAttributeControlDefinition(
181: String entryName, String attributeName);
182:
183: /**
184: * the display size of the field if text control
185: */
186: public Integer getAttributeSize(String entryName,
187: String attributeName);
188:
189: /**
190: * the max length defined for the given attribute name.
191: */
192: public Integer getAttributeMaxLength(String entryName,
193: String attributeName);
194:
195: /**
196: * @param entryName
197: * @param attributeName
198: * @return the exclusive minimum for the specified attribute, or <code>null</code> if none.
199: */
200: public BigDecimal getAttributeExclusiveMin(String entryName,
201: String attributeName);
202:
203: /**
204: * @param entryName
205: * @param attributeName
206: * @return the inclusive maximum for the specified attribute, or <code>null</code> if none.
207: */
208: public BigDecimal getAttributeInclusiveMax(String entryName,
209: String attributeName);
210:
211: /**
212: * the regular expression defined to validate the given attribute name.
213: */
214: public Pattern getAttributeValidatingExpression(String entryName,
215: String attributeName);
216:
217: /**
218: * the label to be used for displaying the attribute.
219: */
220: public String getAttributeLabel(String entryName,
221: String attributeName);
222:
223: /**
224: * the short label to be used for displaying the attribute.
225: */
226: public String getAttributeShortLabel(String entryName,
227: String attributeName);
228:
229: /**
230: * the "label (short label)" used for displaying error messages
231: */
232: public String getAttributeErrorLabel(String entryName,
233: String attributeName);
234:
235: /**
236: * the formatter class used to format the attribute value
237: */
238: public Class getAttributeFormatter(String entryName,
239: String attributeName);
240:
241: /**
242: * indicates whether or not to force input text into uppercase
243: */
244: public Boolean getAttributeForceUppercase(String entryName,
245: String attributeName);
246:
247: /**
248: * the workgroup name (if specified) who has permission to view values for the field
249: */
250: public String getAttributeDisplayWorkgroup(String entryName,
251: String attributeName);
252:
253: /**
254: * the Mask object defined for masking the attribute's data value
255: */
256: public Mask getAttributeDisplayMask(String entryName,
257: String attributeName);
258:
259: /**
260: * short help text for attribute
261: */
262: public String getAttributeSummary(String entryName,
263: String attributeName);
264:
265: /**
266: * detailed help text for attribute
267: */
268: public String getAttributeDescription(String entryName,
269: String attributeName);
270:
271: /**
272: * indicates whether or not the named attribute is required
273: */
274: public Boolean isAttributeRequired(String entryName,
275: String attributeName);
276:
277: /**
278: * indicates whether or not the named attribute is defined in the business object xml
279: */
280: public Boolean isAttributeDefined(String entryName,
281: String attributeName);
282:
283: /**
284: * the Class that returns a values list for this attribute
285: */
286: public Class getAttributeValuesFinderClass(String entryName,
287: String attributeName);
288:
289: /**
290: * the label to be used for displaying the collection.
291: */
292: public String getCollectionLabel(String entryName,
293: String collectionName);
294:
295: /**
296: * the short label to be used for displaying the collection.
297: */
298: public String getCollectionShortLabel(String entryName,
299: String collectionName);
300:
301: /**
302: * the element label to be used for displaying the collection.
303: */
304: public String getCollectionElementLabel(String entryName,
305: String collectionName, Class businessObjectClass);
306:
307: /**
308: * short help text for collection
309: */
310: public String getCollectionSummary(String entryName,
311: String collectionName);
312:
313: /**
314: * detailed help text for collection
315: */
316: public String getCollectionDescription(String entryName,
317: String collectionName);
318:
319: /**
320: * @param entryName
321: * @param relationshipName
322: * @return source Class for the given relationship, or null if there is no relationship with that name
323: */
324: public Class getRelationshipSourceClass(String entryName,
325: String relationshipName);
326:
327: /**
328: * @param entryName
329: * @param relationshipName
330: * @return target Class for the given relationship, or null if there is no relationship with that name
331: */
332: public Class getRelationshipTargetClass(String entryName,
333: String relationshipName);
334:
335: /**
336: * @param entryName
337: * @param relationshipName
338: * @return List<String> of source attributeNames for the given relationship, or null if there is no relationship with that name
339: */
340: public List<String> getRelationshipSourceAttributes(
341: String entryName, String relationshipName);
342:
343: /**
344: * @param entryName
345: * @param relationshipName
346: * @return List<String> of target attributeNames for the given relationship, or null if there is no relationship with that name
347: */
348: public List<String> getRelationshipTargetAttributes(
349: String entryName, String relationshipName);
350:
351: /**
352: *
353: * returns a Map that specifies the attributes of the relationship
354: * @param entryName - Name of the Business Object entry
355: * @param relationshipName - Name of the relationship
356: * @return Map - Target field as key, source field as value
357: */
358: public Map<String, String> getRelationshipAttributeMap(
359: String entryName, String relationshipName);
360:
361: /**
362: * returns a list of names for all entries whose source parameter matches the parameter
363: * @param entryName Name of the Business Object entry
364: * @param sourceAttributeName name of the source attribute
365: * @return the names of all entries that use the sourceAttributeName as a primitive attribute
366: */
367: public List<String> getRelationshipEntriesForSourceAttribute(
368: String entryName, String sourceAttributeName);
369:
370: /**
371: * returns a list of names for all entries whose source parameter matches the parameter
372: * @param entryName Name of the Business Object entry
373: * @param targetAttributeName name of the target attribute
374: * @return the names of all entries that use the targetAttributeName as a primitive attribute
375: */
376: public List<String> getRelationshipEntriesForTargetAttribute(
377: String entryName, String targetAttributeName);
378:
379: /**
380: * Determines whether there is a relationship defined for the given entry with the given name
381: * @param entryName name of the BO entry
382: * @param relationshipName name of the relationship for the entry
383: * @return true iff there is a relationship with the given name defined for the BO entry in the DD
384: */
385: public boolean hasRelationship(String entryName,
386: String relationshipName);
387:
388: /**
389: * Returns all of the relationships defined for a BO in the DD
390: * @param name of the BO entry
391: * @return a list of all DD defined mappings
392: */
393: public List<String> getRelationshipNames(String entryName);
394:
395: // /**
396: // * Returns the list of document class names
397: // *
398: // * @return
399: // */
400: // public List getDocumentObjectClassnames();
401:
402: /**
403: * This method returns the user friendly label based on the workflow doc type name
404: * @param documentTypeName
405: * @return label
406: */
407: public String getDocumentLabelByTypeName(String documentTypeName);
408:
409: /**
410: * This method returns the user friendly label based on the document or business object class
411: * @param documentTypeName
412: * @return label
413: */
414: public String getDocumentLabelByClass(
415: Class documentOrBusinessObjectClass);
416:
417: /**
418: * Returns the document type name declared in the dd for the given document class.
419: *
420: * @param documentClass
421: * @return documentTypeName
422: */
423: public String getDocumentTypeNameByClass(Class documentClass);
424:
425: /**
426: * Returns the document class declared in the dd for the given document type name.
427: *
428: * @param documentTypeName
429: * @return document Class
430: */
431: public Class getDocumentClassByTypeName(String documentTypeName);
432:
433: /**
434: * Returns the document type code declared in the dd for the given document type name.
435: *
436: * @param documentTypeName
437: * @return documentTypeCode
438: */
439: public String getDocumentTypeCodeByTypeName(String documentTypeName);
440:
441: // /**
442: // * Returns the document type name declared in the dd for the given document type code.
443: // *
444: // * @param documentTypeName
445: // * @return documentTypeCode if the documentTypeName is registered, otherwise returns Null
446: // */
447: // public String getDocumentTypeNameByTypeCode(String documentTypeCode);
448:
449: /**
450: * @param document
451: * @return preRulesCheckClass associated with the given document's type
452: */
453: public Class getPreRulesCheckClass(String docTypeName);
454:
455: /**
456: * Adds entries to the data dictionary.
457: *
458: * @return
459: */
460: // public void addUniqueEntries(String sourceName, boolean sourceMustExist);
461: public Map getDataDictionaryMap();
462:
463: /**
464: * Forces the DD to completely load itself immediately. Used by application components which require
465: * a complete list of all BO and document components.
466: */
467: public void forceCompleteDataDictionaryLoad();
468: }
|