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  
 import org.kuali.rice.kns.uif.service.ViewHelperService;
 31  
 
 32  
 /**
 33  
  * Defines basic methods that all maintainable objects must provide
 34  
  */
 35  
 public interface Maintainable extends ViewHelperService, java.io.Serializable, SelectiveReferenceRefresher {
 36  
 
 37  
         /**
 38  
          * This is a hook to allow the document to override the generic document
 39  
          * title.
 40  
          * 
 41  
          * @return String document title
 42  
          */
 43  
         public String getDocumentTitle(MaintenanceDocument document);
 44  
 
 45  
         /**
 46  
          * Sets the document number
 47  
          * 
 48  
          * @param documentNumber
 49  
          *            - the Document's documentNumber
 50  
          * 
 51  
          */
 52  
         public void setDocumentNumber(String documentNumber);
 53  
 
 54  
         /**
 55  
          * Returns instance of the business object that is being maintained.
 56  
          */
 57  
         @Deprecated
 58  
         public PersistableBusinessObject getBusinessObject();
 59  
         
 60  
         /**
 61  
      * Returns instance of the data object that is being maintained.
 62  
      */
 63  
     public Object getDataObject();
 64  
 
 65  
         /**
 66  
          * @return the locking representation(s) of this document, which are
 67  
          *         reproducible given the same keys and the same maintainable object
 68  
          */
 69  
         public List<MaintenanceLock> generateMaintenanceLocks();
 70  
 
 71  
         /**
 72  
          * Retrieves the status of the boNotesEnabled
 73  
          */
 74  
         public boolean isBoNotesEnabled();
 75  
 
 76  
         /**
 77  
          * Called from a lookup return by the maintenance action.
 78  
          */
 79  
         public void refresh(String refreshCaller, Map fieldValues, MaintenanceDocument document);
 80  
 
 81  
         /**
 82  
          * Sets an instance of a business object to be maintained.
 83  
          */
 84  
         @Deprecated
 85  
         public void setBusinessObject(PersistableBusinessObject object);
 86  
         
 87  
         /**
 88  
      * Sets an instance of a data object to be maintained.
 89  
      */
 90  
     public void setDataObject(Object object);
 91  
 
 92  
         /**
 93  
          * Sets the maintenance action - new, edit, or copy
 94  
          */
 95  
         public void setMaintenanceAction(String maintenanceAction);
 96  
 
 97  
         /**
 98  
          * Returns the maintenance action - new, edit, or copy
 99  
          */
 100  
         public String getMaintenanceAction();
 101  
 
 102  
         public Class getBoClass();
 103  
 
 104  
         public void setBoClass(Class boClass);
 105  
 
 106  
         /**
 107  
          * 
 108  
          * This method is a hook to do any necessary pre-save processing.
 109  
          * 
 110  
          */
 111  
         public void prepareForSave();
 112  
 
 113  
         /**
 114  
          * 
 115  
          * This method is a hook to do any necessary post-load processing.
 116  
          * 
 117  
          */
 118  
         public void processAfterRetrieve();
 119  
 
 120  
         /**
 121  
          * 
 122  
          * This method is a hook to do any necessary post-copy processing.
 123  
          * 
 124  
          */
 125  
         public void processAfterCopy(MaintenanceDocument document, Map<String, String[]> requestParameters);
 126  
 
 127  
         /**
 128  
          * This method is a hook to do any necessary post-edit processing, which is
 129  
          * to say that it is called when a document is about to be edited; this is
 130  
          * therefore a hook to write any code to modify the business object before
 131  
          * it is displayed to the end user to edit.
 132  
          */
 133  
         public void processAfterEdit(MaintenanceDocument document, Map<String, String[]> requestParameters);
 134  
 
 135  
         /**
 136  
          * 
 137  
          * This method is a hook to do any necessary post-copy processing.
 138  
          * 
 139  
          */
 140  
         public void processAfterNew(MaintenanceDocument document, Map<String, String[]> requestParameters);
 141  
 
 142  
         /**
 143  
          * 
 144  
          * This method is a hook to do any necessary post-post processing.
 145  
          * 
 146  
          */
 147  
         public void processAfterPost(MaintenanceDocument document, Map<String, String[]> requestParameters);
 148  
         
 149  
         /**
 150  
          * Called during setupMaintenanceObject to retrieve the original dataObject that is being
 151  
          * edited or copied.  Override this method for non BusinessObject external persistence,
 152  
          * Maintainable objects that extend BO should override isExternalBusinessObject and
 153  
          * prepareBusinessObject instead.
 154  
          * 
 155  
          * Do not override this method and isExternalBusinessObject.
 156  
          * 
 157  
          * @param document document instance for the maintenance object
 158  
          * @param dataObjectKeys Map of keys for the requested object
 159  
          * @return the object identified by the dataObjectKeys
 160  
          */
 161  
         public Object retrieveObjectForEditOrCopy(MaintenanceDocument document, Map<String, String> dataObjectKeys);
 162  
 
 163  
         /**
 164  
          * 
 165  
          * This method will cause the Maintainable implementation to save/store the
 166  
          * relevant business object(s). This typically is called only after the
 167  
          * maint document has gone through state to final.
 168  
          * 
 169  
          */
 170  
         public void saveBusinessObject();
 171  
 
 172  
         public void addMultipleValueLookupResults(MaintenanceDocument document, String collectionName,
 173  
                         Collection<PersistableBusinessObject> rawValues, boolean needsBlank, PersistableBusinessObject bo);
 174  
 
 175  
         /**
 176  
          * method to integrate with workflow, where we will actually handle the
 177  
          * transitions of status for documents
 178  
          */
 179  
         public void doRouteStatusChange(DocumentHeader documentHeader);
 180  
 
 181  
         public List<String> getDuplicateIdentifierFieldsFromDataDictionary(String docTypeName, String collectionName);
 182  
 
 183  
         public List<String> getMultiValueIdentifierList(Collection maintCollection, List<String> duplicateIdentifierFields);
 184  
 
 185  
         public boolean hasBusinessObjectExisted(BusinessObject bo, List<String> existingIdentifierList,
 186  
                         List<String> duplicateIdentifierFields);
 187  
 
 188  
         /**
 189  
          * Blanks out or sets the default of any value specified as restricted
 190  
          * within the {@link MaintenanceDocumentRestrictions} instance.
 191  
          * 
 192  
          * This method should only be called if this maintainable represents the new
 193  
          * maintainable of the maintenance document.
 194  
          * 
 195  
          * @param maintenanceDocumentRestrictions
 196  
          */
 197  
         public void clearBusinessObjectOfRestrictedValues(MaintenanceDocumentRestrictions maintenanceDocumentRestrictions);
 198  
 
 199  
         /**
 200  
          * For the case when we want to maintain a business object that doesn't
 201  
          * necessarily map to a single table in the database or may doesn't map to a
 202  
          * database at all
 203  
          * 
 204  
          * @return
 205  
          */
 206  
         public boolean isExternalBusinessObject();
 207  
 
 208  
         /**
 209  
          * Gives chance to a maintainable object to prepare and return a
 210  
          * maintainable object which might be external to the system
 211  
          * 
 212  
          * @return
 213  
          */
 214  
         public void prepareBusinessObject(BusinessObject businessObject);
 215  
 
 216  
         /**
 217  
          * Searches for any relevant locking documents.
 218  
          * 
 219  
          * @return
 220  
          */
 221  
         public String getLockingDocumentId();
 222  
 
 223  
         /**
 224  
          * Return an array of document ids to lock prior to processing this document
 225  
          * in the workflow engine.
 226  
          */
 227  
         public List<Long> getWorkflowEngineDocumentIdsToLock();
 228  
 
 229  
         // 3070
 230  
         public void deleteBusinessObject();
 231  
 
 232  
         /**
 233  
          * This method returns whether or not this maintainable supports custom lock
 234  
          * descriptors for pessimistic locking.
 235  
          * 
 236  
          * @return True if the maintainable can generate custom lock descriptors,
 237  
          *         false otherwise.
 238  
          * @see #getCustomLockDescriptor(Map, Person)
 239  
          */
 240  
         public boolean useCustomLockDescriptors();
 241  
 
 242  
         /**
 243  
          * Generates a custom lock descriptor for pessimistic locking. This method
 244  
          * should not be called unless {@link #useCustomLockDescriptors()} returns
 245  
          * true.
 246  
          * 
 247  
          * @param user
 248  
          *            The user trying to establish the lock.
 249  
          * @return A String representing the lock descriptor.
 250  
          * @see #useCustomLockDescriptors()
 251  
          * @see org.kuali.rice.kns.service.PessimisticLockService
 252  
          * @see org.kuali.rice.kns.service.impl.PessimisticLockServiceImpl
 253  
          */
 254  
         public String getCustomLockDescriptor(Person user);
 255  
 
 256  
         boolean isOldBusinessObjectInDocument();
 257  
 
 258  
         /**
 259  
          * Called to setup the object being maintained
 260  
          * 
 261  
          * <p>
 262  
          * For edit and copy actions, the old record is retrieved and prepared for
 263  
          * editing (in the case of a copy some fields are cleared). In addition some
 264  
          * authorization checks are performed and hooks for custom
 265  
          * <code>Maintainble</code> implementations are invoked.
 266  
          * </p>
 267  
          * 
 268  
          * @param document
 269  
          *            - document instance for the maintenance object
 270  
          * @param maintenanceAction
 271  
          *            - the requested maintenance action (new, new with existing,
 272  
          *            copy, edit)
 273  
          * @param requestParameters
 274  
          *            - Map of parameters from the request
 275  
          */
 276  
         public void setupMaintenanceObject(MaintenanceDocument document, String maintenanceAction,
 277  
                         Map<String, String[]> requestParameters);
 278  
 
 279  
         /**
 280  
          * Indicates whether inactive records for the given collection should be
 281  
          * display.
 282  
          * 
 283  
          * @param collectionName
 284  
          *            - name of the collection (or sub-collection) to check inactive
 285  
          *            record display setting
 286  
          * @return true if inactive records should be displayed, false otherwise
 287  
          */
 288  
         @Deprecated
 289  
         public boolean getShowInactiveRecords(String collectionName);
 290  
 
 291  
         /**
 292  
          * Returns the Map used to control the state of inactive record collection
 293  
          * display. Exposed for setting from the maintenance jsp.
 294  
          */
 295  
         @Deprecated
 296  
         public Map<String, Boolean> getInactiveRecordDisplay();
 297  
 
 298  
         /**
 299  
          * Indicates to maintainble whether or not inactive records should be
 300  
          * displayed for the given collection name.
 301  
          * 
 302  
          * @param collectionName
 303  
          *            - name of the collection (or sub-collection) to set inactive
 304  
          *            record display setting
 305  
          * @param showInactive
 306  
          *            - true to display inactive, false to not display inactive
 307  
          *            records
 308  
          */
 309  
         @Deprecated
 310  
         public void setShowInactiveRecords(String collectionName, boolean showInactive);
 311  
 
 312  
         /**
 313  
          * Populates the new collection lines based on key/value pairs.
 314  
          * 
 315  
          * @param fieldValues
 316  
          * @return
 317  
          */
 318  
         @Deprecated
 319  
         public Map<String, String> populateNewCollectionLines(Map<String, String> fieldValues,
 320  
                         MaintenanceDocument maintenanceDocument, String methodToCall);
 321  
 
 322  
         /**
 323  
          * Gets the holder for the "add line" for a collection on the business
 324  
          * object
 325  
          * 
 326  
          * @param collectionName
 327  
          * @return
 328  
          */
 329  
         @Deprecated
 330  
         public PersistableBusinessObject getNewCollectionLine(String collectionName);
 331  
 
 332  
         /**
 333  
          * Adds the new line for the given collection to the business object's
 334  
          * collection.
 335  
          * 
 336  
          * @param collectionName
 337  
          */
 338  
         @Deprecated
 339  
         public void addNewLineToCollection(String collectionName);
 340  
 
 341  
         /**
 342  
          * 
 343  
          * KULRICE-4264 - a hook to change the state of the business object, which
 344  
          * is the "new line" of a collection, before it is validated
 345  
          * 
 346  
          * @param colName
 347  
          * @param colClass
 348  
          * @param addBO
 349  
          */
 350  
         @Deprecated
 351  
         public void processBeforeAddLine(String colName, Class colClass, BusinessObject addBO);
 352  
 
 353  
         /**
 354  
          * Set default values.
 355  
          * 
 356  
          * @param docTypeName
 357  
          * 
 358  
          */
 359  
         @Deprecated
 360  
         public void setGenerateDefaultValues(String docTypeName);
 361  
 
 362  
         /**
 363  
          * Set default values for blank required fields.
 364  
          * 
 365  
          * @param docTypeName
 366  
          * 
 367  
          */
 368  
         @Deprecated
 369  
         public void setGenerateBlankRequiredValues(String docTypeName);
 370  
 
 371  
         /**
 372  
          * Returns a list of Section objects that specify how to render the view for
 373  
          * the maintenance object.
 374  
          * 
 375  
          * @param oldMaintainable
 376  
          *            - If this is the new maintainable, the old is passed in for
 377  
          *            reference. If it is the old maintainable, then null will be
 378  
          *            passed in
 379  
          * @return
 380  
          */
 381  
         @Deprecated
 382  
         public List getSections(MaintenanceDocument maintenanceDocument, Maintainable oldMaintainable);
 383  
 
 384  
         /**
 385  
          * This method populates the business object based on key/value pairs.
 386  
          * 
 387  
          * @param fieldValues
 388  
          * @param maintenanceDocument
 389  
          * @return
 390  
          */
 391  
         @Deprecated
 392  
         public Map populateBusinessObject(Map<String, String> fieldValues, MaintenanceDocument maintenanceDocument,
 393  
                         String methodToCall);
 394  
 
 395  
         /**
 396  
          * Returns a string that will be displayed as title on the maintenance
 397  
          * screen.
 398  
          */
 399  
         @Deprecated
 400  
         public String getMaintainableTitle();
 401  
         
 402  
     /**
 403  
      * 
 404  
      * This methods will do the setting of some attributes that might be necessary
 405  
      * if we're creating a new business object using on an existing business object.
 406  
      * For example, create a division Vendor based on an existing parent Vendor.
 407  
      * (Please see VendorMaintainableImpl.java)
 408  
      * 
 409  
      *  TODO: remove from interface once converted to KRAD
 410  
      */
 411  
     public void setupNewFromExisting( MaintenanceDocument document, Map<String,String[]> parameters );
 412  
 }