1 /* 2 * Copyright 2005-2007 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.kns.service; 17 18 import java.util.Collection; 19 import java.util.List; 20 21 import org.kuali.rice.kns.bo.PersistableBusinessObject; 22 import org.kuali.rice.kns.datadictionary.MaintainableCollectionDefinition; 23 import org.kuali.rice.kns.datadictionary.MaintainableFieldDefinition; 24 import org.kuali.rice.kns.datadictionary.MaintainableItemDefinition; 25 import org.kuali.rice.kns.datadictionary.MaintainableSectionDefinition; 26 import org.kuali.rice.kns.datadictionary.MaintenanceDocumentEntry; 27 import org.kuali.rice.kns.document.MaintenanceDocument; 28 29 /** 30 * This interface defines methods that a MaintenanceDocumentDictionary Service must provide. Defines the API for the interacting 31 * with Document-related entries in the data dictionary. 32 * 33 * 34 */ 35 public interface MaintenanceDocumentDictionaryService { 36 /** 37 * Retrieves the label for a maintenance document. 38 * 39 * @param docTypeName 40 * @return The label as a String. 41 */ 42 public String getMaintenanceLabel(String docTypeName); 43 44 /** 45 * Retrieves the description of the maintenance document. 46 * 47 * @param docTypeName 48 * @return The description as a String. 49 */ 50 public String getMaintenanceDescription(String docTypeName); 51 52 /** 53 * Retrieves an instance of the class that represents the maintenance document. This is done by 54 * 55 * @param docTypeName 56 * @return A class instance. 57 */ 58 public Class getMaintainableClass(String docTypeName); 59 60 /** 61 * The document type name for a class instance. 62 * 63 * @param businessObjectClass 64 * @return The document type name for the class as a String. 65 */ 66 public String getDocumentTypeName(Class businessObjectClass); 67 68 /** 69 * The collection of ReferenceDefinition objects defined as DefaultExistenceChecks for the MaintenanceDocument. 70 * 71 * @param businessObjectClass 72 * @return A Collection of ReferenceDefinitions 73 */ 74 public Collection getDefaultExistenceChecks(Class businessObjectClass); 75 76 /** 77 * The collection of ReferenceDefinition objects defined as DefaultExistenceChecks for the MaintenanceDocument. 78 * 79 * @param docTypeName 80 * @return A Collection of ReferenceDefinitions 81 */ 82 public Collection getDefaultExistenceChecks(String docTypeName); 83 84 /** 85 * The collection of apcRuleDefinition objects defined as applyApcRules for the MaintenanceDocument 86 * 87 * @param businessObjectClass 88 * @return A collection of ApcRuleDefinitions 89 */ 90 public Collection getApplyApcRules(Class businessObjectClass); 91 92 /** 93 * The collection of apcRuleDefinition objects defined as applyApcRules for the MaintenanceDocument 94 * 95 * @param docTypeName 96 * @return A collection of ApcRuleDefinitions 97 */ 98 public Collection getApplyApcRules(String docTypeName); 99 100 /** 101 * A List of field names used as locking keys 102 * 103 * @param docTypeName 104 * @return A List of strings 105 */ 106 public List getLockingKeys(String docTypeName); 107 108 /** 109 * A List of maintainable section object instances corresponding to the document type name. 110 * 111 * @param docTypeName 112 * @return A List of maintable section objects. 113 */ 114 public List<MaintainableSectionDefinition> getMaintainableSections(String docTypeName); 115 116 /** 117 * The instance of the business object class associated with this document type name. 118 * 119 * @param docTypeName 120 * @return The class instance corresponding to the document type name. 121 */ 122 public Class getBusinessObjectClass(String docTypeName); 123 124 125 /** 126 * @param document 127 * @return businessRulesClass associated with the given document's type 128 */ 129 public Class getBusinessRulesClass(MaintenanceDocument document); 130 131 /** 132 * 133 * This method returns the defaultValue as it would appear in the UI on a maintenance document. 134 * 135 * If both a defaultValue and a defaultValueFinderClass is present in the MaintainableFieldDefinition instance, then the 136 * defaultValue will be preferentially returned. If only one is present, then that will be returned. 137 * 138 * Note that if a defaultValueFinderClass value is present, then this method will attempt to create a new instance of the 139 * specified class. If this attempt to generate a new instance fails, the error will be suppressed, and an null result will be 140 * returned. 141 * 142 * @param boClass - the class of BO being maintained 143 * @param fieldName - the fieldName of the attribute for which the default is desired 144 * @return the default if one is available, null otherwise 145 * 146 */ 147 public String getFieldDefaultValue(Class boClass, String fieldName); 148 149 /** 150 * 151 * This method returns the defaultValue as it would appear in the UI on a maintenance document. 152 * 153 * If both a defaultValue and a defaultValueFinderClass is present in the MaintainableFieldDefinition instance, then the 154 * defaultValue will be preferentially returned. If only one is present, then that will be returned. 155 * 156 * Note that if a defaultValueFinderClass value is present, then this method will attempt to create a new instance of the 157 * specified class. If this attempt to generate a new instance fails, the error will be suppressed, and an null result will be 158 * returned. 159 * 160 * @param docTypeName - the document type name of the maintainable 161 * @param fieldName - the fieldName of the attribute for which the default is desired 162 * @return the default if one is available, null otherwise 163 * 164 */ 165 public String getFieldDefaultValue(String docTypeName, String fieldName); 166 167 /** 168 * 169 * This method returns the defaultValue as it would appear in the UI on a maintenance document for a collection. 170 * 171 * If both a defaultValue and a defaultValueFinderClass is present in the MaintainableFieldDefinition instance, then the 172 * defaultValue will be preferentially returned. If only one is present, then that will be returned. 173 * 174 * Note that if a defaultValueFinderClass value is present, then this method will attempt to create a new instance of the 175 * specified class. If this attempt to generate a new instance fails, the error will be suppressed, and an null result will be 176 * returned. 177 * 178 * @param docTypeName - the document type name of the maintainable 179 * @param collectionName - the name attribute of the collection to which the field belongs 180 * @param fieldName - the fieldName of the attribute for which the default is desired 181 * @return the default if one is available, null otherwise 182 */ 183 public String getCollectionFieldDefaultValue(String docTypeName, String collectionName, String fieldName); 184 185 /** 186 * Returns whether or not this document's data dictionary file has flagged it to allow document copies. 187 * 188 * @param document 189 * @return True if copies are allowed, false otherwise. 190 */ 191 public Boolean getAllowsCopy(MaintenanceDocument document); 192 193 /** 194 * Returns whether or not this document's data dictionary file has flagged it to allow maintenance new 195 * or copy actions. 196 * 197 * @param document 198 * @return True if new or copy maintenance actions are allowed 199 */ 200 public Boolean getAllowsNewOrCopy(String docTypeName); 201 202 203 /** 204 * Returns the business object used to store the values for the given collection. 205 * 206 * @param docTypeName 207 * @param collectionName 208 * @return 209 */ 210 public Class getCollectionBusinessObjectClass( String docTypeName, String collectionName ); 211 212 /** 213 * Returns the definition for the maintainable item identified by "itemName". 214 * 215 * @param docTypeName 216 * @param itemName 217 * @return The item or <b>null</b> if the item does not exist. 218 */ 219 public MaintainableItemDefinition getMaintainableItem( String docTypeName, String itemName ); 220 221 /** 222 * Returns the definition for the maintainable field identified by "fieldName". 223 * 224 * @param docTypeName 225 * @param fieldName 226 * @return The field or <b>null</b> if the item does not exist or is not a field. 227 */ 228 public MaintainableFieldDefinition getMaintainableField( String docTypeName, String fieldName ); 229 230 /** 231 * Returns the definition for the maintainable collection identified by "collectionName". 232 * 233 * @param docTypeName 234 * @param collectionName 235 * @return The collection or <b>null</b> if the item does not exist or is not a collection. 236 */ 237 public MaintainableCollectionDefinition getMaintainableCollection( String docTypeName, String collectionName ); 238 239 /* They are returned in order of discovery (depth-first search) */ 240 /** 241 * Gets a list of all top-level maintainable collections on the document. 242 * 243 * 244 * @param docTypeName 245 * @return 246 */ 247 public List<MaintainableCollectionDefinition> getMaintainableCollections( String docTypeName ); 248 249 /** 250 * Returns a list of all collections within the given collection 251 * 252 * @param parentCollection 253 * @return 254 */ 255 public List<MaintainableCollectionDefinition> getMaintainableCollections( MaintainableCollectionDefinition parentCollection ); 256 257 258 /** 259 * Validates the maintenance document contains values for the fields declared as required in the 260 * maintenance document data dictionary file. 261 * 262 * @param document 263 */ 264 public void validateMaintenanceRequiredFields(MaintenanceDocument document); 265 266 /** 267 * validates the collections of the maintenance document checking to see if duplicate entries in the collection exist 268 * @param document 269 */ 270 public void validateMaintainableCollectionsForDuplicateEntries(MaintenanceDocument document); 271 272 public void validateMaintainableCollectionsAddLineRequiredFields(MaintenanceDocument document, PersistableBusinessObject businessObject, String collectionName ); 273 274 public MaintenanceDocumentEntry getMaintenanceDocumentEntry(String docTypeName); 275 276 //for issue KULRice 3072, checking PK copy prop 277 public boolean getPreserveLockingKeysOnCopy(Class businessObjectClass); 278 279 //for issue KULRice 3070 280 public Boolean getAllowsRecordDeletion(Class businessObjectClass); 281 //for issue KULRice3070 282 public Boolean getAllowsRecordDeletion(MaintenanceDocument document); 283 284 /** 285 * @param businessObjectClass - business object class for maintenance definition 286 * @return Boolean indicating whether translating of codes is configured to true in maintenance definition 287 */ 288 public Boolean translateCodes(Class businessObjectClass); 289 290 }