org.kuali.rice.krad.rules
Class DocumentRuleBase

java.lang.Object
  extended by org.kuali.rice.krad.rules.DocumentRuleBase
All Implemented Interfaces:
AddAdHocRoutePersonRule, AddAdHocRouteWorkgroupRule, AddNoteRule, ApproveDocumentRule, BusinessRule, RouteDocumentRule, SaveDocumentRule, SendAdHocRequestsRule
Direct Known Subclasses:
GroupDocumentMemberRule, KimDocumentMemberRule, KimDocumentPermissionRule, KimDocumentResponsibilityRule, MaintenanceDocumentRuleBase, MaintenanceDocumentRuleBase, PersonDocumentDelegationMemberRule, PersonDocumentGroupRule, PersonDocumentRoleRule, RoleDocumentDelegationMemberRule, RoleDocumentDelegationRule, TransactionalDocumentRuleBase

public abstract class DocumentRuleBase
extends Object
implements SaveDocumentRule, RouteDocumentRule, ApproveDocumentRule, AddNoteRule, AddAdHocRoutePersonRule, AddAdHocRouteWorkgroupRule, SendAdHocRequestsRule

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

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

Constructor Summary
DocumentRuleBase()
           
 
Method Summary
protected  DataDictionaryService getDataDictionaryService()
           
protected  DictionaryValidationService getDictionaryValidationService()
           
protected static DocumentDictionaryService getDocumentDictionaryService()
           
static GroupService getGroupService()
           
protected  ConfigurationService getKualiConfigurationService()
           
 int getMaxDictionaryValidationDepth()
          Gets the maximum number of levels the data-dictionary based validation will recurse for the document
static PermissionService getPermissionService()
           
protected  PersonService getPersonService()
           
 boolean isAddHocRoutePersonValid(Document document, AdHocRoutePerson person)
          Verifies that the adHocRoutePerson's fields are valid - it does required and format checks.
 boolean isAddHocRouteWorkgroupValid(AdHocRouteWorkgroup workgroup)
          Verifies that the adHocRouteWorkgroup's fields are valid - it does required and format checks.
protected  boolean isAdHocRouteRecipientsValid(Document document)
          Checks the adhoc route recipient list to ensure there are recipients or else throws an error that at least one recipient is required.
 boolean isDocumentAttributesValid(Document document, boolean validateRequired)
          Validates the document attributes against the data dictionary.
 boolean isDocumentOverviewValid(Document document)
          Verifies that the document's overview fields are valid - it does required and format checks.
 boolean isNoteValid(Note note)
          Verifies that the note's fields are valid - it does required and format checks.
 boolean processAddAdHocRoutePerson(Document document, AdHocRoutePerson adHocRoutePerson)
          This method is responsible for housing business rules that need to be checked before a document adHocRoutePerson is added to a document.
 boolean processAddAdHocRouteWorkgroup(Document document, AdHocRouteWorkgroup adHocRouteWorkgroup)
          This method is responsible for housing business rules that need to be checked before a document adHocRouteWorkgroup is added to a document.
 boolean processAddNote(Document document, Note note)
          Runs all business rules needed prior to adding a document note.
 boolean processApproveDocument(ApproveDocumentEvent approveEvent)
          Runs all business rules needed prior to approving.
 boolean processCompleteDocument(Document document)
          Business rules check will include all save action rules and any custom rules required by the document specific rule implementation
protected  boolean processCustomAddAdHocRoutePersonBusinessRules(Document document, AdHocRoutePerson person)
          This method should be overridden by children rule classes as a hook to implement document specific business rule checks for the "add ad hoc route person" event.
protected  boolean processCustomAddAdHocRouteWorkgroupBusinessRules(Document document, AdHocRouteWorkgroup workgroup)
          This method should be overridden by children rule classes as a hook to implement document specific business rule checks for the "add ad hoc route workgroup" event.
protected  boolean processCustomAddNoteBusinessRules(Document document, Note note)
          This method should be overridden by children rule classes as a hook to implement document specific business rule checks for the "add document note" event.
protected  boolean processCustomApproveDocumentBusinessRules(ApproveDocumentEvent approveEvent)
          This method should be overridden by children rule classes as a hook to implement document specific business rule checks for the "approve document" event.
protected  boolean processCustomCompleteDocumentBusinessRules(Document document)
          Hook method for deriving business rule classes to provide custom validations required during completion action
protected  boolean processCustomRouteDocumentBusinessRules(Document document)
          This method should be overridden by children rule classes as a hook to implement document specific business rule checks for the "route document" event.
protected  boolean processCustomSaveDocumentBusinessRules(Document document)
          This method should be overridden by children rule classes as a hook to implement document specific business rule checks for the "save document" event.
protected  boolean processCustomSendAdHocRequests(Document document)
           
 boolean processRouteDocument(Document document)
          Runs all business rules needed prior to routing.
 boolean processSaveDocument(Document document)
          Runs all business rules needed prior to saving.
 boolean processSendAdHocRequests(Document document)
           
static void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService)
           
 void setMaxDictionaryValidationDepth(int maxDictionaryValidationDepth)
          Gets the maximum number of levels the data-dictionary based validation will recurse for the document
protected  boolean validateSensitiveDataValue(String fieldName, String fieldValue, String fieldLabel)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentRuleBase

public DocumentRuleBase()
Method Detail

isDocumentOverviewValid

public boolean isDocumentOverviewValid(Document document)
Verifies that the document's overview fields are valid - it does required and format checks.

Parameters:
document -
Returns:
boolean True if the document description is valid, false otherwise.

isDocumentAttributesValid

public boolean isDocumentAttributesValid(Document document,
                                         boolean validateRequired)
Validates the document attributes against the data dictionary.

Parameters:
document -
validateRequired - if true, then an error will be retruned if a DD required field is empty. if false, no required checking is done
Returns:
True if the document attributes are valid, false otherwise.

processSaveDocument

public boolean processSaveDocument(Document document)
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 SaveDocumentRule
Returns:
false if the rule fails
See Also:
SaveDocumentRule.processSaveDocument(org.kuali.rice.krad.document.Document)

processCustomSaveDocumentBusinessRules

protected boolean processCustomSaveDocumentBusinessRules(Document document)
This method should be overridden by children rule classes as a hook to implement document specific business rule checks for the "save document" event.

Parameters:
document -
Returns:
boolean True if the rules checks passed, false otherwise.

processRouteDocument

public boolean processRouteDocument(Document document)
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 RouteDocumentRule
Returns:
false if the rule fails
See Also:
RouteDocumentRule.processRouteDocument(org.kuali.rice.krad.document.Document)

processCustomRouteDocumentBusinessRules

protected boolean processCustomRouteDocumentBusinessRules(Document document)
This method should be overridden by children rule classes as a hook to implement document specific business rule checks for the "route document" event.

Parameters:
document -
Returns:
boolean True if the rules checks passed, false otherwise.

processApproveDocument

public boolean processApproveDocument(ApproveDocumentEvent approveEvent)
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 ApproveDocumentRule
Returns:
false if the rule fails
See Also:
ApproveDocumentRule.processApproveDocument(org.kuali.rice.krad.rules.rule.event.ApproveDocumentEvent)

processCustomApproveDocumentBusinessRules

protected boolean processCustomApproveDocumentBusinessRules(ApproveDocumentEvent approveEvent)
This method should be overridden by children rule classes as a hook to implement document specific business rule checks for the "approve document" event.

Parameters:
approveEvent -
Returns:
boolean True if the rules checks passed, false otherwise.

processAddNote

public boolean processAddNote(Document document,
                              Note note)
Runs all business rules needed prior to adding a document note. This method will return false if any business rule fails

Specified by:
processAddNote in interface AddNoteRule
Returns:
false if the rule fails

isNoteValid

public boolean isNoteValid(Note note)
Verifies that the note's fields are valid - it does required and format checks.

Parameters:
note -
Returns:
boolean True if the document description is valid, false otherwise.

processCustomAddNoteBusinessRules

protected boolean processCustomAddNoteBusinessRules(Document document,
                                                    Note note)
This method should be overridden by children rule classes as a hook to implement document specific business rule checks for the "add document note" event.

Parameters:
document -
note -
Returns:
boolean True if the rules checks passed, false otherwise.

processAddAdHocRoutePerson

public boolean processAddAdHocRoutePerson(Document document,
                                          AdHocRoutePerson adHocRoutePerson)
Description copied from interface: AddAdHocRoutePersonRule
This method is responsible for housing business rules that need to be checked before a document adHocRoutePerson is added to a document.

Specified by:
processAddAdHocRoutePerson in interface AddAdHocRoutePersonRule
Returns:
false if the rule fails
See Also:
AddAdHocRoutePersonRule.processAddAdHocRoutePerson(org.kuali.rice.krad.document.Document, org.kuali.rice.krad.bo.AdHocRoutePerson)

processSendAdHocRequests

public boolean processSendAdHocRequests(Document document)
Specified by:
processSendAdHocRequests in interface SendAdHocRequestsRule
See Also:
SendAdHocRequestsRule.processSendAdHocRequests(org.kuali.rice.krad.document.Document)

processCustomSendAdHocRequests

protected boolean processCustomSendAdHocRequests(Document document)

isAdHocRouteRecipientsValid

protected boolean isAdHocRouteRecipientsValid(Document document)
Checks the adhoc route recipient list to ensure there are recipients or else throws an error that at least one recipient is required.

Parameters:
document -
Returns:

isAddHocRoutePersonValid

public boolean isAddHocRoutePersonValid(Document document,
                                        AdHocRoutePerson person)
Verifies that the adHocRoutePerson's fields are valid - it does required and format checks.

Parameters:
person -
Returns:
boolean True if valid, false otherwise.

processCustomAddAdHocRoutePersonBusinessRules

protected boolean processCustomAddAdHocRoutePersonBusinessRules(Document document,
                                                                AdHocRoutePerson person)
This method should be overridden by children rule classes as a hook to implement document specific business rule checks for the "add ad hoc route person" event.

Parameters:
document -
person -
Returns:
boolean True if the rules checks passed, false otherwise.

processAddAdHocRouteWorkgroup

public boolean processAddAdHocRouteWorkgroup(Document document,
                                             AdHocRouteWorkgroup adHocRouteWorkgroup)
Description copied from interface: AddAdHocRouteWorkgroupRule
This method is responsible for housing business rules that need to be checked before a document adHocRouteWorkgroup is added to a document.

Specified by:
processAddAdHocRouteWorkgroup in interface AddAdHocRouteWorkgroupRule
Returns:
false if the rule fails
See Also:
AddAdHocRouteWorkgroupRule.processAddAdHocRouteWorkgroup(org.kuali.rice.krad.document.Document, org.kuali.rice.krad.bo.AdHocRouteWorkgroup)

isAddHocRouteWorkgroupValid

public boolean isAddHocRouteWorkgroupValid(AdHocRouteWorkgroup workgroup)
Verifies that the adHocRouteWorkgroup's fields are valid - it does required and format checks.

Parameters:
workgroup -
Returns:
boolean True if valid, false otherwise.

processCustomAddAdHocRouteWorkgroupBusinessRules

protected boolean processCustomAddAdHocRouteWorkgroupBusinessRules(Document document,
                                                                   AdHocRouteWorkgroup workgroup)
This method should be overridden by children rule classes as a hook to implement document specific business rule checks for the "add ad hoc route workgroup" event.

Parameters:
document -
workgroup -
Returns:
boolean True if the rules checks passed, false otherwise.

getMaxDictionaryValidationDepth

public int getMaxDictionaryValidationDepth()
Gets the maximum number of levels the data-dictionary based validation will recurse for the document


setMaxDictionaryValidationDepth

public void setMaxDictionaryValidationDepth(int maxDictionaryValidationDepth)
Gets the maximum number of levels the data-dictionary based validation will recurse for the document


validateSensitiveDataValue

protected boolean validateSensitiveDataValue(String fieldName,
                                             String fieldValue,
                                             String fieldLabel)

processCompleteDocument

public boolean processCompleteDocument(Document document)
Business rules check will include all save action rules and any custom rules required by the document specific rule implementation

Parameters:
document - Document
Returns:
true if all validations are passed

processCustomCompleteDocumentBusinessRules

protected boolean processCustomCompleteDocumentBusinessRules(Document document)
Hook method for deriving business rule classes to provide custom validations required during completion action

Parameters:
document -
Returns:
default is true

getDataDictionaryService

protected DataDictionaryService getDataDictionaryService()

getPersonService

protected PersonService getPersonService()

getGroupService

public static GroupService getGroupService()

getPermissionService

public static PermissionService getPermissionService()

getDictionaryValidationService

protected DictionaryValidationService getDictionaryValidationService()

getKualiConfigurationService

protected ConfigurationService getKualiConfigurationService()

getDocumentDictionaryService

protected static DocumentDictionaryService getDocumentDictionaryService()

setDocumentDictionaryService

public static void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService)


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