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