Coverage Report - org.kuali.rice.krad.maintenance.MaintainableImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
MaintainableImpl
0%
0/144
0%
0/54
1.848
 
 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.krad.maintenance;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException;
 20  
 import org.kuali.rice.core.api.CoreApiServiceLocator;
 21  
 import org.kuali.rice.core.api.encryption.EncryptionService;
 22  
 import org.kuali.rice.kim.bo.Person;
 23  
 import org.kuali.rice.krad.bo.BusinessObject;
 24  
 import org.kuali.rice.krad.bo.DocumentHeader;
 25  
 import org.kuali.rice.krad.bo.Note;
 26  
 import org.kuali.rice.krad.bo.PersistableBusinessObject;
 27  
 import org.kuali.rice.krad.document.MaintenanceDocument;
 28  
 import org.kuali.rice.krad.document.MaintenanceLock;
 29  
 import org.kuali.rice.krad.exception.PessimisticLockingException;
 30  
 import org.kuali.rice.krad.service.BusinessObjectService;
 31  
 import org.kuali.rice.krad.service.DataObjectAuthorizationService;
 32  
 import org.kuali.rice.krad.service.DataObjectMetaDataService;
 33  
 import org.kuali.rice.krad.service.DocumentDictionaryService;
 34  
 import org.kuali.rice.krad.service.KRADServiceLocator;
 35  
 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
 36  
 import org.kuali.rice.krad.service.LookupService;
 37  
 import org.kuali.rice.krad.service.MaintenanceDocumentService;
 38  
 import org.kuali.rice.krad.uif.container.CollectionGroup;
 39  
 import org.kuali.rice.krad.uif.container.View;
 40  
 import org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl;
 41  
 import org.kuali.rice.krad.uif.util.ObjectPropertyUtils;
 42  
 import org.kuali.rice.krad.util.KRADConstants;
 43  
 import org.kuali.rice.krad.util.ObjectUtils;
 44  
 import org.kuali.rice.krad.web.form.MaintenanceForm;
 45  
 
 46  
 import java.security.GeneralSecurityException;
 47  
 import java.util.ArrayList;
 48  
 import java.util.Collection;
 49  
 import java.util.Iterator;
 50  
 import java.util.List;
 51  
 import java.util.Map;
 52  
 
 53  
 /**
 54  
  * Default implementation of the <code>Maintainable</code> interface
 55  
  *
 56  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 57  
  */
 58  0
 public class MaintainableImpl extends ViewHelperServiceImpl implements Maintainable {
 59  
     private static final long serialVersionUID = 9125271369161634992L;
 60  
 
 61  0
     private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(MaintainableImpl.class);
 62  
 
 63  
     private String documentNumber;
 64  
     private Object dataObject;
 65  
     private Class<?> dataObjectClass;
 66  
     private String maintenanceAction;
 67  
 
 68  
     private transient LookupService lookupService;
 69  
     private transient DataObjectAuthorizationService dataObjectAuthorizationService;
 70  
     private transient DataObjectMetaDataService dataObjectMetaDataService;
 71  
     private transient DocumentDictionaryService documentDictionaryService;
 72  
     private transient EncryptionService encryptionService;
 73  
     private transient BusinessObjectService businessObjectService;
 74  
     private transient MaintenanceDocumentService maintenanceDocumentService;
 75  
 
 76  
     /**
 77  
      * @see Maintainable#retrieveObjectForEditOrCopy(java.util.Map)
 78  
      */
 79  
     @Override
 80  
     public Object retrieveObjectForEditOrCopy(MaintenanceDocument document, Map<String, String> dataObjectKeys) {
 81  0
         Object dataObject = null;
 82  
 
 83  
         try {
 84  0
             dataObject = getLookupService().findObjectBySearch(getDataObjectClass(), dataObjectKeys);
 85  0
         } catch (ClassNotPersistenceCapableException ex) {
 86  0
             if (!document.getOldMaintainableObject().isExternalBusinessObject()) {
 87  0
                 throw new RuntimeException("Data Object Class: " + getDataObjectClass() +
 88  
                         " is not persistable and is not externalizable - configuration error");
 89  
             }
 90  
             // otherwise, let fall through
 91  0
         }
 92  
 
 93  0
         return dataObject;
 94  
     }
 95  
 
 96  
     /**
 97  
      * @see org.kuali.rice.krad.maintenance.Maintainable#setDocumentNumber
 98  
      */
 99  
     @Override
 100  
     public void setDocumentNumber(String documentNumber) {
 101  0
         this.documentNumber = documentNumber;
 102  0
     }
 103  
 
 104  
     /**
 105  
      * @see org.kuali.rice.krad.maintenance.Maintainable#getDocumentTitle
 106  
      */
 107  
     @Override
 108  
     public String getDocumentTitle(MaintenanceDocument document) {
 109  
         // default implementation is to allow MaintenanceDocumentBase to
 110  
         // generate the doc title
 111  0
         return "";
 112  
     }
 113  
 
 114  
     /**
 115  
      * @see org.kuali.rice.krad.maintenance.Maintainable#getDataObject
 116  
      */
 117  
     @Override
 118  
     public Object getDataObject() {
 119  0
         return dataObject;
 120  
     }
 121  
 
 122  
     /**
 123  
      * @see org.kuali.rice.krad.maintenance.Maintainable#setDataObject
 124  
      */
 125  
     @Override
 126  
     public void setDataObject(Object object) {
 127  0
         this.dataObject = object;
 128  0
     }
 129  
 
 130  
     /**
 131  
      * @see org.kuali.rice.krad.maintenance.Maintainable#getDataObjectClass
 132  
      */
 133  
     @Override
 134  
     public Class getDataObjectClass() {
 135  0
         return dataObjectClass;
 136  
     }
 137  
 
 138  
     /**
 139  
      * @see org.kuali.rice.krad.maintenance.Maintainable#setDataObjectClass
 140  
      */
 141  
     @Override
 142  
     public void setDataObjectClass(Class dataObjectClass) {
 143  0
         this.dataObjectClass = dataObjectClass;
 144  0
     }
 145  
 
 146  
     /**
 147  
      * @see org.kuali.rice.krad.maintenance.Maintainable#getMaintenanceAction
 148  
      */
 149  
     @Override
 150  
     public String getMaintenanceAction() {
 151  0
         return maintenanceAction;
 152  
     }
 153  
 
 154  
     /**
 155  
      * @see org.kuali.rice.krad.maintenance.Maintainable#setMaintenanceAction
 156  
      */
 157  
     @Override
 158  
     public void setMaintenanceAction(String maintenanceAction) {
 159  0
         this.maintenanceAction = maintenanceAction;
 160  0
     }
 161  
 
 162  
     /**
 163  
      * Note: as currently implemented, every key field for a given
 164  
      * data object class must have a visible getter
 165  
      *
 166  
      * @see org.kuali.rice.krad.maintenance.Maintainable#generateMaintenanceLocks
 167  
      */
 168  
     @Override
 169  
     public List<MaintenanceLock> generateMaintenanceLocks() {
 170  0
         List<MaintenanceLock> maintenanceLocks = new ArrayList<MaintenanceLock>();
 171  0
         StringBuffer lockRepresentation = new StringBuffer(dataObjectClass.getName());
 172  0
         lockRepresentation.append(KRADConstants.Maintenance.LOCK_AFTER_CLASS_DELIM);
 173  
 
 174  0
         Object bo = getDataObject();
 175  0
         List keyFieldNames = getDocumentDictionaryService().getLockingKeys(getDocumentTypeName());
 176  
 
 177  0
         for (Iterator i = keyFieldNames.iterator(); i.hasNext(); ) {
 178  0
             String fieldName = (String) i.next();
 179  0
             Object fieldValue = ObjectUtils.getPropertyValue(bo, fieldName);
 180  0
             if (fieldValue == null) {
 181  0
                 fieldValue = "";
 182  
             }
 183  
 
 184  
             // check if field is a secure
 185  0
             if (getDataObjectAuthorizationService()
 186  
                     .attributeValueNeedsToBeEncryptedOnFormsAndLinks(dataObjectClass, fieldName)) {
 187  
                 try {
 188  0
                     fieldValue = getEncryptionService().encrypt(fieldValue);
 189  0
                 } catch (GeneralSecurityException e) {
 190  0
                     LOG.error("Unable to encrypt secure field for locking representation " + e.getMessage());
 191  0
                     throw new RuntimeException(
 192  
                             "Unable to encrypt secure field for locking representation " + e.getMessage());
 193  0
                 }
 194  
             }
 195  
 
 196  0
             lockRepresentation.append(fieldName);
 197  0
             lockRepresentation.append(KRADConstants.Maintenance.LOCK_AFTER_FIELDNAME_DELIM);
 198  0
             lockRepresentation.append(String.valueOf(fieldValue));
 199  0
             if (i.hasNext()) {
 200  0
                 lockRepresentation.append(KRADConstants.Maintenance.LOCK_AFTER_VALUE_DELIM);
 201  
             }
 202  0
         }
 203  
 
 204  0
         MaintenanceLock maintenanceLock = new MaintenanceLock();
 205  0
         maintenanceLock.setDocumentNumber(documentNumber);
 206  0
         maintenanceLock.setLockingRepresentation(lockRepresentation.toString());
 207  0
         maintenanceLocks.add(maintenanceLock);
 208  
 
 209  0
         return maintenanceLocks;
 210  
     }
 211  
 
 212  
     /**
 213  
      * Retrieves the document type name from the data dictionary based on
 214  
      * business object class
 215  
      */
 216  
     protected String getDocumentTypeName() {
 217  0
         return getDocumentDictionaryService().getMaintenanceDocumentTypeName(dataObjectClass);
 218  
     }
 219  
 
 220  
     /**
 221  
      * @see org.kuali.rice.krad.maintenance.Maintainable#saveDataObject
 222  
      */
 223  
     @Override
 224  
     public void saveDataObject() {
 225  0
         if (dataObject instanceof PersistableBusinessObject) {
 226  0
             getBusinessObjectService().linkAndSave((PersistableBusinessObject) dataObject);
 227  
         } else {
 228  0
             throw new RuntimeException(
 229  
                     "Cannot save object of type: " + dataObjectClass + " with business object service");
 230  
         }
 231  0
     }
 232  
 
 233  
     /**
 234  
      * @see org.kuali.rice.krad.maintenance.Maintainable#deleteDataObject
 235  
      */
 236  
     @Override
 237  
     public void deleteDataObject() {
 238  0
         if (dataObject == null) {
 239  0
             return;
 240  
         }
 241  
 
 242  0
         if (dataObject instanceof PersistableBusinessObject) {
 243  0
             getBusinessObjectService().delete((PersistableBusinessObject) dataObject);
 244  0
             dataObject = null;
 245  
         } else {
 246  0
             throw new RuntimeException(
 247  
                     "Cannot delete object of type: " + dataObjectClass + " with business object service");
 248  
         }
 249  0
     }
 250  
 
 251  
     /**
 252  
      * @see org.kuali.rice.krad.maintenance.Maintainable#doRouteStatusChange
 253  
      */
 254  
     @Override
 255  
     public void doRouteStatusChange(DocumentHeader documentHeader) {
 256  
         // no default implementation
 257  0
     }
 258  
 
 259  
     /**
 260  
      * @see org.kuali.rice.krad.maintenance.Maintainable#getLockingDocumentId
 261  
      */
 262  
     @Override
 263  
     public String getLockingDocumentId() {
 264  0
         return getMaintenanceDocumentService().getLockingDocumentId(this, documentNumber);
 265  
     }
 266  
 
 267  
     /**
 268  
      * @see org.kuali.rice.krad.maintenance.Maintainable#getWorkflowEngineDocumentIdsToLock
 269  
      */
 270  
     @Override
 271  
     public List<Long> getWorkflowEngineDocumentIdsToLock() {
 272  0
         return null;
 273  
     }
 274  
 
 275  
     /**
 276  
      * Default implementation simply returns false to indicate that custom
 277  
      * lock descriptors are not supported by MaintainableImpl. If custom
 278  
      * lock descriptors are needed, the appropriate subclasses should override
 279  
      * this method
 280  
      *
 281  
      * @see org.kuali.rice.krad.maintenance.Maintainable#useCustomLockDescriptors
 282  
      */
 283  
     @Override
 284  
     public boolean useCustomLockDescriptors() {
 285  0
         return false;
 286  
     }
 287  
 
 288  
     /**
 289  
      * Default implementation just throws a PessimisticLockingException.
 290  
      * Subclasses of MaintainableImpl that need support for custom lock
 291  
      * descriptors should override this method
 292  
      *
 293  
      * @see org.kuali.rice.krad.maintenance.Maintainable#getCustomLockDescriptor
 294  
      */
 295  
     @Override
 296  
     public String getCustomLockDescriptor(Person user) {
 297  0
         throw new PessimisticLockingException("The Maintainable for document " + documentNumber +
 298  
                 " is using pessimistic locking with custom lock descriptors, but the Maintainable has not overridden the getCustomLockDescriptor method");
 299  
     }
 300  
 
 301  
     /**
 302  
      * @see org.kuali.rice.krad.maintenance.Maintainable#isBoNotesEnabled
 303  
      */
 304  
     @Override
 305  
     public boolean isNotesEnabled() {
 306  0
         return getDataObjectMetaDataService().areNotesSupported(dataObjectClass);
 307  
     }
 308  
 
 309  
     /**
 310  
      * @see org.kuali.rice.krad.maintenance.MaintainableImpl#isExternalBusinessObject
 311  
      */
 312  
     @Override
 313  
     public boolean isExternalBusinessObject() {
 314  0
         return false;
 315  
     }
 316  
 
 317  
     /**
 318  
      * @see org.kuali.rice.krad.maintenance.MaintainableImpl#prepareExternalBusinessObject
 319  
      */
 320  
     @Override
 321  
     public void prepareExternalBusinessObject(BusinessObject businessObject) {
 322  
         // by default do nothing
 323  0
     }
 324  
 
 325  
     /**
 326  
      * Checks whether the data object is not null and has its primary key values populated
 327  
      *
 328  
      * @see org.kuali.rice.krad.maintenance.MaintainableImpl#isOldDataObjectInDocument
 329  
      */
 330  
     @Override
 331  
     public boolean isOldDataObjectInDocument() {
 332  0
         boolean isOldDataObjectInExistence = true;
 333  
 
 334  0
         if (getDataObject() == null) {
 335  0
             isOldDataObjectInExistence = false;
 336  
         } else {
 337  0
             Map<String, ?> keyFieldValues = getDataObjectMetaDataService().getPrimaryKeyFieldValues(getDataObject());
 338  0
             for (Object keyValue : keyFieldValues.values()) {
 339  0
                 if (keyValue == null) {
 340  0
                     isOldDataObjectInExistence = false;
 341  0
                 } else if ((keyValue instanceof String) && StringUtils.isBlank((String) keyValue)) {
 342  0
                     isOldDataObjectInExistence = false;
 343  
                 }
 344  
 
 345  0
                 if (!isOldDataObjectInExistence) {
 346  0
                     break;
 347  
                 }
 348  
             }
 349  
         }
 350  
 
 351  0
         return isOldDataObjectInExistence;
 352  
     }
 353  
 
 354  
     /**
 355  
      * @see org.kuali.rice.krad.maintenance.Maintainable#prepareForSave
 356  
      */
 357  
     @Override
 358  
     public void prepareForSave() {
 359  
         // by default do nothing
 360  0
     }
 361  
 
 362  
     /**
 363  
      * @see org.kuali.rice.krad.maintenance.Maintainable#processAfterRetrieve
 364  
      */
 365  
     @Override
 366  
     public void processAfterRetrieve() {
 367  
         // by default do nothing
 368  0
     }
 369  
 
 370  
     /**
 371  
      * @see org.kuali.rice.krad.maintenance.MaintainableImpl#setupNewFromExisting
 372  
      */
 373  
     @Override
 374  
     public void setupNewFromExisting(MaintenanceDocument document, Map<String, String[]> parameters) {
 375  
         // by default do nothing
 376  0
     }
 377  
 
 378  
     /**
 379  
      * @see org.kuali.rice.krad.maintenance.Maintainable#processAfterCopy
 380  
      */
 381  
     @Override
 382  
     public void processAfterCopy(MaintenanceDocument document, Map<String, String[]> requestParameters) {
 383  
         // by default do nothing
 384  0
     }
 385  
 
 386  
     /**
 387  
      * @see org.kuali.rice.krad.maintenance.Maintainable#processAfterEdit
 388  
      */
 389  
     @Override
 390  
     public void processAfterEdit(MaintenanceDocument document, Map<String, String[]> requestParameters) {
 391  
         // by default do nothing
 392  0
     }
 393  
 
 394  
     /**
 395  
      * @see org.kuali.rice.krad.maintenance.Maintainable#processAfterNew
 396  
      */
 397  
     @Override
 398  
     public void processAfterNew(MaintenanceDocument document, Map<String, String[]> requestParameters) {
 399  
         // by default do nothing
 400  0
     }
 401  
 
 402  
     /**
 403  
      * @see org.kuali.rice.krad.maintenance.Maintainable#processAfterPost
 404  
      */
 405  
     @Override
 406  
     public void processAfterPost(MaintenanceDocument document, Map<String, String[]> requestParameters) {
 407  
         // by default do nothing
 408  0
     }
 409  
 
 410  
     /**
 411  
      * In the case of edit maintenance adds a new blank line to the old side
 412  
      *
 413  
      * TODO: should this write some sort of missing message on the old side
 414  
      * instead?
 415  
      *
 416  
      * @see org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl#processAfterAddLine(org.kuali.rice.krad.uif.container.View,
 417  
      *      org.kuali.rice.krad.uif.container.CollectionGroup, java.lang.Object,
 418  
      *      java.lang.Object)
 419  
      */
 420  
     @Override
 421  
     protected void processAfterAddLine(View view, CollectionGroup collectionGroup, Object model, Object addLine) {
 422  0
         super.processAfterAddLine(view, collectionGroup, model, addLine);
 423  
         
 424  
         // Check for maintenance documents in edit but exclude notes
 425  0
         if (model instanceof MaintenanceForm && KRADConstants.MAINTENANCE_EDIT_ACTION.equals(((MaintenanceForm)model).getMaintenanceAction()) && !(addLine instanceof Note)) {
 426  0
             MaintenanceForm maintenanceForm = (MaintenanceForm) model;
 427  0
             MaintenanceDocument document = maintenanceForm.getDocument();
 428  
 
 429  
             // get the old object's collection
 430  0
             Collection<Object> oldCollection = ObjectPropertyUtils
 431  
                     .getPropertyValue(document.getOldMaintainableObject().getDataObject(),
 432  
                             collectionGroup.getPropertyName());
 433  
             try {
 434  0
                 Object blankLine = getDataObjectClass().newInstance();
 435  0
                 oldCollection.add(blankLine);
 436  0
             } catch (Exception e) {
 437  0
                 throw new RuntimeException("Unable to create new line instance for old maintenance object", e);
 438  0
             }
 439  
         }
 440  0
     }
 441  
     
 442  
     /**
 443  
      * In the case of edit maintenance deleted the item on the old side
 444  
      *
 445  
      *
 446  
      * @see org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl#processAfterDeleteLine(org.kuali.rice.krad.uif.container.View,
 447  
      *      org.kuali.rice.krad.uif.container.CollectionGroup, java.lang.Object,
 448  
      *      java.lang.Object)
 449  
      */
 450  
     @Override
 451  
     protected void processAfterDeleteLine(View view, CollectionGroup collectionGroup, Object model, int lineIndex) {
 452  0
         super.processAfterDeleteLine(view, collectionGroup, model, lineIndex);
 453  
         
 454  
         // Check for maintenance documents in edit but exclude notes
 455  0
         if (model instanceof MaintenanceForm && KRADConstants.MAINTENANCE_EDIT_ACTION.equals(((MaintenanceForm)model).getMaintenanceAction()) 
 456  
                 && !collectionGroup.getCollectionObjectClass().getName().equals(Note.class.getName())) {
 457  0
             MaintenanceForm maintenanceForm = (MaintenanceForm) model;
 458  0
             MaintenanceDocument document = maintenanceForm.getDocument();
 459  
 
 460  
             // get the old object's collection
 461  0
             Collection<Object> oldCollection = ObjectPropertyUtils
 462  
                     .getPropertyValue(document.getOldMaintainableObject().getDataObject(),
 463  
                             collectionGroup.getPropertyName());
 464  
             try {
 465  
                 
 466  
                 // Remove the object at lineIndex from the collection
 467  0
                 oldCollection.remove(oldCollection.toArray()[lineIndex]);
 468  0
             } catch (Exception e) {
 469  0
                 throw new RuntimeException("Unable to delete line instance for old maintenance object", e);
 470  0
             }
 471  
         }
 472  0
     }    
 473  
 
 474  
     /**
 475  
      * Retrieves the document number configured on this maintainable
 476  
      *
 477  
      * @return String document number
 478  
      */
 479  
     protected String getDocumentNumber() {
 480  0
         return this.documentNumber;
 481  
     }
 482  
 
 483  
     protected LookupService getLookupService() {
 484  0
         if (lookupService == null) {
 485  0
             lookupService = KRADServiceLocatorWeb.getLookupService();
 486  
         }
 487  0
         return this.lookupService;
 488  
     }
 489  
 
 490  
     public void setLookupService(LookupService lookupService) {
 491  0
         this.lookupService = lookupService;
 492  0
     }
 493  
 
 494  
     protected DataObjectAuthorizationService getDataObjectAuthorizationService() {
 495  0
         if (dataObjectAuthorizationService == null) {
 496  0
             this.dataObjectAuthorizationService = KRADServiceLocatorWeb.getDataObjectAuthorizationService();
 497  
         }
 498  0
         return dataObjectAuthorizationService;
 499  
     }
 500  
 
 501  
     public void setDataObjectAuthorizationService(DataObjectAuthorizationService dataObjectAuthorizationService) {
 502  0
         this.dataObjectAuthorizationService = dataObjectAuthorizationService;
 503  0
     }
 504  
 
 505  
     protected DataObjectMetaDataService getDataObjectMetaDataService() {
 506  0
         if (dataObjectMetaDataService == null) {
 507  0
             this.dataObjectMetaDataService = KRADServiceLocatorWeb.getDataObjectMetaDataService();
 508  
         }
 509  0
         return dataObjectMetaDataService;
 510  
     }
 511  
 
 512  
     public void setDataObjectMetaDataService(DataObjectMetaDataService dataObjectMetaDataService) {
 513  0
         this.dataObjectMetaDataService = dataObjectMetaDataService;
 514  0
     }
 515  
 
 516  
     public DocumentDictionaryService getDocumentDictionaryService() {
 517  0
         if (documentDictionaryService == null) {
 518  0
             this.documentDictionaryService = KRADServiceLocatorWeb.getDocumentDictionaryService();
 519  
         }
 520  0
         return documentDictionaryService;
 521  
     }
 522  
 
 523  
     public void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService) {
 524  0
         this.documentDictionaryService = documentDictionaryService;
 525  0
     }
 526  
 
 527  
     protected EncryptionService getEncryptionService() {
 528  0
         if (encryptionService == null) {
 529  0
             encryptionService = CoreApiServiceLocator.getEncryptionService();
 530  
         }
 531  0
         return encryptionService;
 532  
     }
 533  
 
 534  
     public void setEncryptionService(EncryptionService encryptionService) {
 535  0
         this.encryptionService = encryptionService;
 536  0
     }
 537  
 
 538  
     protected BusinessObjectService getBusinessObjectService() {
 539  0
         if (businessObjectService == null) {
 540  0
             businessObjectService = KRADServiceLocator.getBusinessObjectService();
 541  
         }
 542  0
         return businessObjectService;
 543  
     }
 544  
 
 545  
     public void setBusinessObjectService(BusinessObjectService businessObjectService) {
 546  0
         this.businessObjectService = businessObjectService;
 547  0
     }
 548  
 
 549  
     protected MaintenanceDocumentService getMaintenanceDocumentService() {
 550  0
         if (maintenanceDocumentService == null) {
 551  0
             maintenanceDocumentService = KRADServiceLocatorWeb.getMaintenanceDocumentService();
 552  
         }
 553  0
         return maintenanceDocumentService;
 554  
     }
 555  
 
 556  
     public void setMaintenanceDocumentService(MaintenanceDocumentService maintenanceDocumentService) {
 557  0
         this.maintenanceDocumentService = maintenanceDocumentService;
 558  0
     }
 559  
 }