Coverage Report - org.kuali.rice.kns.maintenance.Maintainable
 
Classes in this File Line Coverage Branch Coverage Complexity
Maintainable
N/A
N/A
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.maintenance;
 17  
 
 18  
 import java.util.Collection;
 19  
 import java.util.List;
 20  
 import java.util.Map;
 21  
 
 22  
 import org.kuali.rice.kim.bo.Person;
 23  
 import org.kuali.rice.kns.bo.BusinessObject;
 24  
 import org.kuali.rice.kns.bo.DocumentHeader;
 25  
 import org.kuali.rice.kns.bo.PersistableBusinessObject;
 26  
 import org.kuali.rice.kns.document.MaintenanceDocument;
 27  
 import org.kuali.rice.kns.document.MaintenanceLock;
 28  
 import org.kuali.rice.kns.document.authorization.MaintenanceDocumentRestrictions;
 29  
 import org.kuali.rice.kns.lookup.SelectiveReferenceRefresher;
 30  
 
 31  
 /**
 32  
  * This interface defines basic methods that all maintainable objects must provide.
 33  
  */
 34  
 public interface Maintainable extends java.io.Serializable, SelectiveReferenceRefresher {
 35  
 
 36  
     /**
 37  
      * This is a hook to allow the document to override the generic document title.
 38  
      * 
 39  
      * @return String   document title
 40  
      */
 41  
     public String getDocumentTitle(MaintenanceDocument document);
 42  
 
 43  
     /**
 44  
      * Sets the document number
 45  
      * 
 46  
      * @param documentNumber - the Document's documentNumber
 47  
      * 
 48  
      */
 49  
     public void setDocumentNumber(String documentNumber);
 50  
 
 51  
     /**
 52  
      * Returns instance of the business object that is being maintained.
 53  
      */
 54  
     public PersistableBusinessObject getBusinessObject();
 55  
 
 56  
 
 57  
     /**
 58  
      * @return the locking representation(s) of this document, which are reproducible given the same keys and the same maintainable object
 59  
      */
 60  
     public List<MaintenanceLock> generateMaintenanceLocks();
 61  
 
 62  
 
 63  
     /**
 64  
      * Returns a string that will be displayed as title on the maintenance screen.
 65  
      */
 66  
     public String getMaintainableTitle();
 67  
 
 68  
     /**
 69  
      * Retrieves the status of the boNotesEnabled
 70  
      */
 71  
     public boolean isBoNotesEnabled();
 72  
 
 73  
     /**
 74  
      * Returns a list of Section objects that specify how to render the view for the maintenance object.
 75  
      * 
 76  
      * @param oldMaintainable - If this is the new maintainable, the old is passed in for reference.  If it is the old maintainable, then null will be passed in
 77  
      * @return
 78  
      */
 79  
     public List getSections(MaintenanceDocument maintenanceDocument, Maintainable oldMaintainable);
 80  
 
 81  
 
 82  
     /**
 83  
      * This method populates the business object based on key/value pairs.
 84  
      * 
 85  
      * @param fieldValues
 86  
      * @param maintenanceDocument
 87  
      * @return
 88  
      */
 89  
     public Map populateBusinessObject(Map<String, String> fieldValues, MaintenanceDocument maintenanceDocument, String methodToCall);
 90  
 
 91  
 
 92  
     /**
 93  
      * Called from a lookup return by the maintenance action.
 94  
      */
 95  
     public void refresh(String refreshCaller, Map fieldValues, MaintenanceDocument document);
 96  
 
 97  
 
 98  
     /**
 99  
      * Sets an instance of a business object to be maintained.
 100  
      */
 101  
     public void setBusinessObject(PersistableBusinessObject object);
 102  
 
 103  
     /**
 104  
      * Sets the maintenance action - new, edit, or copy
 105  
      */
 106  
     public void setMaintenanceAction(String maintenanceAction);
 107  
 
 108  
     /**
 109  
      * Returns the maintenance action - new, edit, or copy
 110  
      */
 111  
     public String getMaintenanceAction();
 112  
 
 113  
     /**
 114  
      * Set default values.
 115  
      * @param docTypeName
 116  
      *
 117  
      */
 118  
     public void setGenerateDefaultValues(String docTypeName);
 119  
 
 120  
 
 121  
     /**
 122  
      * Set default values for blank required fields.
 123  
      * @param docTypeName
 124  
      * 
 125  
      */
 126  
     public void setGenerateBlankRequiredValues(String docTypeName);
 127  
 
 128  
 
 129  
     public Class getBoClass();
 130  
 
 131  
     public void setBoClass(Class boClass);
 132  
 
 133  
     /**
 134  
      * 
 135  
      * This method is a hook to do any necessary pre-save processing.
 136  
      * 
 137  
      */
 138  
     public void prepareForSave();
 139  
 
 140  
     /**
 141  
      * 
 142  
      * This method is a hook to do any necessary post-load processing.
 143  
      * 
 144  
      */
 145  
     public void processAfterRetrieve();
 146  
 
 147  
     /**
 148  
      * 
 149  
      * This method is a hook to do any necessary post-copy processing.
 150  
      * 
 151  
      */
 152  
     public void processAfterCopy( MaintenanceDocument document, Map<String,String[]> parameters );
 153  
     
 154  
     /**
 155  
      * This method is a hook to do any necessary post-edit processing, which is to say that it is called when a document is about to be edited;
 156  
      * this is therefore a hook to write any code to modify the business object before it is displayed to the end user to edit.
 157  
      */
 158  
     public void processAfterEdit( MaintenanceDocument document, Map<String,String[]> parameters );
 159  
 
 160  
     /**
 161  
      * 
 162  
      * This method is a hook to do any necessary post-copy processing.
 163  
      * 
 164  
      */
 165  
     public void processAfterNew( MaintenanceDocument document, Map<String,String[]> parameters );
 166  
 
 167  
     /**
 168  
      * 
 169  
      * KULRICE-4264 - a hook to change the state of the business object, which is the "new line" of a collection, before it is validated
 170  
      * 
 171  
      * @param colName
 172  
      * @param colClass
 173  
      * @param addBO
 174  
      */
 175  
     public void processBeforeAddLine(String colName, Class colClass, BusinessObject addBO);
 176  
     
 177  
     /**
 178  
      * 
 179  
      * This method is a hook to do any necessary post-post processing.
 180  
      * 
 181  
      */
 182  
     public void processAfterPost( MaintenanceDocument document, Map<String,String[]> parameters );
 183  
     
 184  
     /**
 185  
      * 
 186  
      * This method will cause the Maintainable implementation to save/store the relevant business object(s). This typically is
 187  
      * called only after the maint document has gone through state to final.
 188  
      * 
 189  
      */
 190  
     public void saveBusinessObject();
 191  
 
 192  
     /**
 193  
      * Populates the new collection lines based on key/value pairs.
 194  
      * 
 195  
      * @param fieldValues
 196  
      * @return
 197  
      */
 198  
     public Map<String, String> populateNewCollectionLines( Map<String, String> fieldValues, MaintenanceDocument maintenanceDocument, String methodToCall );
 199  
     
 200  
     /**
 201  
      * Gets the holder for the "add line" for a collection on the business object 
 202  
      * 
 203  
      * @param collectionName
 204  
      * @return
 205  
      */
 206  
     public PersistableBusinessObject getNewCollectionLine( String collectionName );
 207  
 
 208  
     /**
 209  
      * Adds the new line for the given collection to the business object's collection.
 210  
      * 
 211  
      * @param collectionName
 212  
      */
 213  
     public void addNewLineToCollection( String collectionName );
 214  
     
 215  
     /**
 216  
      * 
 217  
      * This methods will do the setting of some attributes that might be necessary
 218  
      * if we're creating a new business object using on an existing business object.
 219  
      * For example, create a division Vendor based on an existing parent Vendor.
 220  
      * (Please see VendorMaintainableImpl.java)
 221  
      */
 222  
     public void setupNewFromExisting( MaintenanceDocument document, Map<String,String[]> parameters );
 223  
     
 224  
     /**
 225  
      * Indicates whether inactive records for the given collection should be display.
 226  
      * 
 227  
      * @param collectionName - name of the collection (or sub-collection) to check inactive record display setting
 228  
      * @return true if inactive records should be displayed, false otherwise
 229  
      */
 230  
     public boolean getShowInactiveRecords(String collectionName);
 231  
     
 232  
     /**
 233  
      * Returns the Map used to control the state of inactive record collection display. Exposed for setting from the
 234  
      * maintenance jsp.
 235  
      */
 236  
     public Map<String, Boolean> getInactiveRecordDisplay();
 237  
     
 238  
     /**
 239  
      * Indicates to maintainble whether or not inactive records should be displayed for the given collection name.
 240  
      * 
 241  
      * @param collectionName - name of the collection (or sub-collection) to set inactive record display setting
 242  
      * @param showInactive - true to display inactive, false to not display inactive records
 243  
      */
 244  
     public void setShowInactiveRecords(String collectionName, boolean showInactive);
 245  
     
 246  
     public void addMultipleValueLookupResults(MaintenanceDocument document, String collectionName, Collection<PersistableBusinessObject> rawValues, boolean needsBlank, PersistableBusinessObject bo);
 247  
     
 248  
     /**
 249  
      * method to integrate with workflow, where we will actually handle the transitions of status for documents
 250  
      */
 251  
     public void doRouteStatusChange(DocumentHeader documentHeader);
 252  
 
 253  
     public List<String> getDuplicateIdentifierFieldsFromDataDictionary(String docTypeName, String collectionName);
 254  
     
 255  
     public List<String> getMultiValueIdentifierList(Collection maintCollection, List<String> duplicateIdentifierFields);
 256  
     
 257  
     public boolean hasBusinessObjectExisted(BusinessObject bo, List<String> existingIdentifierList, List<String> duplicateIdentifierFields);
 258  
 
 259  
     /**
 260  
      * Blanks out or sets the default of any value specified as restricted within the {@link MaintenanceDocumentRestrictions} instance.
 261  
      * 
 262  
      * This method should only be called if this maintainable represents the new maintainable of the maintenance document.
 263  
      * 
 264  
      * @param maintenanceDocumentRestrictions
 265  
      */
 266  
     public void clearBusinessObjectOfRestrictedValues(MaintenanceDocumentRestrictions maintenanceDocumentRestrictions);
 267  
     
 268  
     /**
 269  
      * For the case when we want to maintain a business object that doesn't necessarily map to 
 270  
      * a single table in the database or may doesn't map to a database at all  
 271  
      * 
 272  
      * @return
 273  
      */
 274  
     public boolean isExternalBusinessObject();
 275  
  
 276  
     /**
 277  
      * Gives chance to a maintainable object to prepare and return a maintainable object which 
 278  
      * might be external to the system 
 279  
      * 
 280  
      * @return
 281  
      */
 282  
     public void prepareBusinessObject(BusinessObject businessObject);
 283  
     
 284  
     /**
 285  
      * Searches for any relevant locking documents.
 286  
      * 
 287  
      * @return
 288  
      */
 289  
     public String getLockingDocumentId();
 290  
     
 291  
     /**
 292  
      * Return an array of document ids to lock prior to processing this document in the workflow engine. 
 293  
      */
 294  
     public List<Long> getWorkflowEngineDocumentIdsToLock();
 295  
     
 296  
     //3070
 297  
     public void deleteBusinessObject(); 
 298  
 
 299  
     /**
 300  
      * This method returns whether or not this maintainable supports custom lock descriptors for pessimistic locking.
 301  
      * 
 302  
      * @return True if the maintainable can generate custom lock descriptors, false otherwise.
 303  
      * @see #getCustomLockDescriptor(Map, Person)
 304  
      */
 305  
     public boolean useCustomLockDescriptors();
 306  
     
 307  
     /**
 308  
      * Generates a custom lock descriptor for pessimistic locking. This method should not be called unless {@link #useCustomLockDescriptors()} returns true.
 309  
      * 
 310  
      * @param user The user trying to establish the lock.
 311  
      * @return A String representing the lock descriptor.
 312  
      * @see #useCustomLockDescriptors()
 313  
      * @see org.kuali.rice.kns.service.PessimisticLockService
 314  
      * @see org.kuali.rice.kns.service.impl.PessimisticLockServiceImpl
 315  
      */
 316  
     public String getCustomLockDescriptor(Person user);
 317  
     
 318  
     boolean isOldBusinessObjectInDocument();
 319  
 }