org.kuali.rice.kns.maintenance.rules
Class MaintenanceDocumentRuleBase

java.lang.Object
  extended by org.kuali.rice.krad.rules.DocumentRuleBase
      extended by org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase
All Implemented Interfaces:
AddCollectionLineRule, MaintenanceDocumentRule, AddAdHocRoutePersonRule, AddAdHocRouteWorkgroupRule, AddNoteRule, ApproveDocumentRule, BusinessRule, RouteDocumentRule, SaveDocumentRule, SendAdHocRequestsRule
Direct Known Subclasses:
GenericPermissionMaintenanceDocumentRule, ReviewResponsibilityMaintenanceDocumentRule, RoutingRuleMaintainableBusRule

public class MaintenanceDocumentRuleBase
extends DocumentRuleBase
implements MaintenanceDocumentRule, AddCollectionLineRule

Contains all of the business rules that are common to all maintenance documents

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

Field Summary
protected  BusinessObjectDictionaryService boDictionaryService
           
protected  BusinessObjectService boService
           
protected  BusinessObjectAuthorizationService businessObjectAuthorizationService
           
protected  BusinessObjectMetaDataService businessObjectMetaDataService
           
protected  ConfigurationService configService
           
protected  DataObjectMetaDataService dataObjectMetaDataService
           
protected  DataDictionaryService ddService
           
protected  DictionaryValidationService dictionaryValidationService
           
static String DOCUMENT_ERROR_PREFIX
           
protected  DocumentHelperService documentHelperService
           
protected static org.apache.log4j.Logger LOG
           
static String MAINTAINABLE_ERROR_PATH
           
static String MAINTAINABLE_ERROR_PREFIX
           
protected  MaintenanceDocumentDictionaryService maintDocDictionaryService
           
protected  PersistenceStructureService persistenceStructureService
           
protected  PersonService personService
           
protected  List priorErrorPath
           
protected  RoleService roleService
           
protected  WorkflowDocumentService workflowDocumentService
           
 
Constructor Summary
MaintenanceDocumentRuleBase()
          Default constructor a MaintenanceDocumentRuleBase.java.
 
Method Summary
protected  boolean checkEmptyBOField(String propertyName, Object valueToTest, String parameter)
          This method accepts an object, and attempts to determine whether it is empty by this method's definition.
protected  boolean checkEmptyDocumentField(String propertyName, Object valueToTest, String parameter)
          This method accepts document field (such as , and attempts to determine whether it is empty by this method's definition.
protected  boolean checkEmptyValue(Object valueToTest)
          This method accepts document field (such as , and attempts to determine whether it is empty by this method's definition.
protected  boolean checkForPartiallyFilledOutReferenceForeignKeys(String referenceName)
          This method checks to make sure that if the foreign-key fields for the given reference attributes have any fields filled out, that all fields are filled out.
protected  void clearErrorPath()
          This method is used to deal with error paths that are not what we expect them to be.
protected  StringBuffer consolidateFieldNames(List fieldNames, String delimiter)
          This method turns a list of field property names, into a delimited string of the human-readable names.
protected  boolean dataDictionaryValidate(MaintenanceDocument document)
          This method executes the DataDictionary Validation against the document.
protected  boolean errorAlreadyExists(String propertyName, String errorConstant)
          Convenience method to determine whether the field already has the message indicated.
protected  BusinessObjectService getBoService()
          Gets the boService attribute.
protected  ConfigurationService getConfigService()
          Gets the configService attribute.
protected  DataObjectMetaDataService getDataObjectMetaDataService()
           
 DateTimeService getDateTimeService()
           
protected  DataDictionaryService getDdService()
          Gets the ddService attribute.
protected  DictionaryValidationService getDictionaryValidationService()
          Gets the dictionaryValidationService attribute.
 DocumentHelperService getDocumentHelperService()
           
protected  String getFieldLabel(Class boClass, String fieldName)
          This method translates the passed in field name into a human-readable attribute label.
protected  String getFieldLabel(String fieldName)
          This method translates the passed in field name into a human-readable attribute label.
protected  String getHumanReadablePrimaryKeyFieldNames(Class<?> boClass)
          This method creates a human-readable string of the class' primary key field names, as designated by the DataDictionary.
protected  MaintenanceDocumentDictionaryService getMaintDocDictionaryService()
          Gets the maintDocDictionaryService attribute.
protected  Object getNewBo()
          Gets the newBo attribute.
protected  Object getOldBo()
          Gets the oldBo attribute.
protected  PersistenceStructureService getPersistenceStructureService()
          Gets the persistenceStructureService attribute.
 PersonService getPersonService()
           
protected  RoleService getRoleService()
           
 WorkflowDocumentService getWorkflowDocumentService()
          Gets the workflowDocumentService attribute.
protected  boolean isCorrectMaintenanceClass(MaintenanceDocument document, Class clazz)
          This method tests to make sure the MaintenanceDocument passed in is based on the class you are expecting.
protected  boolean isDocumentInactivatingBusinessObject(MaintenanceDocument maintenanceDocument)
          Determines whether a document is inactivating the record being maintained
protected  boolean isDocumentValidForSave(MaintenanceDocument maintenanceDocument)
          This method checks to see if the document is in a state that it can be saved without causing exceptions.
protected  boolean primaryKeyCheck(MaintenanceDocument document)
          This method checks the two major cases that may violate primary key integrity.
 boolean processAddCollectionLineBusinessRules(MaintenanceDocument document, String collectionName, PersistableBusinessObject bo)
          This method allows business rules to be called whenever a new object is added to a maintainable collection in the UI layer.
 boolean processApproveDocument(ApproveDocumentEvent approveEvent)
          Runs all business rules needed prior to approving.
 boolean processCustomAddCollectionLineBusinessRules(MaintenanceDocument document, String collectionName, PersistableBusinessObject line)
           
protected  boolean processCustomApproveDocumentBusinessRules(MaintenanceDocument document)
          This method should be overridden to provide custom rules for processing document approval.
protected  boolean processCustomRouteDocumentBusinessRules(MaintenanceDocument document)
          This method should be overridden to provide custom rules for processing document routing
protected  boolean processCustomSaveDocumentBusinessRules(MaintenanceDocument document)
          This method should be overridden to provide custom rules for processing document saving
protected  boolean processGlobalApproveDocumentBusinessRules(MaintenanceDocument document)
          This method enforces all business rules that are common to all maintenance documents which must be tested before doing an approval.
protected  boolean processGlobalRouteDocumentBusinessRules(MaintenanceDocument document)
          This method enforces all business rules that are common to all maintenance documents which must be tested before doing a route.
protected  boolean processGlobalSaveDocumentBusinessRules(MaintenanceDocument document)
          This method enforces all business rules that are common to all maintenance documents which must be tested before doing a save.
protected  boolean processInactivationBlockChecking(MaintenanceDocument maintenanceDocument)
          Determines whether this document has been inactivation blocked
protected  boolean processInactivationBlockChecking(MaintenanceDocument maintenanceDocument, InactivationBlockingMetadata inactivationBlockingMetadata)
          Given a InactivationBlockingMetadata, which represents a relationship that may block inactivation of a BO, it determines whether there is a record that violates the blocking definition
 boolean processRouteDocument(Document document)
          Runs all business rules needed prior to routing.
 boolean processSaveDocument(Document document)
          Runs all business rules needed prior to saving.
protected  void putDocumentError(String propertyName, String errorConstant, String parameter)
          This method is a convenience method to add a property-specific document error to the global errors list.
protected  void putDocumentError(String propertyName, String errorConstant, String[] parameters)
          This method is a convenience method to add a property-specific document error to the global errors list.
protected  void putFieldError(String propertyName, String errorConstant)
          This method is a convenience method to add a property-specific error to the global errors list.
protected  void putFieldError(String propertyName, String errorConstant, String parameter)
          This method is a convenience method to add a property-specific error to the global errors list.
protected  void putFieldError(String propertyName, String errorConstant, String[] parameters)
          This method is a convenience method to add a property-specific error to the global errors list.
protected  void putFieldErrorWithShortLabel(String propertyName, String errorConstant)
          Adds a property-specific error to the global errors list, with the DD short label as the single argument.
protected  void putGlobalError(String errorConstant)
          This method is a convenience method to easily add a Document level error (ie, one not tied to a specific field, but applicable to the whole document).
protected  void putGlobalError(String errorConstant, String parameter)
          This method is a convenience method to easily add a Document level error (ie, one not tied to a specific field, but applicable to the whole document).
protected  void putGlobalError(String errorConstant, String[] parameters)
          This method is a convenience method to easily add a Document level error (ie, one not tied to a specific field, but applicable to the whole document).
protected  void putGlobalsError(String propertyName, String errorConstant)
          This method specifically doesn't put any prefixes before the error so that the developer can do things specific to the globals errors (like newDelegateChangeDocument errors)
protected  void putGlobalsError(String propertyName, String errorConstant, String parameter)
          This method specifically doesn't put any prefixes before the error so that the developer can do things specific to the globals errors (like newDelegateChangeDocument errors)
protected  void putInactivationBlockingErrorOnPage(MaintenanceDocument document, InactivationBlockingMetadata inactivationBlockingMetadata)
          If there is a violation of an InactivationBlockingMetadata, it prints out an appropriate error into the error map
protected  void resumeErrorPath()
          This method is used to deal with error paths that are not what we expect them to be.
 void setBoDictionaryService(BusinessObjectDictionaryService boDictionaryService)
           
 void setBoService(BusinessObjectService boService)
          Sets the boService attribute value.
 void setBusinessObjectAuthorizationService(BusinessObjectAuthorizationService businessObjectAuthorizationService)
           
 void setBusinessObjectMetaDataService(BusinessObjectMetaDataService businessObjectMetaDataService)
           
 void setConfigService(ConfigurationService configService)
          Sets the configService attribute value.
 void setDataObjectMetaDataService(DataObjectMetaDataService dataObjectMetaDataService)
           
 void setDdService(DataDictionaryService ddService)
          Sets the ddService attribute value.
 void setDictionaryValidationService(DictionaryValidationService dictionaryValidationService)
          Sets the dictionaryValidationService attribute value.
 void setDocumentHelperService(DocumentHelperService documentHelperService)
           
 void setMaintDocDictionaryService(MaintenanceDocumentDictionaryService maintDocDictionaryService)
          Sets the maintDocDictionaryService attribute value.
protected  void setNewBo(Object newBo)
           
 void setPersistenceStructureService(PersistenceStructureService persistenceStructureService)
          Sets the persistenceStructureService attribute value.
 void setPersonService(PersonService personService)
           
 void setupBaseConvenienceObjects(MaintenanceDocument document)
          Sets the convenience objects like newAccount and oldAccount, so you have short and easy handles to the new and old objects contained in the maintenance document.
 void setupConvenienceObjects()
          Should always be overriden if a subclass is created.
 void setWorkflowDocumentService(WorkflowDocumentService workflowDocumentService)
          Sets the workflowDocumentService attribute value.
protected  void showErrorMap()
          This method is used during debugging to dump the contents of the error map, including the key names.
protected  boolean validateDocumentStructure(Document document)
          This method makes sure the document itself is valid, and has the necessary fields populated to be routable.
protected  boolean validateDuplicateIdentifierInDataDictionary(MaintenanceDocument document, String collectionName, PersistableBusinessObject bo)
          This method validates that there should only exist one entry in the collection whose fields match the fields specified within the duplicateIdentificationFields in the maintenance document data dictionary.
protected  boolean validateGlobalBusinessObjectPersistable(MaintenanceDocument document)
          This method checks whether this maint doc contains Global Business Objects, and if so, whether the GBOs are in a persistable state.
protected  boolean validateMaintenanceDocument(MaintenanceDocument maintenanceDocument)
          This method checks to make sure the document is a valid maintenanceDocument, and has the necessary values populated such that it will not cause exceptions in later routing or business rules testing.
 
Methods inherited from class org.kuali.rice.krad.rules.DocumentRuleBase
getDataDictionaryService, getDocumentDictionaryService, getGroupService, getKualiConfigurationService, getMaxDictionaryValidationDepth, getPermissionService, isAddHocRoutePersonValid, isAddHocRouteWorkgroupValid, isAdHocRouteRecipientsValid, isDocumentAttributesValid, isDocumentOverviewValid, isNoteValid, processAddAdHocRoutePerson, processAddAdHocRouteWorkgroup, processAddNote, processCompleteDocument, processCustomAddAdHocRoutePersonBusinessRules, processCustomAddAdHocRouteWorkgroupBusinessRules, processCustomAddNoteBusinessRules, processCustomApproveDocumentBusinessRules, processCustomCompleteDocumentBusinessRules, processCustomRouteDocumentBusinessRules, processCustomSaveDocumentBusinessRules, processCustomSendAdHocRequests, processSendAdHocRequests, setDocumentDictionaryService, setMaxDictionaryValidationDepth, validateSensitiveDataValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static org.apache.log4j.Logger LOG

MAINTAINABLE_ERROR_PREFIX

public static final String MAINTAINABLE_ERROR_PREFIX
See Also:
Constant Field Values

DOCUMENT_ERROR_PREFIX

public static final String DOCUMENT_ERROR_PREFIX
See Also:
Constant Field Values

MAINTAINABLE_ERROR_PATH

public static final String MAINTAINABLE_ERROR_PATH
See Also:
Constant Field Values

persistenceStructureService

protected PersistenceStructureService persistenceStructureService

ddService

protected DataDictionaryService ddService

documentHelperService

protected DocumentHelperService documentHelperService

boService

protected BusinessObjectService boService

dictionaryValidationService

protected DictionaryValidationService dictionaryValidationService

configService

protected ConfigurationService configService

maintDocDictionaryService

protected MaintenanceDocumentDictionaryService maintDocDictionaryService

workflowDocumentService

protected WorkflowDocumentService workflowDocumentService

personService

protected PersonService personService

roleService

protected RoleService roleService

dataObjectMetaDataService

protected DataObjectMetaDataService dataObjectMetaDataService

businessObjectAuthorizationService

protected BusinessObjectAuthorizationService businessObjectAuthorizationService

businessObjectMetaDataService

protected BusinessObjectMetaDataService businessObjectMetaDataService

boDictionaryService

protected BusinessObjectDictionaryService boDictionaryService

priorErrorPath

protected List priorErrorPath
Constructor Detail

MaintenanceDocumentRuleBase

public MaintenanceDocumentRuleBase()
Default constructor a MaintenanceDocumentRuleBase.java.

Method Detail

processSaveDocument

public boolean processSaveDocument(Document document)
Description copied from class: DocumentRuleBase
Runs all business rules needed prior to saving. This includes both common rules for all documents, plus class-specific business rules. This method will only return false if it fails the isValidForSave() test. Otherwise, it will always return positive regardless of the outcome of the business rules. However, any error messages resulting from the business rules will still be populated, for display to the consumer of this service.

Specified by:
processSaveDocument in interface MaintenanceDocumentRule
Specified by:
processSaveDocument in interface SaveDocumentRule
Overrides:
processSaveDocument in class DocumentRuleBase
Returns:
false if the rule fails
See Also:
org.kuali.rice.krad.maintenance.rules.MaintenanceDocumentRule#processSaveDocument(org.kuali.rice.krad.document.Document)

processRouteDocument

public boolean processRouteDocument(Document document)
Description copied from class: DocumentRuleBase
Runs all business rules needed prior to routing. This includes both common rules for all maintenance documents, plus class-specific business rules. This method will return false if any business rule fails, or if the document is in an invalid state, and not routable (see isDocumentValidForRouting()).

Specified by:
processRouteDocument in interface MaintenanceDocumentRule
Specified by:
processRouteDocument in interface RouteDocumentRule
Overrides:
processRouteDocument in class DocumentRuleBase
Returns:
false if the rule fails
See Also:
org.kuali.rice.krad.maintenance.rules.MaintenanceDocumentRule#processRouteDocument(org.kuali.rice.krad.document.Document)

isDocumentInactivatingBusinessObject

protected boolean isDocumentInactivatingBusinessObject(MaintenanceDocument maintenanceDocument)
Determines whether a document is inactivating the record being maintained

Parameters:
maintenanceDocument -
Returns:
true iff the document is inactivating the business object; false otherwise

processInactivationBlockChecking

protected boolean processInactivationBlockChecking(MaintenanceDocument maintenanceDocument)
Determines whether this document has been inactivation blocked

Parameters:
maintenanceDocument -
Returns:
true iff there is NOTHING that blocks this record

processInactivationBlockChecking

protected boolean processInactivationBlockChecking(MaintenanceDocument maintenanceDocument,
                                                   InactivationBlockingMetadata inactivationBlockingMetadata)
Given a InactivationBlockingMetadata, which represents a relationship that may block inactivation of a BO, it determines whether there is a record that violates the blocking definition

Parameters:
maintenanceDocument -
inactivationBlockingMetadata -
Returns:
true iff, based on the InactivationBlockingMetadata, the maintenance document should be allowed to route

putInactivationBlockingErrorOnPage

protected void putInactivationBlockingErrorOnPage(MaintenanceDocument document,
                                                  InactivationBlockingMetadata inactivationBlockingMetadata)
If there is a violation of an InactivationBlockingMetadata, it prints out an appropriate error into the error map

Parameters:
document -
inactivationBlockingMetadata -

processApproveDocument

public boolean processApproveDocument(ApproveDocumentEvent approveEvent)
Description copied from class: DocumentRuleBase
Runs all business rules needed prior to approving. This includes both common rules for all documents, plus class-specific business rules. This method will return false if any business rule fails, or if the document is in an invalid state, and not approveble.

Specified by:
processApproveDocument in interface MaintenanceDocumentRule
Specified by:
processApproveDocument in interface ApproveDocumentRule
Overrides:
processApproveDocument in class DocumentRuleBase
Returns:
false if the rule fails
See Also:
org.kuali.rice.krad.maintenance.rules.MaintenanceDocumentRule#processApproveDocument(org.kuali.rice.krad.rules.rule.event.ApproveDocumentEvent)

putGlobalError

protected void putGlobalError(String errorConstant)
This method is a convenience method to easily add a Document level error (ie, one not tied to a specific field, but applicable to the whole document).

Parameters:
errorConstant - - Error Constant that can be mapped to a resource for the actual text message.

putGlobalError

protected void putGlobalError(String errorConstant,
                              String parameter)
This method is a convenience method to easily add a Document level error (ie, one not tied to a specific field, but applicable to the whole document).

Parameters:
errorConstant - - Error Constant that can be mapped to a resource for the actual text message.
parameter - - Replacement value for part of the error message.

putGlobalError

protected void putGlobalError(String errorConstant,
                              String[] parameters)
This method is a convenience method to easily add a Document level error (ie, one not tied to a specific field, but applicable to the whole document).

Parameters:
errorConstant - - Error Constant that can be mapped to a resource for the actual text message.
parameters - - Array of replacement values for part of the error message.

putFieldError

protected void putFieldError(String propertyName,
                             String errorConstant)
This method is a convenience method to add a property-specific error to the global errors list. This method makes sure that the correct prefix is added to the property name so that it will display correctly on maintenance documents.

Parameters:
propertyName - - Property name of the element that is associated with the error. Used to mark the field as errored in the UI.
errorConstant - - Error Constant that can be mapped to a resource for the actual text message.

putFieldError

protected void putFieldError(String propertyName,
                             String errorConstant,
                             String parameter)
This method is a convenience method to add a property-specific error to the global errors list. This method makes sure that the correct prefix is added to the property name so that it will display correctly on maintenance documents.

Parameters:
propertyName - - Property name of the element that is associated with the error. Used to mark the field as errored in the UI.
errorConstant - - Error Constant that can be mapped to a resource for the actual text message.
parameter - - Single parameter value that can be used in the message so that you can display specific values to the user.

putFieldError

protected void putFieldError(String propertyName,
                             String errorConstant,
                             String[] parameters)
This method is a convenience method to add a property-specific error to the global errors list. This method makes sure that the correct prefix is added to the property name so that it will display correctly on maintenance documents.

Parameters:
propertyName - - Property name of the element that is associated with the error. Used to mark the field as errored in the UI.
errorConstant - - Error Constant that can be mapped to a resource for the actual text message.
parameters - - Array of strings holding values that can be used in the message so that you can display specific values to the user.

putFieldErrorWithShortLabel

protected void putFieldErrorWithShortLabel(String propertyName,
                                           String errorConstant)
Adds a property-specific error to the global errors list, with the DD short label as the single argument.

Parameters:
propertyName - - Property name of the element that is associated with the error. Used to mark the field as errored in the UI.
errorConstant - - Error Constant that can be mapped to a resource for the actual text message.

putDocumentError

protected void putDocumentError(String propertyName,
                                String errorConstant,
                                String parameter)
This method is a convenience method to add a property-specific document error to the global errors list. This method makes sure that the correct prefix is added to the property name so that it will display correctly on maintenance documents.

Parameters:
propertyName - - Property name of the element that is associated with the error. Used to mark the field as errored in the UI.
errorConstant - - Error Constant that can be mapped to a resource for the actual text message.
parameter - - Single parameter value that can be used in the message so that you can display specific values to the user.

putDocumentError

protected void putDocumentError(String propertyName,
                                String errorConstant,
                                String[] parameters)
This method is a convenience method to add a property-specific document error to the global errors list. This method makes sure that the correct prefix is added to the property name so that it will display correctly on maintenance documents.

Parameters:
propertyName - - Property name of the element that is associated with the error. Used to mark the field as errored in the UI.
errorConstant - - Error Constant that can be mapped to a resource for the actual text message.
parameters - - Array of String parameters that can be used in the message so that you can display specific values to the user.

errorAlreadyExists

protected boolean errorAlreadyExists(String propertyName,
                                     String errorConstant)
Convenience method to determine whether the field already has the message indicated. This is useful if you want to suppress duplicate error messages on the same field.

Parameters:
propertyName - - propertyName you want to test on
errorConstant - - errorConstant you want to test
Returns:
returns True if the propertyName indicated already has the errorConstant indicated, false otherwise

putGlobalsError

protected void putGlobalsError(String propertyName,
                               String errorConstant)
This method specifically doesn't put any prefixes before the error so that the developer can do things specific to the globals errors (like newDelegateChangeDocument errors)

Parameters:
propertyName -
errorConstant -

putGlobalsError

protected void putGlobalsError(String propertyName,
                               String errorConstant,
                               String parameter)
This method specifically doesn't put any prefixes before the error so that the developer can do things specific to the globals errors (like newDelegateChangeDocument errors)

Parameters:
propertyName -
errorConstant -
parameter -

clearErrorPath

protected void clearErrorPath()
This method is used to deal with error paths that are not what we expect them to be. This method, along with resumeErrorPath() are used to temporarily clear the errorPath, and then return it to the original state after the rule is executed. This method is called at the very beginning of rule enforcement and pulls a copy of the contents of the errorPath ArrayList to a local arrayList for temporary storage.


resumeErrorPath

protected void resumeErrorPath()
This method is used to deal with error paths that are not what we expect them to be. This method, along with clearErrorPath() are used to temporarily clear the errorPath, and then return it to the original state after the rule is executed. This method is called at the very end of the rule enforcement, and returns the temporarily stored copy of the errorPath to the global errorPath, so that no other classes are interrupted.


dataDictionaryValidate

protected boolean dataDictionaryValidate(MaintenanceDocument document)
This method executes the DataDictionary Validation against the document.

Parameters:
document -
Returns:
true if it passes DD validation, false otherwise

primaryKeyCheck

protected boolean primaryKeyCheck(MaintenanceDocument document)
This method checks the two major cases that may violate primary key integrity. 1. Disallow changing of the primary keys on an EDIT maintenance document. Other fields can be changed, but once the primary keys have been set, they are permanent. 2. Disallow creating a new object whose primary key values are already present in the system on a CREATE NEW maintenance document. This method also will add new Errors to the Global Error Map.

Parameters:
document - - The Maintenance Document being tested.
Returns:
Returns false if either test failed, otherwise returns true.

getHumanReadablePrimaryKeyFieldNames

protected String getHumanReadablePrimaryKeyFieldNames(Class<?> boClass)
This method creates a human-readable string of the class' primary key field names, as designated by the DataDictionary.

Parameters:
boClass -
Returns:

processGlobalApproveDocumentBusinessRules

protected boolean processGlobalApproveDocumentBusinessRules(MaintenanceDocument document)
This method enforces all business rules that are common to all maintenance documents which must be tested before doing an approval. It can be overloaded in special cases where a MaintenanceDocument has very special needs that would be contrary to what is enforced here.

Parameters:
document - - a populated MaintenanceDocument instance
Returns:
true if the document can be approved, false if not

processGlobalRouteDocumentBusinessRules

protected boolean processGlobalRouteDocumentBusinessRules(MaintenanceDocument document)
This method enforces all business rules that are common to all maintenance documents which must be tested before doing a route. It can be overloaded in special cases where a MaintenanceDocument has very special needs that would be contrary to what is enforced here.

Parameters:
document - - a populated MaintenanceDocument instance
Returns:
true if the document can be routed, false if not

processGlobalSaveDocumentBusinessRules

protected boolean processGlobalSaveDocumentBusinessRules(MaintenanceDocument document)
This method enforces all business rules that are common to all maintenance documents which must be tested before doing a save. It can be overloaded in special cases where a MaintenanceDocument has very special needs that would be contrary to what is enforced here. Note that although this method returns a true or false to indicate whether the save should happen or not, this result may not be followed by the calling method. In other words, the boolean result will likely be ignored, and the document saved, regardless.

Parameters:
document - - a populated MaintenanceDocument instance
Returns:
true if all business rules succeed, false if not

processCustomSaveDocumentBusinessRules

protected boolean processCustomSaveDocumentBusinessRules(MaintenanceDocument document)
This method should be overridden to provide custom rules for processing document saving

Parameters:
document -
Returns:
boolean

processCustomRouteDocumentBusinessRules

protected boolean processCustomRouteDocumentBusinessRules(MaintenanceDocument document)
This method should be overridden to provide custom rules for processing document routing

Parameters:
document -
Returns:
boolean

processCustomApproveDocumentBusinessRules

protected boolean processCustomApproveDocumentBusinessRules(MaintenanceDocument document)
This method should be overridden to provide custom rules for processing document approval.

Parameters:
document -
Returns:
booelan

isDocumentValidForSave

protected boolean isDocumentValidForSave(MaintenanceDocument maintenanceDocument)
This method checks to see if the document is in a state that it can be saved without causing exceptions. Note that Business Rules are NOT enforced here, only validity checks. This method will only return false if the document is in such a state that routing it will cause RunTimeExceptions.

Parameters:
maintenanceDocument - - a populated MaintenaceDocument instance.
Returns:
boolean - returns true unless the object is in an invalid state.

validateDocumentStructure

protected boolean validateDocumentStructure(Document document)
This method makes sure the document itself is valid, and has the necessary fields populated to be routable. This is not a business rules test, rather its a structure test to make sure that the document will not cause exceptions before routing.

Parameters:
document - - document to be tested
Returns:
false if the document is missing key values, true otherwise

validateMaintenanceDocument

protected boolean validateMaintenanceDocument(MaintenanceDocument maintenanceDocument)
This method checks to make sure the document is a valid maintenanceDocument, and has the necessary values populated such that it will not cause exceptions in later routing or business rules testing. This is not a business rules test.

Parameters:
maintenanceDocument - - document to be tested
Returns:
whether maintenance doc passes
Throws:
ValidationException

validateGlobalBusinessObjectPersistable

protected boolean validateGlobalBusinessObjectPersistable(MaintenanceDocument document)
This method checks whether this maint doc contains Global Business Objects, and if so, whether the GBOs are in a persistable state. This will return false if this method determines that the GBO will cause a SQL Exception when the document is persisted.

Parameters:
document -
Returns:
False when the method determines that the contained Global Business Object will cause a SQL Exception, and the document should not be saved. It will return True otherwise.

isCorrectMaintenanceClass

protected boolean isCorrectMaintenanceClass(MaintenanceDocument document,
                                            Class clazz)
This method tests to make sure the MaintenanceDocument passed in is based on the class you are expecting. It does this based on the NewMaintainableObject of the MaintenanceDocument.

Parameters:
document - - MaintenanceDocument instance you want to test
clazz - - class you are expecting the MaintenanceDocument to be based on
Returns:
true if they match, false if not

checkEmptyBOField

protected boolean checkEmptyBOField(String propertyName,
                                    Object valueToTest,
                                    String parameter)
This method accepts an object, and attempts to determine whether it is empty by this method's definition. OBJECT RESULT null false empty-string false whitespace false otherwise true If the result is false, it will add an object field error to the Global Errors.

Parameters:
valueToTest - - any object to test, usually a String
propertyName - - the name of the property being tested
Returns:
true or false, by the description above

checkEmptyDocumentField

protected boolean checkEmptyDocumentField(String propertyName,
                                          Object valueToTest,
                                          String parameter)
This method accepts document field (such as , and attempts to determine whether it is empty by this method's definition. OBJECT RESULT null false empty-string false whitespace false otherwise true If the result is false, it will add document field error to the Global Errors.

Parameters:
valueToTest - - any object to test, usually a String
propertyName - - the name of the property being tested
Returns:
true or false, by the description above

checkEmptyValue

protected boolean checkEmptyValue(Object valueToTest)
This method accepts document field (such as , and attempts to determine whether it is empty by this method's definition. OBJECT RESULT null false empty-string false whitespace false otherwise true It will the result as a boolean

Parameters:
valueToTest - - any object to test, usually a String

showErrorMap

protected void showErrorMap()
This method is used during debugging to dump the contents of the error map, including the key names. It is not used by the application in normal circumstances at all.


setupBaseConvenienceObjects

public void setupBaseConvenienceObjects(MaintenanceDocument document)
Description copied from interface: MaintenanceDocumentRule
Sets the convenience objects like newAccount and oldAccount, so you have short and easy handles to the new and old objects contained in the maintenance document. It also calls the BusinessObjectBase.refresh(), which will attempt to load all sub-objects from the DB by their primary keys, if available.

Specified by:
setupBaseConvenienceObjects in interface MaintenanceDocumentRule
Parameters:
document - - the maintenanceDocument being evaluated
See Also:
org.kuali.rice.krad.maintenance.rules.MaintenanceDocumentRule#setupBaseConvenienceObjects(org.kuali.rice.krad.maintenance.MaintenanceDocument)

setupConvenienceObjects

public void setupConvenienceObjects()
Description copied from interface: MaintenanceDocumentRule
Should always be overriden if a subclass is created. The goal for this is to cast the oldBo and newBo into the correct types of the subclass.

Specified by:
setupConvenienceObjects in interface MaintenanceDocumentRule

checkForPartiallyFilledOutReferenceForeignKeys

protected boolean checkForPartiallyFilledOutReferenceForeignKeys(String referenceName)
This method checks to make sure that if the foreign-key fields for the given reference attributes have any fields filled out, that all fields are filled out. If any are filled out, but all are not, it will return false and add a global error message about the problem.

Parameters:
referenceName - - The name of the reference object, whose foreign-key fields must be all-or-none filled out.
Returns:
true if this is the case, false if not

consolidateFieldNames

protected StringBuffer consolidateFieldNames(List fieldNames,
                                             String delimiter)
This method turns a list of field property names, into a delimited string of the human-readable names.

Parameters:
fieldNames - - List of fieldNames
Returns:
A filled StringBuffer ready to go in an error message

getFieldLabel

protected String getFieldLabel(String fieldName)
This method translates the passed in field name into a human-readable attribute label. It assumes the existing newBO's class as the class to examine the fieldName for.

Parameters:
fieldName - The fieldName you want a human-readable label for.
Returns:
A human-readable label, pulled from the DataDictionary.

getFieldLabel

protected String getFieldLabel(Class boClass,
                               String fieldName)
This method translates the passed in field name into a human-readable attribute label. It assumes the existing newBO's class as the class to examine the fieldName for.

Parameters:
boClass - The class to use in combination with the fieldName.
fieldName - The fieldName you want a human-readable label for.
Returns:
A human-readable label, pulled from the DataDictionary.

getBoService

protected final BusinessObjectService getBoService()
Gets the boService attribute.

Returns:
Returns the boService.

setBoService

public final void setBoService(BusinessObjectService boService)
Sets the boService attribute value.

Parameters:
boService - The boService to set.

getConfigService

protected final ConfigurationService getConfigService()
Gets the configService attribute.

Returns:
Returns the configService.

setConfigService

public final void setConfigService(ConfigurationService configService)
Sets the configService attribute value.

Parameters:
configService - The configService to set.

getDdService

protected final DataDictionaryService getDdService()
Gets the ddService attribute.

Returns:
Returns the ddService.

setDdService

public final void setDdService(DataDictionaryService ddService)
Sets the ddService attribute value.

Parameters:
ddService - The ddService to set.

getDictionaryValidationService

protected final DictionaryValidationService getDictionaryValidationService()
Gets the dictionaryValidationService attribute.

Overrides:
getDictionaryValidationService in class DocumentRuleBase
Returns:
Returns the dictionaryValidationService.

setDictionaryValidationService

public final void setDictionaryValidationService(DictionaryValidationService dictionaryValidationService)
Sets the dictionaryValidationService attribute value.

Parameters:
dictionaryValidationService - The dictionaryValidationService to set.

getMaintDocDictionaryService

protected final MaintenanceDocumentDictionaryService getMaintDocDictionaryService()
Gets the maintDocDictionaryService attribute.

Returns:
Returns the maintDocDictionaryService.

setMaintDocDictionaryService

public final void setMaintDocDictionaryService(MaintenanceDocumentDictionaryService maintDocDictionaryService)
Sets the maintDocDictionaryService attribute value.

Parameters:
maintDocDictionaryService - The maintDocDictionaryService to set.

getNewBo

protected final Object getNewBo()
Gets the newBo attribute.

Returns:
Returns the newBo.

setNewBo

protected void setNewBo(Object newBo)

getOldBo

protected final Object getOldBo()
Gets the oldBo attribute.

Returns:
Returns the oldBo.

getPersistenceStructureService

protected final PersistenceStructureService getPersistenceStructureService()
Gets the persistenceStructureService attribute.

Returns:
Returns the persistenceStructureService.

setPersistenceStructureService

public final void setPersistenceStructureService(PersistenceStructureService persistenceStructureService)
Sets the persistenceStructureService attribute value.

Parameters:
persistenceStructureService - The persistenceStructureService to set.

getWorkflowDocumentService

public WorkflowDocumentService getWorkflowDocumentService()
Gets the workflowDocumentService attribute.

Returns:
Returns the workflowDocumentService.

setWorkflowDocumentService

public void setWorkflowDocumentService(WorkflowDocumentService workflowDocumentService)
Sets the workflowDocumentService attribute value.

Parameters:
workflowDocumentService - The workflowDocumentService to set.

processAddCollectionLineBusinessRules

public boolean processAddCollectionLineBusinessRules(MaintenanceDocument document,
                                                     String collectionName,
                                                     PersistableBusinessObject bo)
Description copied from interface: AddCollectionLineRule
This method allows business rules to be called whenever a new object is added to a maintainable collection in the UI layer.

Specified by:
processAddCollectionLineBusinessRules in interface AddCollectionLineRule
Returns:

validateDuplicateIdentifierInDataDictionary

protected boolean validateDuplicateIdentifierInDataDictionary(MaintenanceDocument document,
                                                              String collectionName,
                                                              PersistableBusinessObject bo)
This method validates that there should only exist one entry in the collection whose fields match the fields specified within the duplicateIdentificationFields in the maintenance document data dictionary. If the duplicateIdentificationFields is not specified in the DD, by default it would allow the addition to happen and return true. It will return false if it fails the uniqueness validation.

Parameters:
document -
collectionName -
bo -
Returns:

processCustomAddCollectionLineBusinessRules

public boolean processCustomAddCollectionLineBusinessRules(MaintenanceDocument document,
                                                           String collectionName,
                                                           PersistableBusinessObject line)

getPersonService

public PersonService getPersonService()
Overrides:
getPersonService in class DocumentRuleBase

setPersonService

public void setPersonService(PersonService personService)

getDateTimeService

public DateTimeService getDateTimeService()

getDocumentHelperService

public DocumentHelperService getDocumentHelperService()
Returns:
the documentHelperService

setDocumentHelperService

public void setDocumentHelperService(DocumentHelperService documentHelperService)
Parameters:
documentHelperService - the documentHelperService to set

getRoleService

protected RoleService getRoleService()

getDataObjectMetaDataService

protected DataObjectMetaDataService getDataObjectMetaDataService()

setDataObjectMetaDataService

public void setDataObjectMetaDataService(DataObjectMetaDataService dataObjectMetaDataService)

setBusinessObjectAuthorizationService

public void setBusinessObjectAuthorizationService(BusinessObjectAuthorizationService businessObjectAuthorizationService)

setBusinessObjectMetaDataService

public void setBusinessObjectMetaDataService(BusinessObjectMetaDataService businessObjectMetaDataService)

setBoDictionaryService

public void setBoDictionaryService(BusinessObjectDictionaryService boDictionaryService)


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