org.kuali.kfs.module.ar.document.validation.impl
Class CustomerRule

java.lang.Object
  extended by org.kuali.rice.kns.rules.DocumentRuleBase
      extended by org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase
          extended by org.kuali.kfs.module.ar.document.validation.impl.CustomerRule
All Implemented Interfaces:
org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRule, org.kuali.rice.kns.rule.AddAdHocRoutePersonRule, org.kuali.rice.kns.rule.AddAdHocRouteWorkgroupRule, org.kuali.rice.kns.rule.AddCollectionLineRule, org.kuali.rice.kns.rule.AddNoteRule, org.kuali.rice.kns.rule.ApproveDocumentRule, org.kuali.rice.kns.rule.BusinessRule, org.kuali.rice.kns.rule.RouteDocumentRule, org.kuali.rice.kns.rule.SaveDocumentRule, org.kuali.rice.kns.rule.SendAdHocRequestsRule

public class CustomerRule
extends org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase


Field Summary
protected  org.kuali.rice.kns.service.DateTimeService dateTimeService
           
protected static org.apache.log4j.Logger LOG
           
protected  Customer newCustomer
           
protected  Customer oldCustomer
           
 
Fields inherited from class org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase
boDictionaryService, boService, businessObjectAuthorizationService, configService, ddService, dictionaryValidationService, DOCUMENT_ERROR_PREFIX, documentHelperService, MAINTAINABLE_ERROR_PATH, MAINTAINABLE_ERROR_PREFIX, maintDocDictionaryService, persistenceService, persistenceStructureService, personService, priorErrorPath, roleService, workflowDocumentService
 
Constructor Summary
CustomerRule()
           
 
Method Summary
 boolean checkAddresses(Customer customer)
          This method checks if the customer addresses are valid: has one and only one primary address
 boolean checkAddressIsValid(CustomerAddress customerAddress)
           
 boolean checkAddressIsValid(CustomerAddress customerAddress, int ind)
          This method checks if the address is valid
 boolean checkCustomerHasAddress(Customer newCustomer)
          This method checks if the new customer has at least one address
 boolean checkEndDateIsValid(Date endDate, boolean canBeTodaysDateFlag)
          This method checks if customer end date is valid: 1.
 boolean checkIfPrimaryAddressActive(Date newEndDate, int ind)
           
 boolean checkNameIsValidLength(String customerName)
          This method checks if the customer name entered is greater than or equal to three (3) characters long.
 boolean checkTaxNumber(Customer customer)
          This method checks if tax number is entered when tax number is required
protected  void initializeAttributes(org.kuali.rice.kns.document.MaintenanceDocument document)
          This method initializes the old and new customer
 boolean isTaxNumberRequired()
          This method checks if tax number is required
 boolean processCustomAddCollectionLineBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document, String collectionName, org.kuali.rice.kns.bo.PersistableBusinessObject line)
           
protected  boolean processCustomRouteDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
           
protected  boolean setCustomerNumber()
          This method sets the new customer number
 boolean validateAddresses(Customer customer)
           
 boolean validateEndDateForExistingCustomerAddress(Date newEndDate, int ind)
           
 boolean validateEndDateForNewAddressLine(Date endDate)
           
 
Methods inherited from class org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase
apcRuleFails, applyApcRule, checkEmptyBOField, checkEmptyDocumentField, checkEmptyValue, checkForPartiallyFilledOutReferenceForeignKeys, clearErrorPath, consolidateFieldNames, dataDictionaryValidate, errorAlreadyExists, getBoDictionaryService, getBoService, getBusinessObjectAuthorizationService, getConfigService, getDateTimeService, getDdService, getDictionaryValidationService, getDocumentHelperService, getFieldLabel, getFieldLabel, getHumanReadablePrimaryKeyFieldNames, getMaintDocDictionaryService, getNewBo, getOldBo, getPersistenceService, getPersistenceStructureService, getPersonService, getRoleService, getWorkflowDocumentService, isCorrectMaintenanceClass, isDocumentInactivatingBusinessObject, isDocumentValidForSave, primaryKeyCheck, processAddCollectionLineBusinessRules, processApproveDocument, processCustomApproveDocumentBusinessRules, processCustomSaveDocumentBusinessRules, processGlobalApproveDocumentBusinessRules, processGlobalRouteDocumentBusinessRules, processGlobalSaveDocumentBusinessRules, processInactivationBlockChecking, processInactivationBlockChecking, processRouteDocument, processSaveDocument, putDocumentError, putDocumentError, putFieldError, putFieldError, putFieldError, putFieldErrorWithShortLabel, putGlobalError, putGlobalError, putGlobalError, putGlobalsError, putGlobalsError, putInactivationBlockingErrorOnPage, resumeErrorPath, setBoDictionaryService, setBoService, setBusinessObjectAuthorizationService, setConfigService, setDdService, setDictionaryValidationService, setDocumentHelperService, setMaintDocDictionaryService, setNewBo, setPersistenceService, setPersistenceStructureService, setPersonService, setupBaseConvenienceObjects, setupConvenienceObjects, setWorkflowDocumentService, showErrorMap, validateDocumentStructure, validateDuplicateIdentifierInDataDictionary, validateGlobalBusinessObjectPersistable, validateMaintenanceDocument
 
Methods inherited from class org.kuali.rice.kns.rules.DocumentRuleBase
getDataDictionaryService, getIdentityManagementService, getKualiConfigurationService, getMaxDictionaryValidationDepth, getWorkflowInfoService, isAddHocRoutePersonValid, isAddHocRouteWorkgroupValid, isAdHocRouteRecipientsValid, isDocumentAttributesValid, isDocumentOverviewValid, isNoteValid, processAddAdHocRoutePerson, processAddAdHocRouteWorkgroup, processAddNote, processCustomAddAdHocRoutePersonBusinessRules, processCustomAddAdHocRouteWorkgroupBusinessRules, processCustomAddNoteBusinessRules, processCustomApproveDocumentBusinessRules, processCustomRouteDocumentBusinessRules, processCustomSaveDocumentBusinessRules, processCustomSendAdHocRequests, processSendAdHocRequests, 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

oldCustomer

protected Customer oldCustomer

newCustomer

protected Customer newCustomer

dateTimeService

protected org.kuali.rice.kns.service.DateTimeService dateTimeService
Constructor Detail

CustomerRule

public CustomerRule()
Method Detail

initializeAttributes

protected void initializeAttributes(org.kuali.rice.kns.document.MaintenanceDocument document)
This method initializes the old and new customer

Parameters:
document -

processCustomRouteDocumentBusinessRules

protected boolean processCustomRouteDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document)
Overrides:
processCustomRouteDocumentBusinessRules in class org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase
See Also:
MaintenanceDocumentRuleBase.processCustomRouteDocumentBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument)

setCustomerNumber

protected boolean setCustomerNumber()
This method sets the new customer number

Returns:
Returns true if the customer number is set successfully, false otherwise.

checkCustomerHasAddress

public boolean checkCustomerHasAddress(Customer newCustomer)
This method checks if the new customer has at least one address

Parameters:
newCustomer - the new customer
Returns:
true is the new customer has at least one address, false otherwise

processCustomAddCollectionLineBusinessRules

public boolean processCustomAddCollectionLineBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument document,
                                                           String collectionName,
                                                           org.kuali.rice.kns.bo.PersistableBusinessObject line)
Overrides:
processCustomAddCollectionLineBusinessRules in class org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase
See Also:
MaintenanceDocumentRuleBase.processCustomAddCollectionLineBusinessRules(org.kuali.rice.kns.document.MaintenanceDocument, java.lang.String, org.kuali.rice.kns.bo.PersistableBusinessObject)

checkEndDateIsValid

public boolean checkEndDateIsValid(Date endDate,
                                   boolean canBeTodaysDateFlag)
This method checks if customer end date is valid: 1. if a new address is being added, customer end date must be a future date 2. if inactivating an address, customer end date must be current or future date

Parameters:
endDate -
canBeTodaysDateFlag -
Returns:
True if endDate is valid.

validateEndDateForNewAddressLine

public boolean validateEndDateForNewAddressLine(Date endDate)

validateEndDateForExistingCustomerAddress

public boolean validateEndDateForExistingCustomerAddress(Date newEndDate,
                                                         int ind)

checkNameIsValidLength

public boolean checkNameIsValidLength(String customerName)
This method checks if the customer name entered is greater than or equal to three (3) characters long. This rule was implemented to ensure that there are three characters available from the name to be used as a the customer code.

Parameters:
customerName - The name of the customer.
Returns:
True if the name is greater than or equal to 3 characters long.

checkAddressIsValid

public boolean checkAddressIsValid(CustomerAddress customerAddress,
                                   int ind)
This method checks if the address is valid

Parameters:
customerAddress -
Returns:
true if valid, false otherwise

checkAddressIsValid

public boolean checkAddressIsValid(CustomerAddress customerAddress)

checkAddresses

public boolean checkAddresses(Customer customer)
This method checks if the customer addresses are valid: has one and only one primary address

Parameters:
customer -
Returns:
true if valid, false otherwise

validateAddresses

public boolean validateAddresses(Customer customer)

checkIfPrimaryAddressActive

public boolean checkIfPrimaryAddressActive(Date newEndDate,
                                           int ind)

checkTaxNumber

public boolean checkTaxNumber(Customer customer)
This method checks if tax number is entered when tax number is required

Parameters:
customer -
Returns:
true if tax number is required and tax number is entered or if tax number is not required, false if tax number required and tax number not entered

isTaxNumberRequired

public boolean isTaxNumberRequired()
This method checks if tax number is required

Returns:
true if tax number is required, false otherwise


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