View Javadoc

1   /**
2    * Copyright 2005-2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krad.service;
17  
18  import org.kuali.rice.krad.datadictionary.MaintenanceDocumentEntry;
19  import org.kuali.rice.krad.document.Document;
20  import org.kuali.rice.krad.document.MaintenanceDocument;
21  import org.kuali.rice.krad.maintenance.Maintainable;
22  import org.kuali.rice.krad.rule.BusinessRule;
23  
24  import java.util.Collection;
25  import java.util.List;
26  
27  /**
28   * Defines methods that a <code>DocumentEntry</code> Service must provide, and the API for the interacting
29   * with Document-related entries in the data dictionary
30   *
31   * @author Kuali Rice Team (rice.collab@kuali.org)
32   */
33  public interface DocumentDictionaryService {
34  
35      /**
36       * Retrieves the label for the document as described in its data dictionary entry
37       *
38       * @param documentTypeName - document type name for the document entry to retrieve label for
39       * @return String document label
40       */
41      public String getLabel(String documentTypeName);
42  
43      /**
44       * Retrieves the configured document type name for the maintenance document
45       * entry associated with the given data object class
46       *
47       * @param dataObjectClass - data object class for maintenance entry to retrieve
48       * @return String document type name for maintenance document
49       */
50      public String getMaintenanceDocumentTypeName(Class dataObjectClass);
51  
52      /**
53       * Retrieves the full description of the document as described in its data dictionary entry
54       *
55       * @param documentTypeName - document type name for the document entry to retrieve description for
56       * @return String documents full description
57       */
58      public String getDescription(String documentTypeName);
59  
60      /**
61       * Retrieves the collection of ReferenceDefinition objects defined as DefaultExistenceChecks
62       * for the MaintenanceDocument associated with the given data object class
63       *
64       * @param dataObjectClass - data object class for maintenance document
65       * @return Collection reference definitions for default existence checks
66       */
67      public Collection getDefaultExistenceChecks(Class dataObjectClass);
68  
69      /**
70       * Retrieves the collection of ReferenceDefinition objects defined as DefaultExistenceChecks
71       * for the document instance
72       *
73       * @param document - document instance to pull document type for associated document entry
74       * @return Collection reference definitions for default existence checks
75       */
76      public Collection getDefaultExistenceChecks(Document document);
77  
78      /**
79       * Retrieves the collection of ReferenceDefinition objects defined as DefaultExistenceChecks
80       * for the document entry associated with the given document type name
81       *
82       * @param docTypeName - document type name for document entry to pull existence checks for
83       * @return Collection reference definitions for default existence checks
84       */
85      public Collection getDefaultExistenceChecks(String docTypeName);
86  
87      /**
88       * Retrieves the data object class configured for the maintenance entry
89       * associated with the given document type name
90       *
91       * @param docTypeName - document type name associated with maintenance document entry
92       * @return Class<?> data object class associated with maintenance document entry
93       */
94      public Class<?> getMaintenanceDataObjectClass(String docTypeName);
95  
96      /**
97       * Retrieves the maintainable class instance that is configured in the maintenance document
98       * entry associated with the given document type name
99       *
100      * @param docTypeName - document type name to retrieve maintainable for
101      * @return Class<? extends Maintainable> maintainable class for document type name
102      */
103     public Class<? extends Maintainable> getMaintainableClass(String docTypeName);
104 
105     /**
106      * Retrieves the configured business rule class configured for the document entry
107      * that is associated with the document type of the given document instance
108      *
109      * @param document - document instance to retrieve rule class for
110      * @return Class<? extends BusinessRule> businessRulesClass associated with the given document type
111      */
112     public Class<? extends BusinessRule> getBusinessRulesClass(Document document);
113 
114     /**
115      * Returns whether or not this document's data dictionary file has flagged it to allow document copies
116      *
117      * @param document - document instance to check copy flag for
118      * @return boolean true if copies are allowed, false otherwise
119      */
120     public Boolean getAllowsCopy(Document document);
121 
122     /**
123      * Returns whether or not this document's data dictionary file has flagged it to allow maintenance new
124      * or copy actions
125      *
126      * @param document - maintenance document instance to check new or copy flag for
127      * @return boolean true if new or copy maintenance actions are allowed
128      */
129     public Boolean getAllowsNewOrCopy(String docTypeName);
130 
131     /**
132      * Retrieves the maintenance document entry that is associated with the given document type name
133      *
134      * @param docTypeName - document type name to retrieve maintenance document entry for
135      * @return MaintenanceDocumentEntry instance associated with document type
136      */
137     public MaintenanceDocumentEntry getMaintenanceDocumentEntry(String docTypeName);
138 
139     /**
140      * Retrieves the document class configured on the document entry associated with the
141      * given document type name
142      *
143      * @param documentTypeName - document type name to retrieve class for
144      * @return Class<?> document class associated with document type name
145      */
146     public Class<?> getDocumentClassByName(String documentTypeName);
147 
148     /**
149      * Indicates whether the given data object class is configured to allow record deletions
150      *
151      * @param dataObjectClass - class for the data object to check
152      * @return Boolean true if record deletion is allowed, false if not allowed, null if not configured
153      */
154     public Boolean getAllowsRecordDeletion(Class dataObjectClass);
155 
156     /**
157      * Indicates whether the given maintenance document is configured to allow record deletions
158      *
159      * @param document - maintenance document instance to check
160      * @return Boolean true if record deletion is allowed, false if not allowed, null if not configured
161      */
162     public Boolean getAllowsRecordDeletion(MaintenanceDocument document);
163 
164     /**
165      * Retrieves the list of property names that are configured as locking keys for the maintenance
166      * document entry associated with the given document type name
167      *
168      * @param docTypeName - document type name to retrieve maintenance document entry for
169      * @return List<String> list of locking key property names
170      */
171     public List<String> getLockingKeys(String docTypeName);
172 
173     /**
174      * Indicates whether the configured locking keys for a class should be cleared on a maintenance
175      * copy action or values carried forward
176      *
177      * @param dataObjectClass - class for the data object to check
178      * @return boolean true if locking keys should be copied, false if they should be cleared
179      */
180     public boolean getPreserveLockingKeysOnCopy(Class dataObjectClass);
181 }