org.kuali.rice.krad.rules
Class MaintenanceDocumentRuleBase

java.lang.Object
  extended by org.kuali.rice.krad.rules.DocumentRuleBase
      extended by org.kuali.rice.krad.rules.MaintenanceDocumentRuleBase
All Implemented Interfaces:
MaintenanceDocumentRule, AddAdHocRoutePersonRule, AddAdHocRouteWorkgroupRule, AddCollectionLineRule, AddNoteRule, ApproveDocumentRule, BusinessRule, CompleteDocumentRule, RouteDocumentRule, SaveDocumentRule, SendAdHocRequestsRule
Direct Known Subclasses:
AgendaEditorBusRule, AuthorMaintenanceDocumentRule, ContextBusRule, PeopleFlowBusRule, ReviewResponsibilityMaintenanceDocumentRule, TermBusRule, TermSpecBusRule

public class MaintenanceDocumentRuleBase
extends DocumentRuleBase
implements MaintenanceDocumentRule

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

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

Field Summary
static String DOCUMENT_ERROR_PREFIX
           
protected static org.apache.log4j.Logger LOG
           
static String MAINTAINABLE_ERROR_PATH
           
static String MAINTAINABLE_ERROR_PREFIX
           
protected  List<String> priorErrorPath
           
 
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  StringBuilder consolidateFieldNames(List<String> 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)
          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  ConfigurationService getConfigService()
           
 DataObjectAuthorizationService getDataObjectAuthorizationService()
           
 DataObjectService getDataObjectService()
           
 DateTimeService getDateTimeService()
           
protected  DataDictionaryService getDdService()
           
protected  DictionaryValidationService getDictionaryValidationService()
           
protected  String getFieldLabel(Class<?> dataObjectClass, 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<?> dataObjectClass)
          This method creates a human-readable string of the class' primary key field names, as designated by the DataDictionary.
protected  Object getNewDataObject()
          Gets the newDataObject attribute.
protected  Object getOldDataObject()
          Gets the oldDataObject attribute.
 PersonService getPersonService()
           
protected  RoleService getRoleService()
           
 WorkflowDocumentService getWorkflowDocumentService()
           
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 processAddCollectionLine(AddCollectionLineEvent addEvent)
          Run the rules associated with adding an object to a collection.
 boolean processApproveDocument(ApproveDocumentEvent approveEvent)
          Runs all business rules needed prior to approving.
protected  boolean processCustomAddCollectionLineBusinessRules(MaintenanceDocument document, String collectionName, Object line)
          This method should be overridden to provide custom rules for processing adding collection lines.
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 setConfigService(ConfigurationService configService)
           
 void setDataObjectAuthorizationService(DataObjectAuthorizationService dataObjectAuthorizationService)
           
 void setDdService(DataDictionaryService ddService)
           
 void setDictionaryValidationService(DictionaryValidationService dictionaryValidationService)
           
protected  void setNewDataObject(Object newDataObject)
           
 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)
           
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 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
buildDocumentTypeActionRequestPermissionDetails, buildDocumentTypePermissionDetails, getDataDictionaryService, getDocumentDictionaryService, getGroupService, getKualiConfigurationService, getMaxDictionaryValidationDepth, getPermissionService, hasAdHocRouteCompletion, isAddHocRoutePersonValid, isAddHocRouteWorkgroupValid, isAdHocRouteCompletionToInitiator, isAdHocRouteRecipientsValid, isDocumentAttributesValid, isDocumentOverviewValid, isNoteValid, processAddAdHocRoutePerson, processAddAdHocRouteWorkgroup, processAddNote, processCompleteDocument, processCustomAddAdHocRoutePersonBusinessRules, processCustomAddAdHocRouteWorkgroupBusinessRules, processCustomAddCollectionLineBusinessRules, processCustomAddNoteBusinessRules, processCustomApproveDocumentBusinessRules, processCustomCompleteDocumentBusinessRules, processCustomRouteDocumentBusinessRules, processCustomSaveDocumentBusinessRules, processCustomSendAdHocRequests, processSendAdHocRequests, setDocumentDictionaryService, setMaxDictionaryValidationDepth, useKimPermission, 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

priorErrorPath

protected List<String> 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:
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:
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
Parameters:
approveEvent - document approve event
Returns:
false if the rule fails
See Also:
MaintenanceDocumentRule.processApproveDocument(org.kuali.rice.krad.rules.rule.event.ApproveDocumentEvent)

processAddCollectionLine

public boolean processAddCollectionLine(AddCollectionLineEvent addEvent)
Run the rules associated with adding an object to a collection. This base implementation just runs the custom rules. This implementation additionally performs existence and duplicate checks.

Specified by:
processAddCollectionLine in interface MaintenanceDocumentRule
Specified by:
processAddCollectionLine in interface AddCollectionLineRule
Overrides:
processAddCollectionLine in class DocumentRuleBase
Parameters:
addEvent - the event containing all of the object necessary to run the rules
Returns:
true if validation succeeds, false otherwise
See Also:
AddCollectionLineRule.processAddCollectionLine(org.kuali.rice.krad.rules.rule.event.AddCollectionLineEvent)

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)
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<?> dataObjectClass)
This method creates a human-readable string of the class' primary key field names, as designated by the DataDictionary.

Parameters:
dataObjectClass -
Returns:
human-readable string representation of the primary key field names

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:
boolean

processCustomAddCollectionLineBusinessRules

protected boolean processCustomAddCollectionLineBusinessRules(MaintenanceDocument document,
                                                              String collectionName,
                                                              Object line)
This method should be overridden to provide custom rules for processing adding collection lines.

Parameters:
document -
Returns:
boolean

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:
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 StringBuilder consolidateFieldNames(List<String> 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 newDataObject'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<?> dataObjectClass,
                               String fieldName)
This method translates the passed in field name into a human-readable attribute label. It assumes the existing newDataObject's class as the class to examine the fieldName for.

Parameters:
dataObjectClass - 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.

getNewDataObject

protected final Object getNewDataObject()
Gets the newDataObject attribute.

Returns:
Returns the newDataObject.

setNewDataObject

protected void setNewDataObject(Object newDataObject)

getOldDataObject

protected final Object getOldDataObject()
Gets the oldDataObject attribute.

Returns:
Returns the oldDataObject.

getConfigService

protected final ConfigurationService getConfigService()

setConfigService

public final void setConfigService(ConfigurationService configService)

getDdService

protected final DataDictionaryService getDdService()

setDdService

public final void setDdService(DataDictionaryService ddService)

getDictionaryValidationService

protected final DictionaryValidationService getDictionaryValidationService()
Overrides:
getDictionaryValidationService in class DocumentRuleBase

setDictionaryValidationService

public final void setDictionaryValidationService(DictionaryValidationService dictionaryValidationService)

getPersonService

public PersonService getPersonService()
Overrides:
getPersonService in class DocumentRuleBase

setPersonService

public void setPersonService(PersonService personService)

getDateTimeService

public DateTimeService getDateTimeService()

getRoleService

protected RoleService getRoleService()

getWorkflowDocumentService

public WorkflowDocumentService getWorkflowDocumentService()

setWorkflowDocumentService

public void setWorkflowDocumentService(WorkflowDocumentService workflowDocumentService)

getDataObjectAuthorizationService

public DataObjectAuthorizationService getDataObjectAuthorizationService()

setDataObjectAuthorizationService

public void setDataObjectAuthorizationService(DataObjectAuthorizationService dataObjectAuthorizationService)

getDataObjectService

public DataObjectService getDataObjectService()


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.