org.kuali.rice.krad.service.impl
Class MaintenanceDocumentServiceImpl

java.lang.Object
  extended by org.kuali.rice.krad.service.impl.MaintenanceDocumentServiceImpl
All Implemented Interfaces:
MaintenanceDocumentService

public class MaintenanceDocumentServiceImpl
extends Object
implements MaintenanceDocumentService

Service implementation for the MaintenanceDocument structure. This is the default implementation, that is delivered with Kuali

Author:
Kuali Rice Team (rice.collab@kuali.org)

Field Summary
protected static org.apache.log4j.Logger LOG
           
 
Constructor Summary
MaintenanceDocumentServiceImpl()
           
 
Method Summary
protected  Map<String,String> buildKeyMapFromRequest(Map<String,String[]> requestParameters, Class<?> dataObjectClass)
          Based on the maintenance object class retrieves the key field names from the BusinessObjectMetaDataService (or alternatively from the request parameters), then retrieves any matching key value pairs from the request parameters
protected  void checkMaintenanceActionAuthorization(MaintenanceDocument document, Object oldBusinessObject, String maintenanceAction, Map<String,String[]> requestParameters)
          For the edit and delete maintenance actions checks with the BusinessObjectAuthorizationService to check whether the action is allowed for the record data.
protected  void clearPrimaryKeyFields(Object maintenanceObject, Class<?> dataObjectClass)
          Clears the value of the primary key fields on the maintenance object
protected  void clearUnauthorizedNewFields(MaintenanceDocument document)
          Used as part of the Copy functionality, to clear any field values that the user making the copy does not have permissions to modify.
 void deleteLocks(String documentNumber)
          Call the same-named method in the Dao, since the service has access to the Dao, but the caller doesn't.
protected  DataObjectAuthorizationService getDataObjectAuthorizationService()
           
protected  DataObjectMetaDataService getDataObjectMetaDataService()
           
 DocumentDictionaryService getDocumentDictionaryService()
           
protected  DocumentService getDocumentService()
           
 String getLockingDocumentId(Maintainable maintainable, String documentNumber)
          Attempts to find any other active documents that are pending on the same maintenance record.
 String getLockingDocumentId(MaintenanceDocument document)
          Attempts to find any other active documents that are pending on the same maintenance record.
 MaintenanceDocumentDao getMaintenanceDocumentDao()
           
protected  void populateMaintenanceObjectWithCopyKeyValues(Map<String,String> parameters, Object oldBusinessObject, Maintainable oldMaintainableObject)
          Looks for a special request parameters giving the names of the keys that should be retrieved from the request parameters and copied to the maintenance object
protected  void processMaintenanceObjectForCopy(MaintenanceDocument document, Object maintenanceObject, Map<String,String[]> requestParameters)
          For the copy action clears out primary key values for the old record and does authorization checks on the remaining fields.
protected  Object retrieveObjectForMaintenance(MaintenanceDocument document, Map<String,String[]> requestParameters)
          For the edit or copy actions retrieves the record that is to be maintained
 void setDataObjectAuthorizationService(DataObjectAuthorizationService dataObjectAuthorizationService)
           
 void setDataObjectMetaDataService(DataObjectMetaDataService dataObjectMetaDataService)
           
 void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService)
           
 void setDocumentService(DocumentService documentService)
           
 void setMaintenanceDocumentDao(MaintenanceDocumentDao maintenanceDocumentDao)
           
 void setupMaintenanceObject(MaintenanceDocument document, String maintenanceAction, Map<String,String[]> requestParameters)
          Called to setup the object being maintained
 MaintenanceDocument setupNewMaintenanceDocument(String objectClassName, String documentTypeName, String maintenanceAction)
          Prepares the MaintenanceDocument on initial request
 void storeLocks(List<MaintenanceLock> maintenanceLocks)
          Call the same-named method in the Dao, since the service has access to the Dao, but the caller doesn't.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.log4j.Logger LOG
Constructor Detail

MaintenanceDocumentServiceImpl

public MaintenanceDocumentServiceImpl()
Method Detail

setupNewMaintenanceDocument

public MaintenanceDocument setupNewMaintenanceDocument(String objectClassName,
                                                       String documentTypeName,
                                                       String maintenanceAction)
Description copied from interface: MaintenanceDocumentService
Prepares the MaintenanceDocument on initial request

This includes retrieving the data object for edit or copy, clearing fields

Specified by:
setupNewMaintenanceDocument in interface MaintenanceDocumentService
Parameters:
objectClassName - - class name for the object being maintained
documentTypeName - - workflow doc type for the maintenance document requested
maintenanceAction - - indicates whether this is a new, copy, or edit maintenance action
Returns:
MaintenanceDocument prepared document instance
See Also:
MaintenanceDocumentService.setupNewMaintenanceDocument(java.lang.String, java.lang.String, java.lang.String)

setupMaintenanceObject

public void setupMaintenanceObject(MaintenanceDocument document,
                                   String maintenanceAction,
                                   Map<String,String[]> requestParameters)
Description copied from interface: MaintenanceDocumentService
Called to setup the object being maintained

For edit and copy actions, the old record is retrieved and prepared for editing (in the case of a copy some fields are cleared). In addition some authorization checks are performed and hooks for custom Maintainble implementations are invoked.

Specified by:
setupMaintenanceObject in interface MaintenanceDocumentService
Parameters:
document - - document instance for the maintenance object
maintenanceAction - - the requested maintenance action (new, new with existing, copy, edit)
requestParameters - - Map of parameters from the request
See Also:
setupMaintenanceObject(org.kuali.rice.krad.maintenance.MaintenanceDocument, java.lang.String, java.util.Map)

checkMaintenanceActionAuthorization

protected void checkMaintenanceActionAuthorization(MaintenanceDocument document,
                                                   Object oldBusinessObject,
                                                   String maintenanceAction,
                                                   Map<String,String[]> requestParameters)
For the edit and delete maintenance actions checks with the BusinessObjectAuthorizationService to check whether the action is allowed for the record data. In action is allowed invokes the custom processing hook on the Maintainble.

Parameters:
document - - document instance for the maintenance object
oldBusinessObject - - the old maintenance record
maintenanceAction - - type of maintenance action requested
requestParameters - - map of parameters from the request

retrieveObjectForMaintenance

protected Object retrieveObjectForMaintenance(MaintenanceDocument document,
                                              Map<String,String[]> requestParameters)
For the edit or copy actions retrieves the record that is to be maintained

Based on the persistence metadata for the maintenance object class retrieves the primary key values from the given request parameters map (if the class is persistable). With those key values attempts to find the record using the LookupService.

Parameters:
document - - document instance for the maintenance object
requestParameters - - Map of parameters from the request
Returns:
Object the retrieved old object

processMaintenanceObjectForCopy

protected void processMaintenanceObjectForCopy(MaintenanceDocument document,
                                               Object maintenanceObject,
                                               Map<String,String[]> requestParameters)
For the copy action clears out primary key values for the old record and does authorization checks on the remaining fields. Also invokes the custom processing method on the Maintainble

Parameters:
document - - document instance for the maintenance object
maintenanceObject - - the object instance being maintained
requestParameters - - map of parameters from the request

clearPrimaryKeyFields

protected void clearPrimaryKeyFields(Object maintenanceObject,
                                     Class<?> dataObjectClass)
Clears the value of the primary key fields on the maintenance object

Parameters:
document - - document to clear the pk fields on
dataObjectClass - - class to use for retrieving primary key metadata

clearUnauthorizedNewFields

protected void clearUnauthorizedNewFields(MaintenanceDocument document)
Used as part of the Copy functionality, to clear any field values that the user making the copy does not have permissions to modify. This will prevent authorization errors on a copy.

Parameters:
document - - document to be adjusted

buildKeyMapFromRequest

protected Map<String,String> buildKeyMapFromRequest(Map<String,String[]> requestParameters,
                                                    Class<?> dataObjectClass)
Based on the maintenance object class retrieves the key field names from the BusinessObjectMetaDataService (or alternatively from the request parameters), then retrieves any matching key value pairs from the request parameters

Parameters:
requestParameters - - map of parameters from the request
dataObjectClass - - class to use for checking security parameter restrictions
Returns:
Map key value pairs

populateMaintenanceObjectWithCopyKeyValues

protected void populateMaintenanceObjectWithCopyKeyValues(Map<String,String> parameters,
                                                          Object oldBusinessObject,
                                                          Maintainable oldMaintainableObject)
Looks for a special request parameters giving the names of the keys that should be retrieved from the request parameters and copied to the maintenance object

Parameters:
parameters - - map of parameters from the request
oldBusinessObject - - the old maintenance object
oldMaintainableObject - - the old maintainble object (used to get object class for security checks)

getLockingDocumentId

public String getLockingDocumentId(MaintenanceDocument document)
Description copied from interface: MaintenanceDocumentService
Attempts to find any other active documents that are pending on the same maintenance record. If any are pending and locked, thereby blocking this document, then the docHeaderId/documentNumber of the blocking locked document is returned. Otherwise, if nothing is blocking, then null is returned.

Specified by:
getLockingDocumentId in interface MaintenanceDocumentService
Parameters:
document - - document to test
Returns:
A String representing the docHeaderId of any blocking document, or null if none are blocking
See Also:
MaintenanceDocumentService.getLockingDocumentId(org.kuali.rice.krad.maintenance.MaintenanceDocument)

getLockingDocumentId

public String getLockingDocumentId(Maintainable maintainable,
                                   String documentNumber)
Description copied from interface: MaintenanceDocumentService
Attempts to find any other active documents that are pending on the same maintenance record. If any are pending and locked, thereby blocking this document, then the docHeaderId/documentNumber of the blocking locked document is returned. Otherwise, if nothing is blocking, then null is returned.

Specified by:
getLockingDocumentId in interface MaintenanceDocumentService
Parameters:
maintainable - - maintainable representing the document to test
documentNumber - - the documentNumber/docHeaderId of the document to test
Returns:
A String representing the docHeaderId of any blocking document, or null if none are blocking
See Also:
MaintenanceDocumentService.getLockingDocumentId(org.kuali.rice.krad.maintenance.Maintainable, java.lang.String)

deleteLocks

public void deleteLocks(String documentNumber)
Description copied from interface: MaintenanceDocumentService
Call the same-named method in the Dao, since the service has access to the Dao, but the caller doesn't. This method deletes the locks for the given document number. It is called when the document is final, thus it can be unlocked, or when the locks need to be regenerated (thus they get cleared first).

Specified by:
deleteLocks in interface MaintenanceDocumentService
Parameters:
documentNumber - - document number whose locks should be deleted
See Also:
MaintenanceDocumentService.deleteLocks(String)

storeLocks

public void storeLocks(List<MaintenanceLock> maintenanceLocks)
Description copied from interface: MaintenanceDocumentService
Call the same-named method in the Dao, since the service has access to the Dao, but the caller doesn't. This method stores the given list of maintenance locks. Typically these will all be for the same document.

Specified by:
storeLocks in interface MaintenanceDocumentService
Parameters:
maintenanceLocks - - the list of maintenance locks to be stored
See Also:
org.kuali.rice.krad.service.MaintenanceDocumentService#saveLocks(List)

getMaintenanceDocumentDao

public MaintenanceDocumentDao getMaintenanceDocumentDao()

setMaintenanceDocumentDao

public void setMaintenanceDocumentDao(MaintenanceDocumentDao maintenanceDocumentDao)

getDataObjectAuthorizationService

protected DataObjectAuthorizationService getDataObjectAuthorizationService()

setDataObjectAuthorizationService

public void setDataObjectAuthorizationService(DataObjectAuthorizationService dataObjectAuthorizationService)

getDocumentService

protected DocumentService getDocumentService()

setDocumentService

public void setDocumentService(DocumentService documentService)

getDataObjectMetaDataService

protected DataObjectMetaDataService getDataObjectMetaDataService()

setDataObjectMetaDataService

public void setDataObjectMetaDataService(DataObjectMetaDataService dataObjectMetaDataService)

getDocumentDictionaryService

public DocumentDictionaryService getDocumentDictionaryService()

setDocumentDictionaryService

public void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService)


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