001/**
002 * Copyright 2005-2016 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 */
016package org.kuali.rice.kns.service;
017
018import org.kuali.rice.kns.datadictionary.MaintainableCollectionDefinition;
019import org.kuali.rice.kns.datadictionary.MaintainableFieldDefinition;
020import org.kuali.rice.kns.datadictionary.MaintainableItemDefinition;
021import org.kuali.rice.kns.datadictionary.MaintainableSectionDefinition;
022import org.kuali.rice.krad.bo.PersistableBusinessObject;
023import org.kuali.rice.kns.datadictionary.MaintenanceDocumentEntry;
024import org.kuali.rice.kns.document.MaintenanceDocument;
025import org.kuali.rice.krad.rules.rule.BusinessRule;
026
027import java.util.Collection;
028import 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
037public 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    /**
097     * Returns whether or not this document's data dictionary file has flagged it to allow document copies
098     *
099     * @param document - maintenance document instance to check copy flag for
100     * @return boolean true if copies are allowed, false otherwise
101     */
102    public Boolean getAllowsCopy(MaintenanceDocument document);
103
104    /**
105     * Returns whether or not this document's data dictionary file has flagged it to allow maintenance new
106     * or copy actions
107     *
108     * @param document - maintenance document instance to check new or copy flag for
109     * @return boolean true if new or copy maintenance actions are allowed
110     */
111    public Boolean getAllowsNewOrCopy(String docTypeName);
112
113    public MaintenanceDocumentEntry getMaintenanceDocumentEntry(String docTypeName);
114
115    /**
116     * Indicates whether the configured locking keys for a class should be cleared on a maintenance
117     * copy action or values carried forward
118     *
119     * @param dataObjectClass - class for the data object to check
120     * @return boolean true if locking keys should be copied, false if they should be cleared
121     */
122    public boolean getPreserveLockingKeysOnCopy(Class dataObjectClass);
123
124    /**
125     * Indicates whether the given data object class is configured to allow record deletions
126     *
127     * @param dataObjectClass - class for the data object to check
128     * @return Boolean true if record deletion is allowed, false if not allowed, null if not configured
129     */
130    public Boolean getAllowsRecordDeletion(Class dataObjectClass);
131
132    /**
133     * Indicates whether the given maintenance document is configured to allow record deletions
134     *
135     * @param document - maintenance document instance to check
136     * @return Boolean true if record deletion is allowed, false if not allowed, null if not configured
137     */
138    public Boolean getAllowsRecordDeletion(MaintenanceDocument document);
139
140    /**
141     * Retrieves an instance of the class that represents the maintenance document. This is done by
142     *
143     * @param docTypeName
144     * @return A class instance.
145     */
146    public Class getMaintainableClass(String docTypeName);
147
148    /**
149     * A List of maintainable section object instances corresponding to the document type name.
150     *
151     * @param docTypeName
152     * @return A List of maintable section objects.
153     */
154    @Deprecated
155    public List<MaintainableSectionDefinition> getMaintainableSections(String docTypeName);
156
157    /**
158     *
159     * This method returns the defaultValue as it would appear in the UI on a maintenance document.
160     *
161     * If both a defaultValue and a defaultValueFinderClass is present in the MaintainableFieldDefinition instance, then the
162     * defaultValue will be preferentially returned. If only one is present, then that will be returned.
163     *
164     * Note that if a defaultValueFinderClass value is present, then this method will attempt to create a new instance of the
165     * specified class. If this attempt to generate a new instance fails, the error will be suppressed, and an null result will be
166     * returned.
167     *
168     * @param boClass - the class of BO being maintained
169     * @param fieldName - the fieldName of the attribute for which the default is desired
170     * @return the default if one is available, null otherwise
171     *
172     */
173    @Deprecated
174    public String getFieldDefaultValue(Class boClass, String fieldName);
175
176    /**
177     *
178     * This method returns the defaultValue as it would appear in the UI on a maintenance document.
179     *
180     * If both a defaultValue and a defaultValueFinderClass is present in the MaintainableFieldDefinition instance, then the
181     * defaultValue will be preferentially returned. If only one is present, then that will be returned.
182     *
183     * Note that if a defaultValueFinderClass value is present, then this method will attempt to create a new instance of the
184     * specified class. If this attempt to generate a new instance fails, the error will be suppressed, and an null result will be
185     * returned.
186     *
187     * @param docTypeName - the document type name of the maintainable
188     * @param fieldName - the fieldName of the attribute for which the default is desired
189     * @return the default if one is available, null otherwise
190     *
191     */
192    @Deprecated
193    public String getFieldDefaultValue(String docTypeName, String fieldName);
194
195    /**
196     *
197     * This method returns the defaultValue as it would appear in the UI on a maintenance document for a collection.
198     *
199     * If both a defaultValue and a defaultValueFinderClass is present in the MaintainableFieldDefinition instance, then the
200     * defaultValue will be preferentially returned. If only one is present, then that will be returned.
201     *
202     * Note that if a defaultValueFinderClass value is present, then this method will attempt to create a new instance of the
203     * specified class. If this attempt to generate a new instance fails, the error will be suppressed, and an null result will be
204     * returned.
205     *
206     * @param docTypeName - the document type name of the maintainable
207     * @param collectionName - the name attribute of the collection to which the field belongs
208     * @param fieldName - the fieldName of the attribute for which the default is desired
209     * @return the default if one is available, null otherwise
210     */
211    @Deprecated
212    public String getCollectionFieldDefaultValue(String docTypeName, String collectionName, String fieldName);
213
214    /**
215     * Returns the business object used to store the values for the given collection.
216     *
217     * @param docTypeName
218     * @param collectionName
219     * @return
220     */
221    @Deprecated
222    public Class getCollectionBusinessObjectClass( String docTypeName, String collectionName );
223
224    /**
225     * Returns the definition for the maintainable item identified by "itemName".
226     *
227     * @param docTypeName
228     * @param itemName
229     * @return The item or <b>null</b> if the item does not exist.
230     */
231    @Deprecated
232    public MaintainableItemDefinition getMaintainableItem( String docTypeName, String itemName );
233
234    /**
235     * Returns the definition for the maintainable field identified by "fieldName".
236     *
237     * @param docTypeName
238     * @param fieldName
239     * @return The field or <b>null</b> if the item does not exist or is not a field.
240     */
241    @Deprecated
242    public MaintainableFieldDefinition getMaintainableField( String docTypeName, String fieldName );
243
244    /**
245     * Returns the definition for the maintainable collection identified by "collectionName".
246     *
247     * @param docTypeName
248     * @param collectionName
249     * @return The collection or <b>null</b> if the item does not exist or is not a collection.
250     */
251    @Deprecated
252    public MaintainableCollectionDefinition getMaintainableCollection( String docTypeName, String collectionName );
253
254    /**
255     * Gets a list of all top-level maintainable collections on the document
256     *
257     * @param docTypeName
258     * @return
259     */
260    @Deprecated
261    public List<MaintainableCollectionDefinition> getMaintainableCollections( String docTypeName );
262
263    /**
264     * Returns a list of all collections within the given collection
265     *
266     * @param parentCollection
267     * @return
268     */
269    @Deprecated
270    public List<MaintainableCollectionDefinition> getMaintainableCollections( MaintainableCollectionDefinition parentCollection );
271
272
273    /**
274     * Validates the maintenance document contains values for the fields declared as required in the
275     * maintenance document data dictionary file.
276     *
277     * @param document
278     */
279    @Deprecated
280    public void validateMaintenanceRequiredFields(MaintenanceDocument document);
281
282    /**
283     * validates the collections of the maintenance document checking to see if duplicate entries in the collection exist
284     * @param document
285     */
286    public void validateMaintainableCollectionsForDuplicateEntries(MaintenanceDocument document);
287
288    @Deprecated
289    public void validateMaintainableCollectionsAddLineRequiredFields(MaintenanceDocument document, PersistableBusinessObject businessObject, String collectionName );
290
291    /**
292     * @param businessObjectClass - business object class for maintenance definition
293     * @return Boolean indicating whether translating of codes is configured to true in maintenance definition
294     */
295    @Deprecated
296    public Boolean translateCodes(Class businessObjectClass);
297
298}