Package org.kuali.rice.krad.maintenance
Class MaintainableImpl
java.lang.Object
org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl
org.kuali.rice.krad.maintenance.MaintainableImpl
- All Implemented Interfaces:
Serializable,Maintainable,ViewHelperService
- Direct Known Subclasses:
BulkUpdateMaintainableImpl
Default implementation of the
Maintainable interface.- Author:
- Kuali Rice Team (rice.collab@kuali.org)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInvokes to delete the data object being maintainedvoiddoRouteStatusChange(org.kuali.rice.krad.bo.DocumentHeader documentHeader) Invoked do perform custom processing when the route status for the containing maintenance document changesList<org.kuali.rice.krad.maintenance.MaintenanceLock> Note: as currently implemented, every key field for a given data object class must have a visible getter.protected List<org.kuali.rice.krad.maintenance.MaintenanceLock> generateMaintenanceLocks(String documentNumber, String documentTypeName, Class<?> dataObjectClass, Object dataObject) Allows locking of maintenance objects other than the one of the current maintenance object.getCustomLockDescriptor(org.kuali.rice.kim.api.identity.Person user) Default implementation just throws a PessimisticLockingException.Returns instance of the data object that is being maintainedprotected DataObjectAuthorizationServiceClass<?> Returns the class for the data object being maintainedprotected org.kuali.rice.krad.data.DataObjectServiceprotected StringRetrieves the document number configured on this maintainable.getDocumentTitle(MaintenanceDocument document) Invoked when setting the title for the document instance in workflow (doc search results) to customize the titleprotected StringRetrieves the document type name from the data dictionary based on business object classprotected org.kuali.rice.core.api.encryption.EncryptionServiceprotected LegacyDataAdapterDeprecated.Retrieves the locking document id for the maintainable which is used to create the maintenance lock stringReturns the type of maintenance action this maintainable has been configured withprotected MaintenanceDocumentServiceReturns the persistable business object or null if none exists.Return an array of document ids to lock prior to processing this document in the workflow enginebooleanIndicates whether the object being maintained is an instance ofExternalizableBusinessObjectbooleanDeprecated.note used by Rice frameworkbooleanIndicates whether this maintainable supports notes on the maintenance objectbooleanChecks whether the data object is not null and has its primary key values populated.protected booleanperformAddLineValidation(ViewModel viewModel, Object newLine, String collectionId, String collectionPath) Performs validation on the new collection line before it is added to the corresponding collection.voidperformCustomApplyModel(LifecycleElement element, Object model) Hook for service overrides to perform custom apply model logic on the component.voidperformCustomFinalize(LifecycleElement element, Object model, LifecycleElement parent) For the copy action, clears out primary key values, applies defaults to previously cleared fields, and replaces any new fields that the current user is unauthorized for with default values in the old record.voidperformCustomViewFinalize(Object model) For the copy action, runs the custom processing after the copy and sets the indicator that fields have been copied as true.voidprepareExternalBusinessObject(org.kuali.rice.krad.bo.BusinessObject businessObject) Deprecated.voidHook for performing any custom processing before the maintenance object is savedvoidprocessAfterAddLine(ViewModel viewModel, Object addLine, String collectionId, String collectionPath, boolean isValidLine) In the case of edit maintenance adds a new blank line to the old side.voidprocessAfterCopy(MaintenanceDocument document, Map<String, String[]> requestParameters) Hook for performing any custom processing after the maintenance object has been setup for a copy actionvoidprocessAfterDeleteLine(ViewModel model, String collectionId, String collectionPath, int lineIndex) In the case of edit maintenance deleted the item on the old side.voidprocessAfterEdit(MaintenanceDocument document, Map<String, String[]> requestParameters) Hook for performing any custom processing after the maintenance object has been setup for a edit actionvoidprocessAfterNew(MaintenanceDocument document, Map<String, String[]> requestParameters) Hook for performing any custom processing after the maintenance object has been setup for a new actionvoidprocessAfterPost(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)voidHook for performing any custom processing after the maintenance object is retrieved from persistence storageretrieveObjectForEditOrCopy(MaintenanceDocument document, Map<String, String> dataObjectKeys) Called during setupMaintenanceObject to retrieve the original dataObject that is being edited or copied.voidInvoked to persist changes to the data object being maintainedvoidsetDataObject(Object object) Sets an instance of a data object that should be maintainedvoidsetDataObjectAuthorizationService(DataObjectAuthorizationService dataObjectAuthorizationService) voidsetDataObjectClass(Class<?> dataObjectClass) Sets the class for the data object that will be maintainedvoidsetDocumentDictionaryService(DocumentDictionaryService documentDictionaryService) voidsetDocumentNumber(String documentNumber) Sets the document number on this maintainable for referencing back to the containingMaintenanceDocumentvoidsetEncryptionService(org.kuali.rice.core.api.encryption.EncryptionService encryptionService) voidsetKualiRuleService(KualiRuleService kualiRuleService) voidsetLegacyDataAdapter(LegacyDataAdapter legacyDataAdapter) Deprecated.voidsetMaintenanceAction(String maintenanceAction) Sets the type of maintenance action to be performed (new, edit, or copy)voidsetMaintenanceDocumentService(MaintenanceDocumentService maintenanceDocumentService) voidsetupNewFromExisting(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.booleanDefault 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, buildGrowlScript, buildInquiryLink, containsDuplicateLine, extractNewValuesAndAssign, extractSingleValue, filterByReturnedFieldConversions, getConfigurationService, getCurrentPersonContactId, getDataDictionaryService, getDefaultValueForField, getExpressionEvaluatorFactory, getViewDictionaryService, isDuplicateLine, linkAddedLine, logAndThrowRuntime, performCustomInitialization, performCustomViewInitialization, performDeleteLineValidation, populateDefaultValueForField, populateViewFromRequestParameters, processAfterEditLine, processAfterSaveLine, processAndAddLineObject, processBeforeAddLine, processBeforeEditLine, processBeforeSaveLine, processCollectionAddBlankLine, processCollectionAddLine, processCollectionCloseEditLineDialog, processCollectionDeleteLine, processCollectionEditLine, processCollectionRetrieveEditLineDialog, processCollectionSaveLine, processMultipleValueLookupResults, refreshReference, refreshReferences, retrieveEditModesAndActionFlags, setConfigurationService, setDataDictionaryService, setDataObjectService, setElementContext, setExpressionEvaluatorFactory, setViewContext, setViewDictionaryServiceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.kuali.rice.krad.uif.service.ViewHelperService
addCustomContainerComponents, applyDefaultValues, applyDefaultValuesForCollectionLine, buildGrowlScript, buildInquiryLink, getDefaultValueForField, getExpressionEvaluatorFactory, performCustomInitialization, performCustomViewInitialization, populateDefaultValueForField, populateViewFromRequestParameters, processAfterEditLine, processAfterSaveLine, processAndAddLineObject, processBeforeAddLine, processBeforeEditLine, processBeforeSaveLine, processCollectionAddBlankLine, processCollectionAddLine, processCollectionCloseEditLineDialog, processCollectionDeleteLine, processCollectionEditLine, processCollectionRetrieveEditLineDialog, processCollectionSaveLine, processMultipleValueLookupResults, refreshReference, refreshReferences, retrieveEditModesAndActionFlags, setElementContext, setViewContext
-
Constructor Details
-
MaintainableImpl
public MaintainableImpl()
-
-
Method Details
-
retrieveObjectForEditOrCopy
public Object retrieveObjectForEditOrCopy(MaintenanceDocument document, Map<String, String> dataObjectKeys) Description copied from interface:MaintainableCalled 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:
retrieveObjectForEditOrCopyin interfaceMaintainable- Parameters:
document- document instance for the maintenance objectdataObjectKeys- Map of keys for the requested object- Returns:
- the object identified by the dataObjectKeys
- See Also:
-
setDocumentNumber
Description copied from interface:MaintainableSets the document number on this maintainable for referencing back to the containingMaintenanceDocument- Specified by:
setDocumentNumberin interfaceMaintainable- Parameters:
documentNumber- - document number for the containing maintenance document- See Also:
-
getDocumentTitle
Description copied from interface:MaintainableInvoked when setting the title for the document instance in workflow (doc search results) to customize the title- Specified by:
getDocumentTitlein interfaceMaintainable- Parameters:
document- - maintenance document instance to build title for- Returns:
- String document title
- See Also:
-
getDataObject
Description copied from interface:MaintainableReturns instance of the data object that is being maintained- Specified by:
getDataObjectin interfaceMaintainable- Returns:
- Object data object instance
- See Also:
-
setDataObject
Description copied from interface:MaintainableSets an instance of a data object that should be maintained- Specified by:
setDataObjectin interfaceMaintainable- Parameters:
object- - data object instance- See Also:
-
getDataObjectClass
Description copied from interface:MaintainableReturns the class for the data object being maintained- Specified by:
getDataObjectClassin interfaceMaintainable- Returns:
- Class data object class
- See Also:
-
setDataObjectClass
Description copied from interface:MaintainableSets the class for the data object that will be maintained- Specified by:
setDataObjectClassin interfaceMaintainable- Parameters:
dataObjectClass- - class for maintenance data object- See Also:
-
isLockable
Deprecated.note used by Rice frameworkPersistable business objects are lockable.- Specified by:
isLockablein interfaceMaintainable- Returns:
- true if maintenance is lockable, false otherwise
-
getMaintenanceAction
Description copied from interface:MaintainableReturns the type of maintenance action this maintainable has been configured with- Specified by:
getMaintenanceActionin interfaceMaintainable- Returns:
- String maintenance action string
- See Also:
-
setMaintenanceAction
Description copied from interface:MaintainableSets the type of maintenance action to be performed (new, edit, or copy)- Specified by:
setMaintenanceActionin interfaceMaintainable- Parameters:
maintenanceAction- - string identifying the action type- See Also:
-
generateMaintenanceLocks
Note: as currently implemented, every key field for a given data object class must have a visible getter.- Specified by:
generateMaintenanceLocksin interfaceMaintainable- Returns:
- the locking representation(s) of this document, which are reproducible given the same keys and the same maintainable object
- See Also:
-
generateMaintenanceLocks
protected List<org.kuali.rice.krad.maintenance.MaintenanceLock> generateMaintenanceLocks(String documentNumber, String documentTypeName, Class<?> dataObjectClass, Object dataObject) Allows locking of maintenance objects other than the one of the current maintenance object.- Parameters:
documentNumber- of the locking maintenance documentdocumentTypeName- of the maintenance document to be lockeddataObjectClass- of the maintenance document to be lockeddataObject- of the maintenance document to be locked- Returns:
-
getDocumentTypeName
Retrieves the document type name from the data dictionary based on business object class -
saveDataObject
public void saveDataObject()Description copied from interface:MaintainableInvoked to persist changes to the data object being maintainedCalled after the maintenance document has become final indicating the changes should be applied
- Specified by:
saveDataObjectin interfaceMaintainable- See Also:
-
deleteDataObject
public void deleteDataObject()Description copied from interface:MaintainableInvokes to delete the data object being maintainedCalled after the maintenance document has become final indicating the changes should be applied
- Specified by:
deleteDataObjectin interfaceMaintainable- See Also:
-
doRouteStatusChange
public void doRouteStatusChange(org.kuali.rice.krad.bo.DocumentHeader documentHeader) Description copied from interface:MaintainableInvoked do perform custom processing when the route status for the containing maintenance document changesUsually 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:
doRouteStatusChangein interfaceMaintainable- Parameters:
documentHeader- - document header instance for containing maintenance document which can be used to check the new status- See Also:
-
getLockingDocumentId
Description copied from interface:MaintainableRetrieves the locking document id for the maintainable which is used to create the maintenance lock string- Specified by:
getLockingDocumentIdin interfaceMaintainable- Returns:
- String locking id
- See Also:
-
getWorkflowEngineDocumentIdsToLock
Description copied from interface:MaintainableReturn an array of document ids to lock prior to processing this document in the workflow engine- Specified by:
getWorkflowEngineDocumentIdsToLockin interfaceMaintainable- Returns:
- List<String> list of document ids
- See Also:
-
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:
useCustomLockDescriptorsin interfaceMaintainable- Returns:
- boolean true if the maintainable can generate custom lock descriptors, false otherwise
- See Also:
-
getCustomLockDescriptor
Default implementation just throws a PessimisticLockingException. Subclasses of MaintainableImpl that need support for custom lock descriptors should override this method- Specified by:
getCustomLockDescriptorin interfaceMaintainable- Parameters:
user- - the user trying to establish the lock- Returns:
- String representing the lock descriptor
- See Also:
-
isNotesEnabled
public boolean isNotesEnabled()Description copied from interface:MaintainableIndicates whether this maintainable supports notes on the maintenance objectNote this is only applicable if the data object is an instance of
BusinessObject- Specified by:
isNotesEnabledin interfaceMaintainable- Returns:
- boolean true if notes are supported, false if they are not supported
- See Also:
-
isExternalBusinessObject
public boolean isExternalBusinessObject()Description copied from interface:MaintainableIndicates whether the object being maintained is an instance ofExternalizableBusinessObjectFor 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:
isExternalBusinessObjectin interfaceMaintainable- Returns:
- boolean true if the data object is an external business object, false if not
- See Also:
-
prepareExternalBusinessObject
@Deprecated public void prepareExternalBusinessObject(org.kuali.rice.krad.bo.BusinessObject businessObject) Deprecated.Description copied from interface:MaintainableInvoked to prepare a newBusinessObjectinstance that is external- Specified by:
prepareExternalBusinessObjectin interfaceMaintainable- Parameters:
businessObject- - new business object instance to prepare- See Also:
-
isOldDataObjectInDocument
public boolean isOldDataObjectInDocument()Checks whether the data object is not null and has its primary key values populated.- Specified by:
isOldDataObjectInDocumentin interfaceMaintainable- Returns:
- boolean true if old data object exists, false if not
- See Also:
-
prepareForSave
public void prepareForSave()Description copied from interface:MaintainableHook for performing any custom processing before the maintenance object is saved- Specified by:
prepareForSavein interfaceMaintainable- See Also:
-
processAfterRetrieve
public void processAfterRetrieve()Description copied from interface:MaintainableHook for performing any custom processing after the maintenance object is retrieved from persistence storage- Specified by:
processAfterRetrievein interfaceMaintainable- See Also:
-
setupNewFromExisting
Description copied from interface:MaintainablePerforms 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:
setupNewFromExistingin interfaceMaintainable- Parameters:
document- - maintenance document instance this maintainable belong toparameters- - map of request parameters sent for the request- See Also:
-
processAfterCopy
Description copied from interface:MaintainableHook for performing any custom processing after the maintenance object has been setup for a copy action- Specified by:
processAfterCopyin interfaceMaintainable- Parameters:
document- - maintenance document instance this maintainable belong torequestParameters- - map of request parameters sent for the copy request- See Also:
-
processAfterEdit
Description copied from interface:MaintainableHook for performing any custom processing after the maintenance object has been setup for a edit action- Specified by:
processAfterEditin interfaceMaintainable- Parameters:
document- - maintenance document instance this maintainable belong torequestParameters- - map of request parameters sent for the copy request- See Also:
-
processAfterNew
Description copied from interface:MaintainableHook for performing any custom processing after the maintenance object has been setup for a new action- Specified by:
processAfterNewin interfaceMaintainable- Parameters:
document- - maintenance document instance this maintainable belong torequestParameters- - map of request parameters sent for the copy request- See Also:
-
processAfterPost
Description copied from interface:MaintainableHook for performing any custom processing after each posting of the maintenance document (for various actions like add line, refresh)- Specified by:
processAfterPostin interfaceMaintainable- Parameters:
document- - maintenance document instance this maintainable belong torequestParameters- - map of request parameters from the post- See Also:
-
processAfterAddLine
public void processAfterAddLine(ViewModel viewModel, Object addLine, String collectionId, String collectionPath, 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:
processAfterAddLinein interfaceViewHelperService- Overrides:
processAfterAddLinein classViewHelperServiceImpl- Parameters:
viewModel- object instance that contain's the views dataaddLine- the new line that was addedcollectionId- the id of the collection being added tocollectionPath- the path to the collection being modifiedisValidLine- indicates if the line is valid
-
processAfterDeleteLine
public void processAfterDeleteLine(ViewModel model, String collectionId, String collectionPath, int lineIndex) In the case of edit maintenance deleted the item on the old side.- Specified by:
processAfterDeleteLinein interfaceViewHelperService- Overrides:
processAfterDeleteLinein classViewHelperServiceImpl- Parameters:
model- object instance that contains the views datacollectionId- the id of the collection being added tocollectionPath- the path to the collection being modifiedlineIndex- index of the line that was deleted- See Also:
-
performAddLineValidation
protected boolean performAddLineValidation(ViewModel viewModel, Object newLine, String collectionId, String collectionPath) Description copied from class:ViewHelperServiceImplPerforms validation on the new collection line before it is added to the corresponding collection.- Overrides:
performAddLineValidationin classViewHelperServiceImpl- Parameters:
viewModel- object instance that contain's the view's datanewLine- the new line instance to be processedcollectionId- the id of the collection being added tocollectionPath- the path to the collection being modified
-
getDocumentNumber
Retrieves the document number configured on this maintainable.- Returns:
- String document number
-
performCustomApplyModel
Hook for service overrides to perform custom apply model logic on the component.- Specified by:
performCustomApplyModelin interfaceViewHelperService- Overrides:
performCustomApplyModelin classViewHelperServiceImpl- Parameters:
element- element instance to apply model tomodel- Top level object containing the data (could be the model or a top level business object, dto)
-
performCustomFinalize
For the copy action, clears out primary key values, applies defaults to previously cleared fields, 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:
performCustomFinalizein interfaceViewHelperService- Overrides:
performCustomFinalizein classViewHelperServiceImpl- Parameters:
element- component instance to updatemodel- Top level object containing the dataparent- Parent component for the component being finalized
-
performCustomViewFinalize
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 view component finalization- Specified by:
performCustomViewFinalizein interfaceViewHelperService- Overrides:
performCustomViewFinalizein classViewHelperServiceImpl- Parameters:
model- Top level object containing the data
-
getLegacyDataAdapter
Deprecated.Description copied from class:ViewHelperServiceImplGet the legacy data adapter.- Overrides:
getLegacyDataAdapterin classViewHelperServiceImpl- Returns:
- The legacy data adapter.
-
setLegacyDataAdapter
Deprecated.Description copied from class:ViewHelperServiceImplSet the legacy data adapter.- Overrides:
setLegacyDataAdapterin classViewHelperServiceImpl- Parameters:
legacyDataAdapter- The legacy data adapter.
-
getDataObjectAuthorizationService
-
setDataObjectAuthorizationService
public void setDataObjectAuthorizationService(DataObjectAuthorizationService dataObjectAuthorizationService) -
getDocumentDictionaryService
-
setDocumentDictionaryService
-
getEncryptionService
protected org.kuali.rice.core.api.encryption.EncryptionService getEncryptionService() -
setEncryptionService
public void setEncryptionService(org.kuali.rice.core.api.encryption.EncryptionService encryptionService) -
getDataObjectService
protected org.kuali.rice.krad.data.DataObjectService getDataObjectService()- Overrides:
getDataObjectServicein classViewHelperServiceImpl
-
getMaintenanceDocumentService
-
setMaintenanceDocumentService
-
getKualiRuleService
-
setKualiRuleService
-
getPersistableBusinessObject
Description copied from interface:MaintainableReturns the persistable business object or null if none exists.- Specified by:
getPersistableBusinessObjectin interfaceMaintainable- Returns:
- persistable buisness object
-