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, 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
 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  DataObjectService getDataObjectService()
           
 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()
           
protected  LegacyDataAdapter getLegacyDataAdapter()
          Deprecated. 
 String getLockingDocumentId()
          Retrieves the locking document id for the maintainable which is used to create the maintenance lock string
 String getMaintenanceAction()
          Returns the type of maintenance action this maintainable has been configured with
protected  MaintenanceDocumentService getMaintenanceDocumentService()
           
 PersistableBusinessObject getPersistableBusinessObject()
          Deprecated. this method has been left for compatibility reasons, use getDataObject instead.
 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 isLockable()
          Deprecated. note used by Rice framework
 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 performCustomFinalize(Component component, Object model, Component parent)
          For the copy action, clears out primary key values and replaces any new fields that the current user is unauthorized for with default values in the old record.
 void performCustomViewFinalize(Object model)
          For the copy action, runs the custom processing after the copy and sets the indicator that fields have been copied as true.
 void prepareExternalBusinessObject(BusinessObject businessObject)
          Deprecated. 
 void prepareForSave()
          Hook for performing any custom processing before the maintenance object is saved
 void processAfterAddLine(View view, CollectionGroup collectionGroup, Object model, Object addLine, boolean isValidLine)
          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
 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 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 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 setLegacyDataAdapter(LegacyDataAdapter legacyDataAdapter)
          Deprecated. 
 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
addCustomContainerComponents, addLine, applyDefaultValues, applyDefaultValuesForCollectionLine, buildExportTableData, buildExportTableRow, buildGrowlScript, buildInquiryLink, getConfigurationService, getDataDictionaryService, getDefaultValueForField, getExportTableFormatOptions, getViewDictionaryService, logAndThrowRuntime, performAddLineValidation, performCustomApplyModel, performCustomInitialization, performCustomViewInitialization, performDeleteLineValidation, populateDefaultValueForField, populateViewFromRequestParameters, processAfterSaveLine, processBeforeAddLine, processBeforeSaveLine, processCollectionAddBlankLine, processCollectionAddLine, processCollectionDeleteLine, processCollectionSaveLine, processMultipleValueLookupResults, refreshReference, refreshReferences, retrieveEditModesAndActionFlags, setConfigurationService, setDataDictionaryService, setViewContext, setViewDictionaryService
 
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
addCustomContainerComponents, applyDefaultValues, applyDefaultValuesForCollectionLine, buildExportTableData, buildGrowlScript, buildInquiryLink, getDefaultValueForField, performCustomApplyModel, performCustomInitialization, performCustomViewInitialization, populateDefaultValueForField, populateViewFromRequestParameters, processAfterSaveLine, processBeforeAddLine, processBeforeSaveLine, processCollectionAddBlankLine, processCollectionAddLine, processCollectionDeleteLine, processCollectionSaveLine, processMultipleValueLookupResults, refreshReference, refreshReferences, retrieveEditModesAndActionFlags, setViewContext
 

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 prepareExternalBusinessObject 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)

isLockable

@Deprecated
public boolean isLockable()
Deprecated. note used by Rice framework

Persistable business objects are lockable

Specified by:
isLockable in interface Maintainable
Returns:
true if maintenance is lockable, false otherwise

getPersistableBusinessObject

@Deprecated
public PersistableBusinessObject getPersistableBusinessObject()
Deprecated. this method has been left for compatibility reasons, use getDataObject instead.

Returns the data object if its persistable, null otherwise.

Specified by:
getPersistableBusinessObject in interface Maintainable
Returns:
persistable buisness object

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

@Deprecated
public void prepareExternalBusinessObject(BusinessObject businessObject)
Deprecated. 

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

public void processAfterAddLine(View view,
                                CollectionGroup collectionGroup,
                                Object model,
                                Object addLine,
                                boolean isValidLine)
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?

Specified by:
processAfterAddLine in interface ViewHelperService
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
isValidLine - indicates if the line is valid

processAfterDeleteLine

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

Specified by:
processAfterDeleteLine in interface ViewHelperService
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

performCustomFinalize

public void performCustomFinalize(Component component,
                                  Object model,
                                  Component parent)
For the copy action, clears out primary key values and replaces any new fields that the current user is unauthorized for with default values in the old record. Hook for service overrides to perform custom component finalization

Specified by:
performCustomFinalize in interface ViewHelperService
Overrides:
performCustomFinalize in class ViewHelperServiceImpl
Parameters:
component - component instance to update
model - Top level object containing the data
parent - Parent component for the component being finalized

performCustomViewFinalize

public void performCustomViewFinalize(Object model)
For the copy action, runs the custom processing after the copy and sets the indicator that fields have been copied as true. Hook for service overrides to perform custom component finalization.

Specified by:
performCustomViewFinalize in interface ViewHelperService
Overrides:
performCustomViewFinalize in class ViewHelperServiceImpl
Parameters:
model - Top level object containing the data

getLegacyDataAdapter

@Deprecated
protected LegacyDataAdapter getLegacyDataAdapter()
Deprecated. 

Description copied from class: ViewHelperServiceImpl
Get the legacy data adapter.

Overrides:
getLegacyDataAdapter in class ViewHelperServiceImpl
Returns:
The legacy data adapter.

setLegacyDataAdapter

@Deprecated
public void setLegacyDataAdapter(LegacyDataAdapter legacyDataAdapter)
Deprecated. 

Description copied from class: ViewHelperServiceImpl
Set the legacy data adapter.

Overrides:
setLegacyDataAdapter in class ViewHelperServiceImpl
Parameters:
legacyDataAdapter - The legacy data adapter.

getDataObjectAuthorizationService

protected DataObjectAuthorizationService getDataObjectAuthorizationService()

setDataObjectAuthorizationService

public void setDataObjectAuthorizationService(DataObjectAuthorizationService dataObjectAuthorizationService)

getDocumentDictionaryService

public DocumentDictionaryService getDocumentDictionaryService()

setDocumentDictionaryService

public void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService)

getEncryptionService

protected EncryptionService getEncryptionService()

setEncryptionService

public void setEncryptionService(EncryptionService encryptionService)

getDataObjectService

protected DataObjectService getDataObjectService()

getMaintenanceDocumentService

protected MaintenanceDocumentService getMaintenanceDocumentService()

setMaintenanceDocumentService

public void setMaintenanceDocumentService(MaintenanceDocumentService maintenanceDocumentService)


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