Coverage Report - org.kuali.rice.kns.datadictionary.MaintenanceDocumentEntry
 
Classes in this File Line Coverage Branch Coverage Complexity
MaintenanceDocumentEntry
0%
0/77
0%
0/14
1.314
 
 1  
 /*
 2  
  * Copyright 2007 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 1.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/ecl1.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.datadictionary;
 17  
 
 18  
 import org.kuali.rice.kns.web.derivedvaluesetter.DerivedValuesSetter;
 19  
 import org.kuali.rice.krad.bo.BusinessObject;
 20  
 import org.kuali.rice.krad.datadictionary.DataDictionary;
 21  
 import org.kuali.rice.krad.datadictionary.ReferenceDefinition;
 22  
 import org.kuali.rice.krad.datadictionary.exception.AttributeValidationException;
 23  
 import org.kuali.rice.krad.datadictionary.exception.ClassValidationException;
 24  
 import org.kuali.rice.krad.datadictionary.exception.DuplicateEntryException;
 25  
 import org.kuali.rice.krad.document.Document;
 26  
 import org.kuali.rice.kns.document.MaintenanceDocumentBase;
 27  
 import org.kuali.rice.krad.document.authorization.DocumentAuthorizer;
 28  
 import org.kuali.rice.krad.document.authorization.DocumentPresentationController;
 29  
 import org.kuali.rice.krad.document.authorization.MaintenanceDocumentAuthorizer;
 30  
 import org.kuali.rice.kns.maintenance.Maintainable;
 31  
 
 32  
 import java.util.ArrayList;
 33  
 import java.util.LinkedHashMap;
 34  
 import java.util.List;
 35  
 import java.util.Map;
 36  
 
 37  
 /**
 38  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 39  
  */
 40  
 @Deprecated
 41  
 public class MaintenanceDocumentEntry extends org.kuali.rice.krad.datadictionary.MaintenanceDocumentEntry {
 42  0
     protected List<MaintainableSectionDefinition> maintainableSections = new ArrayList<MaintainableSectionDefinition>();
 43  0
     protected List<String> lockingKeys = new ArrayList<String>();
 44  
 
 45  0
     protected Map<String, MaintainableSectionDefinition> maintainableSectionMap =
 46  
             new LinkedHashMap<String, MaintainableSectionDefinition>();
 47  
 
 48  0
     protected boolean allowsNewOrCopy = true;
 49  
     protected String additionalSectionsFile;
 50  
 
 51  
     //for issue KULRice3072, to enable PK field copy
 52  0
     protected boolean preserveLockingKeysOnCopy = false;
 53  
 
 54  
     // for issue KULRice3070, to enable deleting a db record using maintenance doc
 55  0
     protected boolean allowsRecordDeletion = false;
 56  
 
 57  0
     protected boolean translateCodes = false;
 58  
 
 59  
     protected Class<? extends DerivedValuesSetter> derivedValuesSetterClass;
 60  0
     protected List<String> webScriptFiles = new ArrayList<String>(3);
 61  0
     protected List<HeaderNavigation> headerNavigationList = new ArrayList<HeaderNavigation>();
 62  
 
 63  
     protected Class<? extends DocumentAuthorizer> documentAuthorizerClass;
 64  
     protected Class<? extends DocumentPresentationController> documentPresentationControllerClass;
 65  
 
 66  0
     protected boolean sessionDocument = false;
 67  
 
 68  
     public MaintenanceDocumentEntry() {
 69  0
         super();
 70  0
     }
 71  
 
 72  
     @Override
 73  
     public Class<? extends Document> getStandardDocumentBaseClass() {
 74  0
         return MaintenanceDocumentBase.class;
 75  
     }
 76  
 
 77  
     /*
 78  
            This attribute is used in many contexts, for example, in maintenance docs, it's used to specify the classname
 79  
            of the BO being maintained.
 80  
     */
 81  
     public void setBusinessObjectClass(Class<? extends BusinessObject> businessObjectClass) {
 82  0
         if (businessObjectClass == null) {
 83  0
             throw new IllegalArgumentException("invalid (null) dataObjectClass");
 84  
         }
 85  
 
 86  0
         setDataObjectClass(businessObjectClass);
 87  0
     }
 88  
 
 89  
     public Class<? extends BusinessObject> getBusinessObjectClass() {
 90  0
         return (Class<? extends BusinessObject>) getDataObjectClass();
 91  
     }
 92  
 
 93  
     /**
 94  
      * @see org.kuali.rice.krad.datadictionary.DocumentEntry#getEntryClass()
 95  
      */
 96  
     @SuppressWarnings("unchecked")
 97  
     @Override
 98  
     public Class getEntryClass() {
 99  0
         return getDataObjectClass();
 100  
     }
 101  
 
 102  
     public Class<? extends Maintainable> getMaintainableClass() {
 103  0
         return (Class<? extends Maintainable>) super.getMaintainableClass();
 104  
     }
 105  
 
 106  
     /**
 107  
      * @return List of MaintainableSectionDefinition objects contained in this document
 108  
      */
 109  
     public List<MaintainableSectionDefinition> getMaintainableSections() {
 110  0
         return maintainableSections;
 111  
     }
 112  
 
 113  
     /**
 114  
      * @return List of all lockingKey fieldNames associated with this LookupDefinition, in the order in which they were
 115  
      *         added
 116  
      */
 117  
     public List<String> getLockingKeyFieldNames() {
 118  0
         return lockingKeys;
 119  
     }
 120  
 
 121  
     /**
 122  
      * Gets the allowsNewOrCopy attribute.
 123  
      *
 124  
      * @return Returns the allowsNewOrCopy.
 125  
      */
 126  
     public boolean getAllowsNewOrCopy() {
 127  0
         return allowsNewOrCopy;
 128  
     }
 129  
 
 130  
     /**
 131  
      * The allowsNewOrCopy element contains a value of true or false.
 132  
      * If true, this indicates the maintainable should allow the
 133  
      * new and/or copy maintenance actions.
 134  
      */
 135  
     public void setAllowsNewOrCopy(boolean allowsNewOrCopy) {
 136  0
         this.allowsNewOrCopy = allowsNewOrCopy;
 137  0
     }
 138  
 
 139  
     /**
 140  
      * Directly validate simple fields, call completeValidation on Definition fields.
 141  
      *
 142  
      * @see org.kuali.rice.krad.datadictionary.DocumentEntry#completeValidation()
 143  
      */
 144  
     public void completeValidation() {
 145  0
         super.completeValidation();
 146  
 
 147  0
         for (MaintainableSectionDefinition maintainableSectionDefinition : maintainableSections) {
 148  0
             maintainableSectionDefinition.completeValidation(getDataObjectClass(), null);
 149  
         }
 150  0
     }
 151  
 
 152  
     /**
 153  
      * @see java.lang.Object#toString()
 154  
      */
 155  
     public String toString() {
 156  0
         return "MaintenanceDocumentEntry for documentType " + getDocumentTypeName();
 157  
     }
 158  
 
 159  
     @Deprecated
 160  
     public String getAdditionalSectionsFile() {
 161  0
         return additionalSectionsFile;
 162  
     }
 163  
 
 164  
     /*
 165  
            The additionalSectionsFile element specifies the name of the location
 166  
            of an additional JSP file to include in the maintenance document
 167  
            after the generation sections but before the notes.
 168  
            The location semantics are those of jsp:include.
 169  
     */
 170  
     @Deprecated
 171  
     public void setAdditionalSectionsFile(String additionalSectionsFile) {
 172  0
         this.additionalSectionsFile = additionalSectionsFile;
 173  0
     }
 174  
 
 175  
     public List<String> getLockingKeys() {
 176  0
         return lockingKeys;
 177  
     }
 178  
 
 179  
     /*
 180  
            The lockingKeys element specifies a list of fields
 181  
            that comprise a unique key.  This is used for record locking
 182  
            during the file maintenance process.
 183  
     */
 184  
     public void setLockingKeys(List<String> lockingKeys) {
 185  0
         for (String lockingKey : lockingKeys) {
 186  0
             if (lockingKey == null) {
 187  0
                 throw new IllegalArgumentException("invalid (null) lockingKey");
 188  
             }
 189  
         }
 190  0
         this.lockingKeys = lockingKeys;
 191  0
     }
 192  
 
 193  
     /**
 194  
      * The maintainableSections elements allows the maintenance document to
 195  
      * be presented in sections.  Each section can have a different title.
 196  
      *
 197  
      * JSTL: maintainbleSections is a Map whichis accessed by a key
 198  
      * of "maintainableSections".  This map contains entries with the
 199  
      * following keys:
 200  
      * "0"   (for first section)
 201  
      * "1"   (for second section)
 202  
      * etc.
 203  
      * The corresponding value for each entry is a maintainableSection ExportMap.
 204  
      * See MaintenanceDocumentEntryMapper.java.
 205  
      */
 206  
     @Deprecated
 207  
     public void setMaintainableSections(List<MaintainableSectionDefinition> maintainableSections) {
 208  0
         maintainableSectionMap.clear();
 209  0
         for (MaintainableSectionDefinition maintainableSectionDefinition : maintainableSections) {
 210  0
             if (maintainableSectionDefinition == null) {
 211  0
                 throw new IllegalArgumentException("invalid (null) maintainableSectionDefinition");
 212  
             }
 213  
 
 214  0
             String sectionTitle = maintainableSectionDefinition.getTitle();
 215  0
             if (maintainableSectionMap.containsKey(sectionTitle)) {
 216  0
                 throw new DuplicateEntryException(
 217  
                         "section '" + sectionTitle + "' already defined for maintenanceDocument '" +
 218  
                                 getDocumentTypeName() + "'");
 219  
             }
 220  
 
 221  0
             maintainableSectionMap.put(sectionTitle, maintainableSectionDefinition);
 222  0
         }
 223  0
         this.maintainableSections = maintainableSections;
 224  0
     }
 225  
 
 226  
     /**
 227  
      * @return the preserveLockingKeysOnCopy
 228  
      */
 229  
     public boolean getPreserveLockingKeysOnCopy() {
 230  0
         return this.preserveLockingKeysOnCopy;
 231  
     }
 232  
 
 233  
     /**
 234  
      * @param preserveLockingKeysOnCopy the preserveLockingKeysOnCopy to set
 235  
      */
 236  
     public void setPreserveLockingKeysOnCopy(boolean preserveLockingKeysOnCopy) {
 237  0
         this.preserveLockingKeysOnCopy = preserveLockingKeysOnCopy;
 238  0
     }
 239  
 
 240  
     /**
 241  
      * @return the allowRecordDeletion
 242  
      */
 243  
     public boolean getAllowsRecordDeletion() {
 244  0
         return this.allowsRecordDeletion;
 245  
     }
 246  
 
 247  
     /**
 248  
      * @param allowsRecordDeletion the allowRecordDeletion to set
 249  
      */
 250  
     public void setAllowsRecordDeletion(boolean allowsRecordDeletion) {
 251  0
         this.allowsRecordDeletion = allowsRecordDeletion;
 252  0
     }
 253  
 
 254  
     @Deprecated
 255  
     public boolean isTranslateCodes() {
 256  0
         return this.translateCodes;
 257  
     }
 258  
 
 259  
     @Deprecated
 260  
     public void setTranslateCodes(boolean translateCodes) {
 261  0
         this.translateCodes = translateCodes;
 262  0
     }
 263  
 
 264  
       /**
 265  
      * The documentAuthorizerClass element is the full class name of the
 266  
      * java class which will determine what features are available to the
 267  
      * user based on the user role and document state.
 268  
      */
 269  
     public void setDocumentAuthorizerClass(Class<? extends DocumentAuthorizer> documentAuthorizerClass) {
 270  0
         this.documentAuthorizerClass = documentAuthorizerClass;
 271  0
     }
 272  
 
 273  
     /**
 274  
      * Returns the document authorizer class for the document.  Only framework code should be calling this method.
 275  
      * Client devs should use {@link DocumentTypeService#getDocumentAuthorizer(org.kuali.rice.krad.document.Document)}
 276  
      * or
 277  
      * {@link DocumentTypeService#getDocumentAuthorizer(String)}
 278  
      *
 279  
      * @return a document authorizer class
 280  
      */
 281  
     public Class<? extends DocumentAuthorizer> getDocumentAuthorizerClass() {
 282  0
         return documentAuthorizerClass;
 283  
     }
 284  
 
 285  
     public List<HeaderNavigation> getHeaderNavigationList() {
 286  0
         return headerNavigationList;
 287  
     }
 288  
 
 289  
     public List<String> getWebScriptFiles() {
 290  0
         return webScriptFiles;
 291  
     }
 292  
 
 293  
     /**
 294  
      * The webScriptFile element defines the name of javascript files
 295  
      * that are necessary for processing the document.  The specified
 296  
      * javascript files will be included in the generated html.
 297  
      */
 298  
     public void setWebScriptFiles(List<String> webScriptFiles) {
 299  0
         this.webScriptFiles = webScriptFiles;
 300  0
     }
 301  
 
 302  
     /**
 303  
      * The headerNavigation element defines a set of additional
 304  
      * tabs which will appear on the document.
 305  
      */
 306  
     public void setHeaderNavigationList(List<HeaderNavigation> headerNavigationList) {
 307  0
         this.headerNavigationList = headerNavigationList;
 308  0
     }
 309  
 
 310  
     public boolean isSessionDocument() {
 311  0
         return this.sessionDocument;
 312  
     }
 313  
 
 314  
     public void setSessionDocument(boolean sessionDocument) {
 315  0
         this.sessionDocument = sessionDocument;
 316  0
     }
 317  
 
 318  
     /**
 319  
      * Returns the document presentation controller class for the document.  Only framework code should be calling this
 320  
      * method.
 321  
      * Client devs should use {@link DocumentTypeService#getDocumentPresentationController(org.kuali.rice.krad.document.Document)}
 322  
      * or
 323  
      * {@link DocumentTypeService#getDocumentPresentationController(String)}
 324  
      *
 325  
      * @return the documentPresentationControllerClass
 326  
      */
 327  
     public Class<? extends DocumentPresentationController> getDocumentPresentationControllerClass() {
 328  0
         return this.documentPresentationControllerClass;
 329  
     }
 330  
 
 331  
     /**
 332  
      * @param documentPresentationControllerClass the documentPresentationControllerClass to set
 333  
      */
 334  
     public void setDocumentPresentationControllerClass(
 335  
             Class<? extends DocumentPresentationController> documentPresentationControllerClass) {
 336  0
         this.documentPresentationControllerClass = documentPresentationControllerClass;
 337  0
     }
 338  
 
 339  
     /**
 340  
      * @return the derivedValuesSetter
 341  
      */
 342  
     public Class<? extends DerivedValuesSetter> getDerivedValuesSetterClass() {
 343  0
         return this.derivedValuesSetterClass;
 344  
     }
 345  
 
 346  
     /**
 347  
      * @param derivedValuesSetter the derivedValuesSetter to set
 348  
      */
 349  
     public void setDerivedValuesSetterClass(Class<? extends DerivedValuesSetter> derivedValuesSetter) {
 350  0
         this.derivedValuesSetterClass = derivedValuesSetter;
 351  0
     }
 352  
 }