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