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.krad.service;
017
018import org.kuali.rice.krad.datadictionary.DocumentEntry;
019import org.kuali.rice.krad.datadictionary.MaintenanceDocumentEntry;
020import org.kuali.rice.krad.document.Document;
021import org.kuali.rice.krad.document.DocumentAuthorizer;
022import org.kuali.rice.krad.document.DocumentPresentationController;
023import org.kuali.rice.krad.maintenance.MaintenanceDocument;
024import org.kuali.rice.krad.maintenance.Maintainable;
025import org.kuali.rice.krad.rules.rule.BusinessRule;
026
027import java.util.Collection;
028import java.util.List;
029
030/**
031 * Defines methods that a <code>DocumentEntry</code> Service must provide, and 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 */
036public interface DocumentDictionaryService {
037
038    /**
039     * Retrieves the label for the document as described in its data dictionary entry
040     *
041     * @param documentTypeName - document type name for the document entry to retrieve label for
042     * @return String document label
043     */
044    public String getLabel(String documentTypeName);
045
046    /**
047     * Retrieves the configured document type name for the maintenance document
048     * entry associated with the given data object class
049     *
050     * @param dataObjectClass - data object class for maintenance entry to retrieve
051     * @return String document type name for maintenance document
052     */
053    public String getMaintenanceDocumentTypeName(Class dataObjectClass);
054
055    /**
056     * Retrieves the full description of the document as described in its data dictionary entry
057     *
058     * @param documentTypeName - document type name for the document entry to retrieve description for
059     * @return String documents full description
060     */
061    public String getDescription(String documentTypeName);
062
063    /**
064     * Retrieves the collection of ReferenceDefinition objects defined as DefaultExistenceChecks
065     * for the MaintenanceDocument associated with the given data object class
066     *
067     * @param dataObjectClass - data object class for maintenance document
068     * @return Collection reference definitions for default existence checks
069     */
070    public Collection getDefaultExistenceChecks(Class dataObjectClass);
071
072    /**
073     * Retrieves the collection of ReferenceDefinition objects defined as DefaultExistenceChecks
074     * for the document instance
075     *
076     * @param document - document instance to pull document type for associated document entry
077     * @return Collection reference definitions for default existence checks
078     */
079    public Collection getDefaultExistenceChecks(Document document);
080
081    /**
082     * Retrieves the collection of ReferenceDefinition objects defined as DefaultExistenceChecks
083     * for the document entry associated with the given document type name
084     *
085     * @param docTypeName - document type name for document entry to pull existence checks for
086     * @return Collection reference definitions for default existence checks
087     */
088    public Collection getDefaultExistenceChecks(String docTypeName);
089
090    /**
091     * Retrieves the data object class configured for the maintenance entry
092     * associated with the given document type name
093     *
094     * @param docTypeName - document type name associated with maintenance document entry
095     * @return Class<?> data object class associated with maintenance document entry
096     */
097    public Class<?> getMaintenanceDataObjectClass(String docTypeName);
098
099    /**
100     * Retrieves the maintainable class instance that is configured in the maintenance document
101     * entry associated with the given document type name
102     *
103     * @param docTypeName - document type name to retrieve maintainable for
104     * @return Class<? extends Maintainable> maintainable class for document type name
105     */
106    public Class<? extends Maintainable> getMaintainableClass(String docTypeName);
107
108    /**
109     * Retrieves the configured business rule class configured for the document entry
110     * that is associated with the document type of the given document instance
111     *
112     * @param document - document instance to retrieve rule class for
113     * @return Class<? extends BusinessRule> businessRulesClass associated with the given document type
114     */
115    public Class<? extends BusinessRule> getBusinessRulesClass(Document document);
116
117    /**
118     * Returns whether or not this document's data dictionary file has flagged it to allow document copies
119     *
120     * @param document - document instance to check copy flag for
121     * @return boolean true if copies are allowed, false otherwise
122     */
123    public Boolean getAllowsCopy(Document document);
124
125    /**
126     * Returns whether or not this document's data dictionary file has flagged it to allow maintenance new
127     * or copy actions
128     *
129     * @param docTypeName - document type name to retrieve maintenance document entry for
130     * @return boolean true if new or copy maintenance actions are allowed
131     */
132    public Boolean getAllowsNewOrCopy(String docTypeName);
133
134    /**
135     * Retrieves the document entry that is associated with the given document type name
136     *
137     * @param docTypeName - document type name to retrieve document entry for
138     * @return DocumentEntry instance associated with document type
139     */
140    public DocumentEntry getDocumentEntry(String docTypeName);
141
142    /**
143     * Retrieves the document entry that is associated with the given document class
144     *
145     * @param documentClass - document class to retrieve document entry for
146     * @return DocumentEntry instance associated with document class
147     */
148    public DocumentEntry getDocumentEntryByClass(Class<? extends Document> documentClass);
149
150    /**
151     * Retrieves the maintenance document entry that is associated with the given document type name
152     *
153     * @param docTypeName - document type name to retrieve maintenance document entry for
154     * @return MaintenanceDocumentEntry instance associated with document type
155     */
156    public MaintenanceDocumentEntry getMaintenanceDocumentEntry(String docTypeName);
157
158    /**
159     * Retrieves the document class configured on the document entry associated with the
160     * given document type name
161     *
162     * @param documentTypeName - document type name to retrieve class for
163     * @return Class<?> document class associated with document type name
164     */
165    public Class<?> getDocumentClassByName(String documentTypeName);
166
167    /**
168     * Retrieves the document type configured on the document entry associated with the
169     * given document class
170     *
171     * @param documentClass - class for document to retrieve the document type for
172     * @return String document type associated with document type name
173     */
174    public String getDocumentTypeByClass(Class<? extends Document> documentClass);
175
176    /**
177     * Indicates whether the given data object class is configured to allow record deletions
178     *
179     * @param dataObjectClass - class for the data object to check
180     * @return Boolean true if record deletion is allowed, false if not allowed, null if not configured
181     */
182    public Boolean getAllowsRecordDeletion(Class dataObjectClass);
183
184    /**
185     * Indicates whether the given maintenance document is configured to allow record deletions
186     *
187     * @param document - maintenance document instance to check
188     * @return Boolean true if record deletion is allowed, false if not allowed, null if not configured
189     */
190    public Boolean getAllowsRecordDeletion(MaintenanceDocument document);
191
192    /**
193     * Retrieves the list of property names that are configured as locking keys for the maintenance
194     * document entry associated with the given document type name
195     *
196     * @param docTypeName - document type name to retrieve maintenance document entry for
197     * @return List<String> list of locking key property names
198     */
199    public List<String> getLockingKeys(String docTypeName);
200
201    /**
202     * Indicates whether the configured locking keys for a class should be cleared on a maintenance
203     * copy action or values carried forward
204     *
205     * @param dataObjectClass - class for the data object to check
206     * @return boolean true if locking keys should be copied, false if they should be cleared
207     */
208    public boolean getPreserveLockingKeysOnCopy(Class dataObjectClass);
209
210    /**
211     * Retrieves the list of property names that should be cleared when an object of type dataObjectClass
212     * is copied.
213     *
214     * @param dataObjectClass - class for the data object to check
215     * @return List<String> list of property names to be cleared
216     */
217    public List<String> getClearValueOnCopyPropertyNames(Class dataObjectClass);
218
219    /**
220     * Retrieves the {@link DocumentAuthorizer} configured on the document entry with the given document type
221     * name
222     *
223     * @param documentType - document type name to retrieve document entry and associated authorizer for
224     * @return DocumentAuthorizer authorizer instance
225     */
226    public DocumentAuthorizer getDocumentAuthorizer(String documentType);
227
228    /**
229     * Retrieves the {@link DocumentAuthorizer} configured on the document entry for the document type associated
230     * with the document instance
231     *
232     * @param document - document instance to retrieve document entry and associated authorizer for
233     * @return DocumentAuthorizer authorizer instance
234     */
235    public DocumentAuthorizer getDocumentAuthorizer(Document document);
236
237    /**
238     * Retrieves the {@link DocumentPresentationController} configured on the document entry with the given document
239     * type name
240     *
241     * @param documentType - document type name to retrieve document entry and associated presentation controller for
242     * @return DocumentPresentationController instance
243     */
244    public DocumentPresentationController getDocumentPresentationController(String documentType);
245
246    /**
247     * Retrieves the {@link DocumentPresentationController} configured on the document entry for the document type
248     * associated with the document instance
249     *
250     * @param document - document instance to retrieve document entry and associated presentation controller for
251     * @return DocumentPresentationController instance
252     */
253    public DocumentPresentationController getDocumentPresentationController(Document document);
254}