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.util.Collection;
019: import java.util.List;
020:
021: import org.kuali.core.bo.PersistableBusinessObject;
022: import org.kuali.core.datadictionary.MaintainableCollectionDefinition;
023: import org.kuali.core.datadictionary.MaintainableFieldDefinition;
024: import org.kuali.core.datadictionary.MaintainableItemDefinition;
025: import org.kuali.core.datadictionary.MaintainableSectionDefinition;
026: import org.kuali.core.datadictionary.MaintenanceDocumentEntry;
027: import org.kuali.core.document.MaintenanceDocument;
028:
029: /**
030: * This interface defines methods that a MaintenanceDocumentDictionary Service must provide. Defines the API for the interacting
031: * with Document-related entries in the data dictionary.
032: *
033: *
034: */
035: public interface MaintenanceDocumentDictionaryService {
036: /**
037: * Retrieves the label for a maintenance document.
038: *
039: * @param docTypeName
040: * @return The label as a String.
041: */
042: public String getMaintenanceLabel(String docTypeName);
043:
044: /**
045: * Retrieves the description of the maintenance document.
046: *
047: * @param docTypeName
048: * @return The description as a String.
049: */
050: public String getMaintenanceDescription(String docTypeName);
051:
052: /**
053: * Retrieves an instance of the class that represents the maintenance document. This is done by
054: *
055: * @param docTypeName
056: * @return A class instance.
057: */
058: public Class getMaintainableClass(String docTypeName);
059:
060: /**
061: * The document type name for a class instance.
062: *
063: * @param businessObjectClass
064: * @return The document type name for the class as a String.
065: */
066: public String getDocumentTypeName(Class businessObjectClass);
067:
068: /**
069: * The collection of ReferenceDefinition objects defined as DefaultExistenceChecks for the MaintenanceDocument.
070: *
071: * @param businessObjectClass
072: * @return A Collection of ReferenceDefinitions
073: */
074: public Collection getDefaultExistenceChecks(
075: Class businessObjectClass);
076:
077: /**
078: * The collection of ReferenceDefinition objects defined as DefaultExistenceChecks for the MaintenanceDocument.
079: *
080: * @param docTypeName
081: * @return A Collection of ReferenceDefinitions
082: */
083: public Collection getDefaultExistenceChecks(String docTypeName);
084:
085: /**
086: * The collection of apcRuleDefinition objects defined as applyApcRules for the MaintenanceDocument
087: *
088: * @param businessObjectClass
089: * @return A collection of ApcRuleDefinitions
090: */
091: public Collection getApplyApcRules(Class businessObjectClass);
092:
093: /**
094: * The collection of apcRuleDefinition objects defined as applyApcRules for the MaintenanceDocument
095: *
096: * @param docTypeName
097: * @return A collection of ApcRuleDefinitions
098: */
099: public Collection getApplyApcRules(String docTypeName);
100:
101: /**
102: * A List of field names used as locking keys
103: *
104: * @param docTypeName
105: * @return A List of strings
106: */
107: public List getLockingKeys(String docTypeName);
108:
109: /**
110: * A List of maintainable section object instances corresponding to the document type name.
111: *
112: * @param docTypeName
113: * @return A List of maintable section objects.
114: */
115: public List<MaintainableSectionDefinition> getMaintainableSections(
116: String docTypeName);
117:
118: /**
119: * The instance of the business object class associated with this document type name.
120: *
121: * @param docTypeName
122: * @return The class instance corresponding to the document type name.
123: */
124: public Class getBusinessObjectClass(String docTypeName);
125:
126: /**
127: * @param document
128: * @return businessRulesClass associated with the given document's type
129: */
130: public Class getBusinessRulesClass(MaintenanceDocument document);
131:
132: /**
133: *
134: * This method returns the defaultValue as it would appear in the UI on a maintenance document.
135: *
136: * If both a defaultValue and a defaultValueFinderClass is present in the MaintainableFieldDefinition instance, then the
137: * defaultValue will be preferentially returned. If only one is present, then that will be returned.
138: *
139: * Note that if a defaultValueFinderClass value is present, then this method will attempt to create a new instance of the
140: * specified class. If this attempt to generate a new instance fails, the error will be suppressed, and an null result will be
141: * returned.
142: *
143: * @param boClass - the class of BO being maintained
144: * @param fieldName - the fieldName of the attribute for which the default is desired
145: * @return the default if one is available, null otherwise
146: *
147: */
148: public String getFieldDefaultValue(Class boClass, String fieldName);
149:
150: /**
151: *
152: * This method returns the defaultValue as it would appear in the UI on a maintenance document.
153: *
154: * If both a defaultValue and a defaultValueFinderClass is present in the MaintainableFieldDefinition instance, then the
155: * defaultValue will be preferentially returned. If only one is present, then that will be returned.
156: *
157: * Note that if a defaultValueFinderClass value is present, then this method will attempt to create a new instance of the
158: * specified class. If this attempt to generate a new instance fails, the error will be suppressed, and an null result will be
159: * returned.
160: *
161: * @param docTypeName - the document type name of the maintainable
162: * @param fieldName - the fieldName of the attribute for which the default is desired
163: * @return the default if one is available, null otherwise
164: *
165: */
166: public String getFieldDefaultValue(String docTypeName,
167: String fieldName);
168:
169: /**
170: *
171: * This method returns the defaultValue as it would appear in the UI on a maintenance document for a collection.
172: *
173: * If both a defaultValue and a defaultValueFinderClass is present in the MaintainableFieldDefinition instance, then the
174: * defaultValue will be preferentially returned. If only one is present, then that will be returned.
175: *
176: * Note that if a defaultValueFinderClass value is present, then this method will attempt to create a new instance of the
177: * specified class. If this attempt to generate a new instance fails, the error will be suppressed, and an null result will be
178: * returned.
179: *
180: * @param docTypeName - the document type name of the maintainable
181: * @param collectionName - the name attribute of the collection to which the field belongs
182: * @param fieldName - the fieldName of the attribute for which the default is desired
183: * @return the default if one is available, null otherwise
184: */
185: public String getCollectionFieldDefaultValue(String docTypeName,
186: String collectionName, String fieldName);
187:
188: /**
189: * Returns whether or not this document's data dictionary file has flagged it to allow document copies.
190: *
191: * @param document
192: * @return True if copies are allowed, false otherwise.
193: */
194: public Boolean getAllowsCopy(MaintenanceDocument document);
195:
196: /**
197: * Returns whether or not this document's data dictionary file has flagged it to allow maintenance new
198: * or copy actions.
199: *
200: * @param document
201: * @return True if new or copy maintenance actions are allowed
202: */
203: public Boolean getAllowsNewOrCopy(String docTypeName);
204:
205: /**
206: * Returns the business object used to store the values for the given collection.
207: *
208: * @param docTypeName
209: * @param collectionName
210: * @return
211: */
212: public Class getCollectionBusinessObjectClass(String docTypeName,
213: String collectionName);
214:
215: /**
216: * Returns the definition for the maintainable item identified by "itemName".
217: *
218: * @param docTypeName
219: * @param itemName
220: * @return The item or <b>null</b> if the item does not exist.
221: */
222: public MaintainableItemDefinition getMaintainableItem(
223: String docTypeName, String itemName);
224:
225: /**
226: * Returns the definition for the maintainable field identified by "fieldName".
227: *
228: * @param docTypeName
229: * @param fieldName
230: * @return The field or <b>null</b> if the item does not exist or is not a field.
231: */
232: public MaintainableFieldDefinition getMaintainableField(
233: String docTypeName, String fieldName);
234:
235: /**
236: * Returns the definition for the maintainable collection identified by "collectionName".
237: *
238: * @param docTypeName
239: * @param collectionName
240: * @return The collection or <b>null</b> if the item does not exist or is not a collection.
241: */
242: public MaintainableCollectionDefinition getMaintainableCollection(
243: String docTypeName, String collectionName);
244:
245: /* They are returned in order of discovery (depth-first search) */
246: /**
247: * Gets a list of all top-level maintainable collections on the document.
248: *
249: *
250: * @param docTypeName
251: * @return
252: */
253: public List<MaintainableCollectionDefinition> getMaintainableCollections(
254: String docTypeName);
255:
256: /**
257: * Returns a list of all collections within the given collection
258: *
259: * @param parentCollection
260: * @return
261: */
262: public List<MaintainableCollectionDefinition> getMaintainableCollections(
263: MaintainableCollectionDefinition parentCollection);
264:
265: /**
266: * Validates the maintenance document contains values for the fields declared as required in the
267: * maintenance document data dictionary file.
268: *
269: * @param document
270: */
271: public void validateMaintenanceRequiredFields(
272: MaintenanceDocument document);
273:
274: /**
275: * validates the collections of the maintenance document checking to see if duplicate entries in the collection exist
276: * @param document
277: */
278: public void validateMaintainableCollectionsForDuplicateEntries(
279: MaintenanceDocument document);
280:
281: public void validateMaintainableCollectionsAddLineRequiredFields(
282: MaintenanceDocument document,
283: PersistableBusinessObject businessObject,
284: String collectionName);
285:
286: public MaintenanceDocumentEntry getMaintenanceDocumentEntry(
287: String docTypeName);
288: }
|