org.kuali.kfs.vnd.document.validation.impl
Class VendorPreRules

java.lang.Object
  extended by org.kuali.rice.kns.rules.PromptBeforeValidationBase
      extended by org.kuali.kfs.coa.document.validation.impl.MaintenancePreRulesBase
          extended by org.kuali.kfs.vnd.document.validation.impl.VendorPreRules
All Implemented Interfaces:
org.kuali.rice.kns.rule.PromptBeforeValidation

public class VendorPreRules
extends MaintenancePreRulesBase

Business Prerules applicable to VendorDetail documents. These PreRules checks for the VendorDetail that needs to occur while still in the Struts processing. This includes setting the vendorName field using the values from vendorLastName and vendorFirstName, and could be used for many other purposes.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.kuali.rice.kns.rules.PromptBeforeValidationBase
org.kuali.rice.kns.rules.PromptBeforeValidationBase.ContextSession
 
Field Summary
protected static org.apache.log4j.Logger LOG
           
protected  VendorDetail newVendorDetail
           
protected  String personId
           
 
Fields inherited from class org.kuali.kfs.coa.document.validation.impl.MaintenancePreRulesBase
accountService, configService
 
Fields inherited from class org.kuali.rice.kns.rules.PromptBeforeValidationBase
buttonClicked, event, form, question
 
Constructor Summary
VendorPreRules()
           
 
Method Summary
protected  void detectAndConfirmChangeToParent(org.kuali.rice.kns.document.MaintenanceDocument document)
          This method displays a review if indicated by the vendor type and the associated text from that type This method screens the current document for changes from division vendor to parent vendor.
 void displayReview(org.kuali.rice.kns.document.Document document)
          Displays a review if indicated by the vendor type and the associated text from that type
protected  boolean doCustomPreRules(org.kuali.rice.kns.document.MaintenanceDocument document)
          Sets up a convenience object and few other vendor attributes
 String getPersonId()
          Returns the Universal User Id of the current logged-in user
protected  String removeDelimiter(String str)
          This is a helper method to remove all the delimiters from the vendor name
protected  void setupConvenienceObjects(org.kuali.rice.kns.document.MaintenanceDocument document)
          Sets the convenience objects like newVendorDetail and oldVendorDetail, so you have short and easy handles to the new and old objects contained in the maintenance document.
protected  void setVendorNamesAndIndicator(org.kuali.rice.kns.document.MaintenanceDocument document)
          Sets the vendorFirstLastNameIndicator to true if the first name and last name fields were filled in but the vendorName field is blank and it sets the vendorFirstLastNameIndicator to false if the vendorName field is filled in and the first name and last name fields were both blank.
protected  void setVendorRestriction(org.kuali.rice.kns.document.MaintenanceDocument document)
          Sets the vendorRestrictedDate and vendorRestrictedPersonIdentifier if the vendor restriction has changed from No to Yes.
 
Methods inherited from class org.kuali.kfs.coa.document.validation.impl.MaintenancePreRulesBase
buildContinuationConfirmationQuestion, checkForContinuationAccount, checkForContinuationAccount, doPrompts, getAccountService, getConfigService, setAccountService, setConfigService
 
Methods inherited from class org.kuali.rice.kns.rules.PromptBeforeValidationBase
abortRulesCheck, askOrAnalyzeYesNoQuestion, processPrompts
 
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

newVendorDetail

protected VendorDetail newVendorDetail

personId

protected String personId
Constructor Detail

VendorPreRules

public VendorPreRules()
Method Detail

getPersonId

public String getPersonId()
Returns the Universal User Id of the current logged-in user

Returns:
String the PersonId

doCustomPreRules

protected boolean doCustomPreRules(org.kuali.rice.kns.document.MaintenanceDocument document)
Sets up a convenience object and few other vendor attributes

Overrides:
doCustomPreRules in class MaintenancePreRulesBase
Returns:
true if rules pass
See Also:
MaintenancePreRulesBase.doCustomPreRules(org.kuali.rice.kns.document.MaintenanceDocument)

setupConvenienceObjects

protected void setupConvenienceObjects(org.kuali.rice.kns.document.MaintenanceDocument document)
Sets the convenience objects like newVendorDetail and oldVendorDetail, 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.

Parameters:
document - - the maintenanceDocument being evaluated

setVendorNamesAndIndicator

protected void setVendorNamesAndIndicator(org.kuali.rice.kns.document.MaintenanceDocument document)
Sets the vendorFirstLastNameIndicator to true if the first name and last name fields were filled in but the vendorName field is blank and it sets the vendorFirstLastNameIndicator to false if the vendorName field is filled in and the first name and last name fields were both blank.

Parameters:
document - - the maintenanceDocument being evaluated

setVendorRestriction

protected void setVendorRestriction(org.kuali.rice.kns.document.MaintenanceDocument document)
Sets the vendorRestrictedDate and vendorRestrictedPersonIdentifier if the vendor restriction has changed from No to Yes.

Parameters:
document - - the maintenanceDocument being evaluated

removeDelimiter

protected String removeDelimiter(String str)
This is a helper method to remove all the delimiters from the vendor name

Parameters:
str - the original vendorName
Returns:
result String the vendorName after the delimiters have been removed

displayReview

public void displayReview(org.kuali.rice.kns.document.Document document)
Displays a review if indicated by the vendor type and the associated text from that type

Parameters:
document - - vendordetail document

detectAndConfirmChangeToParent

protected void detectAndConfirmChangeToParent(org.kuali.rice.kns.document.MaintenanceDocument document)
This method displays a review if indicated by the vendor type and the associated text from that type This method screens the current document for changes from division vendor to parent vendor. If the document does contain such a change, the question framework is invoked to obtain the user's confirmation for the change. If confirmation is obtained, a note is added to the old parent vendor. Indicators are set appropriately.

Parameters:
document - The vendor-change-containing MaintenanceDocument under examination


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