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

Contains all of the business rules that are common to all documents.
Author:
Kuali Rice Team (rice.collab@kuali.org)
  • Constructor Details

    • DocumentRuleBase

      public DocumentRuleBase()
  • Method Details

    • 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
      Parameters:
      document -
      Returns:
      false if the rule fails
      See Also:
    • 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
      Parameters:
      document -
      Returns:
      false if the rule fails
      See Also:
    • 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
      Parameters:
      approveEvent - document approve event
      Returns:
      false if the rule fails
      See Also:
    • 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.
    • 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.
      Specified by:
      processAddCollectionLine in interface AddCollectionLineRule
      Parameters:
      addEvent - the event containing all of the object necessary to run the rules
      Returns:
      true if validation succeeds, false otherwise
    • processCustomAddCollectionLineBusinessRules

      protected boolean processCustomAddCollectionLineBusinessRules(AddCollectionLineEvent addEvent)
      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

      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
      Parameters:
      document -
      note -
      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
      Parameters:
      document -
      adHocRoutePerson -
      Returns:
      false if the rule fails
      See Also:
    • processSendAdHocRequests

      public boolean processSendAdHocRequests(Document document)
      Specified by:
      processSendAdHocRequests in interface SendAdHocRequestsRule
      See Also:
    • 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:
      true if all adhoc route recipients are valid
    • 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.
    • 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: 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
      Parameters:
      document -
      adHocRouteWorkgroup -
      Returns:
      false if the rule fails
      See Also:
    • isAddHocRouteWorkgroupValid

      public boolean isAddHocRouteWorkgroupValid(Document document, 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
      Specified by:
      processCompleteDocument in interface CompleteDocumentRule
      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
    • useKimPermission

      protected boolean useKimPermission(String namespace, String permissionTemplateName, Map<String,String> permissionDetails)
    • buildDocumentTypeActionRequestPermissionDetails

      protected Map<String,String> buildDocumentTypeActionRequestPermissionDetails(org.kuali.rice.kew.api.doctype.DocumentType documentType, String actionRequestCode)
    • buildDocumentTypePermissionDetails

      protected Map<String,String> buildDocumentTypePermissionDetails(org.kuali.rice.kew.api.doctype.DocumentType documentType)
    • 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)