Package org.kuali.rice.krad.rules
Class DocumentRuleBase
java.lang.Object
org.kuali.rice.krad.rules.DocumentRuleBase
- All Implemented Interfaces:
AddAdHocRoutePersonRule,AddAdHocRouteWorkgroupRule,AddCollectionLineRule,AddNoteRule,ApproveDocumentRule,BusinessRule,CompleteDocumentRule,RouteDocumentRule,SaveDocumentRule,SendAdHocRequestsRule
- Direct Known Subclasses:
MaintenanceDocumentRuleBase,TransactionalDocumentRuleBase
public abstract class DocumentRuleBase
extends Object
implements SaveDocumentRule, RouteDocumentRule, ApproveDocumentRule, AddNoteRule, AddAdHocRoutePersonRule, AddAdHocRouteWorkgroupRule, SendAdHocRequestsRule, CompleteDocumentRule, AddCollectionLineRule
Contains all of the business rules that are common to all documents.
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildDocumentTypeActionRequestPermissionDetails(org.kuali.rice.kew.api.doctype.DocumentType documentType, String actionRequestCode) buildDocumentTypePermissionDetails(org.kuali.rice.kew.api.doctype.DocumentType documentType) protected DataDictionaryServiceprotected DictionaryValidationServiceprotected static DocumentDictionaryServicestatic GroupServiceprotected ConfigurationServiceintGets the maximum number of levels the data-dictionary based validation will recurse for the documentstatic PermissionServiceprotected PersonServiceprotected booleanhasAdHocRouteCompletion(Document document, AdHocRouteRecipient adHocRouteRecipient) KULRICE-8760: check whether there is any other complete adhoc request on the given documentbooleanisAddHocRoutePersonValid(Document document, AdHocRoutePerson person) Verifies that the adHocRoutePerson's fields are valid - it does required and format checks.booleanisAddHocRouteWorkgroupValid(Document document, AdHocRouteWorkgroup workgroup) Verifies that the adHocRouteWorkgroup's fields are valid - it does required and format checks.protected booleanisAdHocRouteCompletionToInitiator(Document document, Person person, String actionRequestCode) KULRICE-7419: Adhoc route completion validation rule (should not route to initiator for completion) determine whether the document initiator is the same as the adhoc recipient for completionprotected booleanisAdHocRouteRecipientsValid(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.booleanisDocumentAttributesValid(Document document, boolean validateRequired) Validates the document attributes against the data dictionary.booleanisDocumentOverviewValid(Document document) Verifies that the document's overview fields are valid - it does required and format checks.booleanisNoteValid(Note note) Verifies that the note's fields are valid - it does required and format checks.booleanprocessAddAdHocRoutePerson(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.booleanprocessAddAdHocRouteWorkgroup(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.booleanRun the rules associated with adding an object to a collection.booleanprocessAddNote(Document document, Note note) Runs all business rules needed prior to adding a document note.booleanprocessApproveDocument(ApproveDocumentEvent approveEvent) Runs all business rules needed prior to approving.booleanprocessCompleteDocument(Document document) Business rules check will include all save action rules and any custom rules required by the document specific rule implementationprotected booleanprocessCustomAddAdHocRoutePersonBusinessRules(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 booleanprocessCustomAddAdHocRouteWorkgroupBusinessRules(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 booleanThis method should be overridden to provide custom rules for processing adding to collections.protected booleanprocessCustomAddNoteBusinessRules(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 booleanThis method should be overridden by children rule classes as a hook to implement document specific business rule checks for the "approve document" event.protected booleanHook method for deriving business rule classes to provide custom validations required during completion actionprotected booleanThis method should be overridden by children rule classes as a hook to implement document specific business rule checks for the "route document" event.protected booleanThis method should be overridden by children rule classes as a hook to implement document specific business rule checks for the "save document" event.protected booleanprocessCustomSendAdHocRequests(Document document) booleanprocessRouteDocument(Document document) Runs all business rules needed prior to routing.booleanprocessSaveDocument(Document document) Runs all business rules needed prior to saving.booleanprocessSendAdHocRequests(Document document) static voidsetDocumentDictionaryService(DocumentDictionaryService documentDictionaryService) voidsetMaxDictionaryValidationDepth(int maxDictionaryValidationDepth) Gets the maximum number of levels the data-dictionary based validation will recurse for the documentprotected booleanuseKimPermission(String namespace, String permissionTemplateName, Map<String, String> permissionDetails) protected booleanvalidateSensitiveDataValue(String fieldName, String fieldValue, String fieldLabel)
-
Constructor Details
-
DocumentRuleBase
public DocumentRuleBase()
-
-
Method Details
-
isDocumentOverviewValid
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
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
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:
processSaveDocumentin interfaceSaveDocumentRule- Parameters:
document-- Returns:
- false if the rule fails
- See Also:
-
processCustomSaveDocumentBusinessRules
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
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:
processRouteDocumentin interfaceRouteDocumentRule- Parameters:
document-- Returns:
- false if the rule fails
- See Also:
-
processCustomRouteDocumentBusinessRules
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
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:
processApproveDocumentin interfaceApproveDocumentRule- Parameters:
approveEvent- document approve event- Returns:
- false if the rule fails
- See Also:
-
processCustomApproveDocumentBusinessRules
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.
-
processAddCollectionLine
Run the rules associated with adding an object to a collection. This base implementation just runs the custom rules.- Specified by:
processAddCollectionLinein interfaceAddCollectionLineRule- Parameters:
addEvent- the event containing all of the object necessary to run the rules- Returns:
- true if validation succeeds, false otherwise
-
processCustomAddCollectionLineBusinessRules
This method should be overridden to provide custom rules for processing adding to collections.- Parameters:
addEvent- the event containing all of the object necessary to run the rules- Returns:
- true if validation succeeds, false otherwise
-
processAddNote
Runs all business rules needed prior to adding a document note. This method will return false if any business rule fails- Specified by:
processAddNotein interfaceAddNoteRule- Parameters:
document-note-- Returns:
- false if the rule fails
-
isNoteValid
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
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
Description copied from interface:AddAdHocRoutePersonRuleThis method is responsible for housing business rules that need to be checked before a document adHocRoutePerson is added to a document.- Specified by:
processAddAdHocRoutePersonin interfaceAddAdHocRoutePersonRule- Parameters:
document-adHocRoutePerson-- Returns:
- false if the rule fails
- See Also:
-
processSendAdHocRequests
- Specified by:
processSendAdHocRequestsin interfaceSendAdHocRequestsRule- See Also:
-
processCustomSendAdHocRequests
-
isAdHocRouteRecipientsValid
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:
- true if all adhoc route recipients are valid
-
isAddHocRoutePersonValid
Verifies that the adHocRoutePerson's fields are valid - it does required and format checks.- Parameters:
person-- Returns:
- boolean True if valid, false otherwise.
-
isAdHocRouteCompletionToInitiator
protected boolean isAdHocRouteCompletionToInitiator(Document document, Person person, String actionRequestCode) KULRICE-7419: Adhoc route completion validation rule (should not route to initiator for completion) determine whether the document initiator is the same as the adhoc recipient for completion -
hasAdHocRouteCompletion
protected boolean hasAdHocRouteCompletion(Document document, AdHocRouteRecipient adHocRouteRecipient) KULRICE-8760: check whether there is any other complete adhoc request on the given document -
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:AddAdHocRouteWorkgroupRuleThis method is responsible for housing business rules that need to be checked before a document adHocRouteWorkgroup is added to a document.- Specified by:
processAddAdHocRouteWorkgroupin interfaceAddAdHocRouteWorkgroupRule- Parameters:
document-adHocRouteWorkgroup-- Returns:
- false if the rule fails
- See Also:
-
isAddHocRouteWorkgroupValid
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
-
processCompleteDocument
Business rules check will include all save action rules and any custom rules required by the document specific rule implementation- Specified by:
processCompleteDocumentin interfaceCompleteDocumentRule- Parameters:
document- Document- Returns:
- true if all validations are passed
-
processCustomCompleteDocumentBusinessRules
Hook method for deriving business rule classes to provide custom validations required during completion action- Parameters:
document-- Returns:
- default is true
-
useKimPermission
-
buildDocumentTypeActionRequestPermissionDetails
-
buildDocumentTypePermissionDetails
-
getDataDictionaryService
-
getPersonService
-
getGroupService
-
getPermissionService
-
getDictionaryValidationService
-
getKualiConfigurationService
-
getDocumentDictionaryService
-
setDocumentDictionaryService
public static void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService)
-