org.kuali.rice.krad.maintenance
Class MaintainableImpl

java.lang.Object
  extended by org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl
      extended by org.kuali.rice.krad.maintenance.MaintainableImpl
All Implemented Interfaces:
Serializable, Maintainable, ViewHelperService
Direct Known Subclasses:
AgendaEditorMaintainable, ContextMaintainable, FiscalOfficerInfoMaintainableImpl, KualiMaintainableImpl, PeopleFlowMaintainableImpl, TermMaintainable, TermSpecificationMaintainable

public class MaintainableImpl
extends ViewHelperServiceImpl
implements Maintainable

Default implementation of the Maintainable interface

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
Serialized Form

Constructor Summary
MaintainableImpl()
           
 
Method Summary
 void deleteDataObject()
          Invokes to delete the data object being maintained
 void doRouteStatusChange(DocumentHeader documentHeader)
          Invoked do perform custom processing when the route status for the containing maintenance document changes
 List<MaintenanceLock> generateMaintenanceLocks()
          Note: as currently implemented, every key field for a given data object class must have a visible getter
protected  BusinessObjectService getBusinessObjectService()
           
 String getCustomLockDescriptor(Person user)
          Default implementation just throws a PessimisticLockingException.
 Object getDataObject()
          Returns instance of the data object that is being maintained
protected  DataObjectAuthorizationService getDataObjectAuthorizationService()
           
 Class getDataObjectClass()
          Returns the class for the data object being maintained
protected  DataObjectMetaDataService getDataObjectMetaDataService()
           
 DocumentDictionaryService getDocumentDictionaryService()
           
protected  String getDocumentNumber()
          Retrieves the document number configured on this maintainable
 String getDocumentTitle(MaintenanceDocument document)
          Invoked when setting the title for the document instance in workflow (doc search results) to customize the title
protected  String getDocumentTypeName()
          Retrieves the document type name from the data dictionary based on business object class
protected  EncryptionService getEncryptionService()
           
 String getLockingDocumentId()
          Retrieves the locking document id for the maintainable which is used to create the maintenance lock string
protected  LookupService getLookupService()
           
 String getMaintenanceAction()
          Returns the type of maintenance action this maintainable has been configured with
protected  MaintenanceDocumentService getMaintenanceDocumentService()
           
 List<String> getWorkflowEngineDocumentIdsToLock()
          Return an array of document ids to lock prior to processing this document in the workflow engine
 boolean isExternalBusinessObject()
          Indicates whether the object being maintained is an instance of ExternalizableBusinessObject
 boolean isNotesEnabled()
          Indicates whether this maintainable supports notes on the maintenance object
 boolean isOldDataObjectInDocument()
          Checks whether the data object is not null and has its primary key values populated
 void prepareExternalBusinessObject(BusinessObject businessObject)
          Invoked to prepare a new BusinessObject instance that is external
 void prepareForSave()
          Hook for performing any custom processing before the maintenance object is saved
protected  void processAfterAddLine(View view, CollectionGroup collectionGroup, Object model, Object addLine)
          In the case of edit maintenance adds a new blank line to the old side TODO: should this write some sort of missing message on the old side instead?
 void processAfterCopy(MaintenanceDocument document, Map<String,String[]> requestParameters)
          Hook for performing any custom processing after the maintenance object has been setup for a copy action
protected  void processAfterDeleteLine(View view, CollectionGroup collectionGroup, Object model, int lineIndex)
          In the case of edit maintenance deleted the item on the old side
 void processAfterEdit(MaintenanceDocument document, Map<String,String[]> requestParameters)
          Hook for performing any custom processing after the maintenance object has been setup for a edit action
 void processAfterNew(MaintenanceDocument document, Map<String,String[]> requestParameters)
          Hook for performing any custom processing after the maintenance object has been setup for a new action
 void processAfterPost(MaintenanceDocument document, Map<String,String[]> requestParameters)
          Hook for performing any custom processing after each posting of the maintenance document (for various actions like add line, refresh)
 void processAfterRetrieve()
          Hook for performing any custom processing after the maintenance object is retrieved from persistence storage
 Object retrieveObjectForEditOrCopy(MaintenanceDocument document, Map<String,String> dataObjectKeys)
          Called during setupMaintenanceObject to retrieve the original dataObject that is being edited or copied.
 void saveDataObject()
          Invoked to persist changes to the data object being maintained
 void setBusinessObjectService(BusinessObjectService businessObjectService)
           
 void setDataObject(Object object)
          Sets an instance of a data object that should be maintained
 void setDataObjectAuthorizationService(DataObjectAuthorizationService dataObjectAuthorizationService)
           
 void setDataObjectClass(Class dataObjectClass)
          Sets the class for the data object that will be maintained
 void setDataObjectMetaDataService(DataObjectMetaDataService dataObjectMetaDataService)
           
 void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService)
           
 void setDocumentNumber(String documentNumber)
          Sets the document number on this maintainable for referencing back to the containing MaintenanceDocument
 void setEncryptionService(EncryptionService encryptionService)
           
 void setLookupService(LookupService lookupService)
           
 void setMaintenanceAction(String maintenanceAction)
          Sets the type of maintenance action to be performed (new, edit, or copy)
 void setMaintenanceDocumentService(MaintenanceDocumentService maintenanceDocumentService)
           
 void setupNewFromExisting(MaintenanceDocument document, Map<String,String[]> parameters)
          Performs the setting of some attributes that might be necessary if we're creating a new business object using on an existing business object.
 boolean useCustomLockDescriptors()
          Default implementation simply returns false to indicate that custom lock descriptors are not supported by MaintainableImpl.
 
Methods inherited from class org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl
addClientSideStateForComponent, addCustomContainerComponents, addLine, adjustIdIfNecessary, applyAuthorizationAndPresentationLogic, applyDefaultValues, applyDefaultValuesForCollectionLine, buildClientSideStateScript, buildGrowlScript, buildInquiryLink, cleanViewAfterRender, findNestedDictionaryAttribute, getCommonContext, getConfigurationService, getDataDictionaryService, getExpressionEvaluatorService, getPreModelContext, getViewDictionaryService, initializeDataFieldFromDataDictionary, invokeMethodFinalizer, logAndThrowRuntime, performAddLineValidation, performApplyModel, performComponentApplyModel, performComponentFinalize, performComponentInitialization, performComponentLifecycle, performCustomApplyModel, performCustomFinalize, performCustomInitialization, performDeleteLineValidation, performFinalize, performInitialization, populateDefaultValueForField, populateViewFromRequestParameters, processAfterSaveLine, processAnyRemoteFieldsHolder, processBeforeAddLine, processBeforeSaveLine, processCollectionAddBlankLine, processCollectionAddLine, processCollectionDeleteLine, processCollectionSaveLine, processMultipleValueLookupResults, retrieveEditModesAndActionFlags, runComponentModifiers, setConfigurationService, setDataDictionaryService, setExpressionEvaluatorService, setViewContext, setViewDictionaryService, syncClientSideStateForComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.kuali.rice.krad.uif.service.ViewHelperService
applyDefaultValuesForCollectionLine, buildInquiryLink, cleanViewAfterRender, performApplyModel, performComponentInitialization, performComponentLifecycle, performFinalize, performInitialization, populateViewFromRequestParameters, processCollectionAddBlankLine, processCollectionAddLine, processCollectionDeleteLine, processCollectionSaveLine, processMultipleValueLookupResults
 

Constructor Detail

MaintainableImpl

public MaintainableImpl()
Method Detail

retrieveObjectForEditOrCopy

public Object retrieveObjectForEditOrCopy(MaintenanceDocument document,
                                          Map<String,String> dataObjectKeys)
Description copied from interface: Maintainable
Called during setupMaintenanceObject to retrieve the original dataObject that is being edited or copied. Override this method for non BusinessObject external persistence, Maintainable objects that extend BO should override isExternalBusinessObject and prepareBusinessObject instead. Do not override this method and isExternalBusinessObject.

Specified by:
retrieveObjectForEditOrCopy in interface Maintainable
Parameters:
document - document instance for the maintenance object
dataObjectKeys - Map of keys for the requested object
Returns:
the object identified by the dataObjectKeys
See Also:
Maintainable.retrieveObjectForEditOrCopy(MaintenanceDocument, java.util.Map)

setDocumentNumber

public void setDocumentNumber(String documentNumber)
Description copied from interface: Maintainable
Sets the document number on this maintainable for referencing back to the containing MaintenanceDocument

Specified by:
setDocumentNumber in interface Maintainable
Parameters:
documentNumber - - document number for the containing maintenance document
See Also:
Maintainable.setDocumentNumber(java.lang.String)

getDocumentTitle

public String getDocumentTitle(MaintenanceDocument document)
Description copied from interface: Maintainable
Invoked when setting the title for the document instance in workflow (doc search results) to customize the title

Specified by:
getDocumentTitle in interface Maintainable
Parameters:
document - - maintenance document instance to build title for
Returns:
String document title
See Also:
Maintainable.getDocumentTitle(org.kuali.rice.krad.maintenance.MaintenanceDocument)

getDataObject

public Object getDataObject()
Description copied from interface: Maintainable
Returns instance of the data object that is being maintained

Specified by:
getDataObject in interface Maintainable
Returns:
Object data object instance
See Also:
Maintainable.getDataObject()

setDataObject

public void setDataObject(Object object)
Description copied from interface: Maintainable
Sets an instance of a data object that should be maintained

Specified by:
setDataObject in interface Maintainable
Parameters:
object - - data object instance
See Also:
Maintainable.setDataObject(java.lang.Object)

getDataObjectClass

public Class getDataObjectClass()
Description copied from interface: Maintainable
Returns the class for the data object being maintained

Specified by:
getDataObjectClass in interface Maintainable
Returns:
Class data object class
See Also:
Maintainable.getDataObjectClass()

setDataObjectClass

public void setDataObjectClass(Class dataObjectClass)
Description copied from interface: Maintainable
Sets the class for the data object that will be maintained

Specified by:
setDataObjectClass in interface Maintainable
Parameters:
dataObjectClass - - class for maintenance data object
See Also:
Maintainable.setDataObjectClass(java.lang.Class)

getMaintenanceAction

public String getMaintenanceAction()
Description copied from interface: Maintainable
Returns the type of maintenance action this maintainable has been configured with

Specified by:
getMaintenanceAction in interface Maintainable
Returns:
String maintenance action string
See Also:
Maintainable.getMaintenanceAction()

setMaintenanceAction

public void setMaintenanceAction(String maintenanceAction)
Description copied from interface: Maintainable
Sets the type of maintenance action to be performed (new, edit, or copy)

Specified by:
setMaintenanceAction in interface Maintainable
Parameters:
maintenanceAction - - string identifying the action type
See Also:
Maintainable.setMaintenanceAction(java.lang.String)

generateMaintenanceLocks

public List<MaintenanceLock> generateMaintenanceLocks()
Note: as currently implemented, every key field for a given data object class must have a visible getter

Specified by:
generateMaintenanceLocks in interface Maintainable
Returns:
the locking representation(s) of this document, which are reproducible given the same keys and the same maintainable object
See Also:
Maintainable.generateMaintenanceLocks()

getDocumentTypeName

protected String getDocumentTypeName()
Retrieves the document type name from the data dictionary based on business object class


saveDataObject

public void saveDataObject()
Description copied from interface: Maintainable
Invoked to persist changes to the data object being maintained

Called after the maintenance document has become final indicating the changes should be applied

Specified by:
saveDataObject in interface Maintainable
See Also:
Maintainable.saveDataObject()

deleteDataObject

public void deleteDataObject()
Description copied from interface: Maintainable
Invokes to delete the data object being maintained

Called after the maintenance document has become final indicating the changes should be applied

Specified by:
deleteDataObject in interface Maintainable
See Also:
Maintainable.deleteDataObject()

doRouteStatusChange

public void doRouteStatusChange(DocumentHeader documentHeader)
Description copied from interface: Maintainable
Invoked do perform custom processing when the route status for the containing maintenance document changes

Usually used for determining when the document has become final so further actions can take place in addition to the usual persistence of the object changes

Specified by:
doRouteStatusChange in interface Maintainable
Parameters:
documentHeader - - document header instance for containing maintenance document which can be used to check the new status
See Also:
Maintainable.doRouteStatusChange(org.kuali.rice.krad.bo.DocumentHeader)

getLockingDocumentId

public String getLockingDocumentId()
Description copied from interface: Maintainable
Retrieves the locking document id for the maintainable which is used to create the maintenance lock string

Specified by:
getLockingDocumentId in interface Maintainable
Returns:
String locking id
See Also:
Maintainable.getLockingDocumentId()

getWorkflowEngineDocumentIdsToLock

public List<String> getWorkflowEngineDocumentIdsToLock()
Description copied from interface: Maintainable
Return an array of document ids to lock prior to processing this document in the workflow engine

Specified by:
getWorkflowEngineDocumentIdsToLock in interface Maintainable
Returns:
List list of document ids
See Also:
Maintainable.getWorkflowEngineDocumentIdsToLock()

useCustomLockDescriptors

public boolean useCustomLockDescriptors()
Default implementation simply returns false to indicate that custom lock descriptors are not supported by MaintainableImpl. If custom lock descriptors are needed, the appropriate subclasses should override this method

Specified by:
useCustomLockDescriptors in interface Maintainable
Returns:
boolean true if the maintainable can generate custom lock descriptors, false otherwise
See Also:
Maintainable.useCustomLockDescriptors()

getCustomLockDescriptor

public String getCustomLockDescriptor(Person user)
Default implementation just throws a PessimisticLockingException. Subclasses of MaintainableImpl that need support for custom lock descriptors should override this method

Specified by:
getCustomLockDescriptor in interface Maintainable
Parameters:
user - - the user trying to establish the lock
Returns:
String representing the lock descriptor
See Also:
Maintainable.getCustomLockDescriptor(org.kuali.rice.kim.api.identity.Person)

isNotesEnabled

public boolean isNotesEnabled()
Description copied from interface: Maintainable
Indicates whether this maintainable supports notes on the maintenance object

Note this is only applicable if the data object is an instance of BusinessObject

Specified by:
isNotesEnabled in interface Maintainable
Returns:
boolean true if notes are supported, false if they are not supported
See Also:
Maintainable.isNotesEnabled()

isExternalBusinessObject

public boolean isExternalBusinessObject()
Description copied from interface: Maintainable
Indicates whether the object being maintained is an instance of ExternalizableBusinessObject

For the case when we want to maintain a business object that doesn't necessarily map to a single table in the database or may doesn't map to a database at all

Specified by:
isExternalBusinessObject in interface Maintainable
Returns:
boolean true if the data object is an external business object, false if not
See Also:
isExternalBusinessObject()

prepareExternalBusinessObject

public void prepareExternalBusinessObject(BusinessObject businessObject)
Description copied from interface: Maintainable
Invoked to prepare a new BusinessObject instance that is external

Specified by:
prepareExternalBusinessObject in interface Maintainable
Parameters:
businessObject - - new business object instance to prepare
See Also:
prepareExternalBusinessObject(org.kuali.rice.krad.bo.BusinessObject)

isOldDataObjectInDocument

public boolean isOldDataObjectInDocument()
Checks whether the data object is not null and has its primary key values populated

Specified by:
isOldDataObjectInDocument in interface Maintainable
Returns:
boolean true if old data object exists, false if not
See Also:
isOldDataObjectInDocument()

prepareForSave

public void prepareForSave()
Description copied from interface: Maintainable
Hook for performing any custom processing before the maintenance object is saved

Specified by:
prepareForSave in interface Maintainable
See Also:
Maintainable.prepareForSave()

processAfterRetrieve

public void processAfterRetrieve()
Description copied from interface: Maintainable
Hook for performing any custom processing after the maintenance object is retrieved from persistence storage

Specified by:
processAfterRetrieve in interface Maintainable
See Also:
Maintainable.processAfterRetrieve()

setupNewFromExisting

public void setupNewFromExisting(MaintenanceDocument document,
                                 Map<String,String[]> parameters)
Description copied from interface: Maintainable
Performs the setting of some attributes that might be necessary if we're creating a new business object using on an existing business object. For example, create a division Vendor based on an existing parent Vendor. (Please see VendorMaintainableImpl.java)

Specified by:
setupNewFromExisting in interface Maintainable
Parameters:
document - - maintenance document instance this maintainable belong to
parameters - - map of request parameters sent for the request
See Also:
setupNewFromExisting(org.kuali.rice.krad.maintenance.MaintenanceDocument, java.util.Map)

processAfterCopy

public void processAfterCopy(MaintenanceDocument document,
                             Map<String,String[]> requestParameters)
Description copied from interface: Maintainable
Hook for performing any custom processing after the maintenance object has been setup for a copy action

Specified by:
processAfterCopy in interface Maintainable
Parameters:
document - - maintenance document instance this maintainable belong to
requestParameters - - map of request parameters sent for the copy request
See Also:
Maintainable.processAfterCopy(org.kuali.rice.krad.maintenance.MaintenanceDocument, java.util.Map)

processAfterEdit

public void processAfterEdit(MaintenanceDocument document,
                             Map<String,String[]> requestParameters)
Description copied from interface: Maintainable
Hook for performing any custom processing after the maintenance object has been setup for a edit action

Specified by:
processAfterEdit in interface Maintainable
Parameters:
document - - maintenance document instance this maintainable belong to
requestParameters - - map of request parameters sent for the copy request
See Also:
Maintainable.processAfterEdit(org.kuali.rice.krad.maintenance.MaintenanceDocument, java.util.Map)

processAfterNew

public void processAfterNew(MaintenanceDocument document,
                            Map<String,String[]> requestParameters)
Description copied from interface: Maintainable
Hook for performing any custom processing after the maintenance object has been setup for a new action

Specified by:
processAfterNew in interface Maintainable
Parameters:
document - - maintenance document instance this maintainable belong to
requestParameters - - map of request parameters sent for the copy request
See Also:
Maintainable.processAfterNew(org.kuali.rice.krad.maintenance.MaintenanceDocument, java.util.Map)

processAfterPost

public void processAfterPost(MaintenanceDocument document,
                             Map<String,String[]> requestParameters)
Description copied from interface: Maintainable
Hook for performing any custom processing after each posting of the maintenance document (for various actions like add line, refresh)

Specified by:
processAfterPost in interface Maintainable
Parameters:
document - - maintenance document instance this maintainable belong to
requestParameters - - map of request parameters from the post
See Also:
Maintainable.processAfterPost(org.kuali.rice.krad.maintenance.MaintenanceDocument, java.util.Map)

processAfterAddLine

protected void processAfterAddLine(View view,
                                   CollectionGroup collectionGroup,
                                   Object model,
                                   Object addLine)
In the case of edit maintenance adds a new blank line to the old side TODO: should this write some sort of missing message on the old side instead?

Overrides:
processAfterAddLine in class ViewHelperServiceImpl
Parameters:
view - - view instance that is being presented (the action was taken on)
collectionGroup - - collection group component for the collection the line that was added
model - - object instance that contain's the views data
addLine - - the new line that was added
See Also:
ViewHelperServiceImpl.processAfterAddLine(org.kuali.rice.krad.uif.view.View, org.kuali.rice.krad.uif.container.CollectionGroup, java.lang.Object, java.lang.Object)

processAfterDeleteLine

protected void processAfterDeleteLine(View view,
                                      CollectionGroup collectionGroup,
                                      Object model,
                                      int lineIndex)
In the case of edit maintenance deleted the item on the old side

Overrides:
processAfterDeleteLine in class ViewHelperServiceImpl
Parameters:
view - - view instance that is being presented (the action was taken on)
collectionGroup - - collection group component for the collection the line that was added
model - - object instance that contains the views data
lineIndex - - index of the line that was deleted
See Also:
ViewHelperServiceImpl.processAfterDeleteLine(View, org.kuali.rice.krad.uif.container.CollectionGroup, java.lang.Object, int)

getDocumentNumber

protected String getDocumentNumber()
Retrieves the document number configured on this maintainable

Returns:
String document number

getLookupService

protected LookupService getLookupService()

setLookupService

public void setLookupService(LookupService lookupService)

getDataObjectAuthorizationService

protected DataObjectAuthorizationService getDataObjectAuthorizationService()

setDataObjectAuthorizationService

public void setDataObjectAuthorizationService(DataObjectAuthorizationService dataObjectAuthorizationService)

getDataObjectMetaDataService

protected DataObjectMetaDataService getDataObjectMetaDataService()

setDataObjectMetaDataService

public void setDataObjectMetaDataService(DataObjectMetaDataService dataObjectMetaDataService)

getDocumentDictionaryService

public DocumentDictionaryService getDocumentDictionaryService()

setDocumentDictionaryService

public void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService)

getEncryptionService

protected EncryptionService getEncryptionService()

setEncryptionService

public void setEncryptionService(EncryptionService encryptionService)

getBusinessObjectService

protected BusinessObjectService getBusinessObjectService()

setBusinessObjectService

public void setBusinessObjectService(BusinessObjectService businessObjectService)

getMaintenanceDocumentService

protected MaintenanceDocumentService getMaintenanceDocumentService()

setMaintenanceDocumentService

public void setMaintenanceDocumentService(MaintenanceDocumentService maintenanceDocumentService)


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.