org.kuali.kfs.module.endow.document.validation.impl
Class EndowmentTransactionLinesDocumentBaseRules

java.lang.Object
  extended by org.kuali.rice.kns.rules.DocumentRuleBase
      extended by org.kuali.rice.kns.rules.TransactionalDocumentRuleBase
          extended by org.kuali.kfs.module.endow.document.validation.impl.EndowmentTransactionalDocumentBaseRule
              extended by org.kuali.kfs.module.endow.document.validation.impl.EndowmentTransactionLinesDocumentBaseRules
All Implemented Interfaces:
AddTransactionLineRule<EndowmentTransactionLinesDocument,EndowmentTransactionLine>, DeleteTransactionLineRule<EndowmentTransactionLinesDocument,EndowmentTransactionLine>, RefreshTransactionLineRule<EndowmentTransactionLinesDocument,EndowmentTransactionLine,Number>, org.kuali.rice.kns.rule.AddAdHocRoutePersonRule, org.kuali.rice.kns.rule.AddAdHocRouteWorkgroupRule, 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
Direct Known Subclasses:
AssetDecreaseDocumentRules, AssetIncreaseDocumentRules, CashDocumentBaseRules, CorporateReorganizationDocumentRules, CorpusAdjustmentDocumentRules, EndowmentAccountingLinesDocumentBaseRules, EndowmentUnitShareAdjustmentDocumentRules, HoldingAdjustmentDocumentRules, LiabilityDecreaseDocumentRules, LiabilityIncreaseDocumentRules, SecurityTransferDocumentRules

public class EndowmentTransactionLinesDocumentBaseRules
extends EndowmentTransactionalDocumentBaseRule
implements AddTransactionLineRule<EndowmentTransactionLinesDocument,EndowmentTransactionLine>, DeleteTransactionLineRule<EndowmentTransactionLinesDocument,EndowmentTransactionLine>, RefreshTransactionLineRule<EndowmentTransactionLinesDocument,EndowmentTransactionLine,Number>


Constructor Summary
EndowmentTransactionLinesDocumentBaseRules()
           
 
Method Summary
protected  boolean canKEMIDHaveAPrincipalTransaction(EndowmentTransactionLine line, String prefix)
          This method validates if a KEMID can have a principal transaction when IP indicator is equal to P.
protected  boolean checkCashTransactionEndowmentCode(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument, EndowmentTransactionLine line, String prefix)
          This methods checks to ensure for cash Tx do not have a Etran.
protected  void checkWhetherHaveSufficientFundsForCashBasedTransaction(EndowmentTransactionLine line, String prefix)
          Upon adding the transaction line, the system will check to see if there are sufficient funds to process the transaction (END_AVAIL_CSH_T).
protected  void checkWhetherReducePermanentlyRestrictedFund(EndowmentTransactionLine line, String prefix)
          For a true endowment, when the END_TRAN_LN_T: TRAN_IP_IND_CD is equal to P, a warning message will be placed in the document transaction line notifying the viewer that the transaction will reduce the value of the endowment at the time the transaction line is added.
 String getErrorPrefix(EndowmentTransactionLine line, int index)
          This method obtains Prefix for Error fields in UI.
 String getRegistrationForValidation(EndowmentTransactionLinesDocument endowmentTransactionLinesDocumentBase, boolean isSource)
          This method obtains Registration code from a document.
 Security getSecurityForValidation(EndowmentTransactionLinesDocument endowmentTransactionLinesDocumentBase, boolean isSource)
          This method obtains security from a document.
 String getSecurityIDForValidation(EndowmentTransactionLinesDocument endowmentTransactionLinesDocumentBase, boolean isSource)
          This method obtains security code from a document.
protected  boolean hasEtranCode(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument)
          Tells if the document has an etran code.
protected  boolean isActiveKemId(EndowmentTransactionLine line, String prefix)
          This method determines if the KEMID is active.
protected  boolean isEndowmentTransactionCodeEmpty(EndowmentTransactionLine line, String prefix)
          This method validates the EndowmentTransaction code.
protected  boolean isKemIdCodeEmpty(EndowmentTransactionLine line, String prefix)
          This method validates the KEMID code.
protected  boolean nonCashTransaction(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument)
          This method checks if this is a non-cash transaction.
 boolean processAddTransactionLineRules(EndowmentTransactionLinesDocument document, EndowmentTransactionLine line)
           
protected  boolean processCustomRouteDocumentBusinessRules(org.kuali.rice.kns.document.Document document)
           
 boolean processDeleteTransactionLineRules(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument, EndowmentTransactionLine endowmentTransactionLine)
           
 boolean processRefreshTransactionLineRules(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument, EndowmentTransactionLine endowmentTransactionLine, Number index)
          This method...
protected  boolean templateMethod(EndowmentTransactionLine line)
           
protected  boolean transactionLineSizeGreaterThanZero(EndowmentTransactionLinesDocumentBase document, boolean isSource)
          Checks that the document has at least one transaction line.
protected  boolean validateChartMatch(EndowmentTransactionLine line, String prefix)
          This method validates if the chart is matched between GL Account in the KEMID and GL Link in the Endowment Transaction Code.
protected  boolean validateEndowmentTransactionCode(EndowmentTransactionLine line, String prefix)
          This method validates the EndowmentTransaction code and tries to create a EndowmentTransactionCode object from the code.
protected  boolean validateEndowmentTransactionTypeCode(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument, EndowmentTransactionLine line, String prefix)
          This method checks if the ETRAN code has a type code of E or I.
protected  boolean validateKemId(EndowmentTransactionLine line, String prefix)
          This method validates the KemId code and tries to create a KEMID object from the code.
protected  boolean validateNonDuplicateSecurityCodes(EndowmentSecurityDetailsDocumentBase document)
          This method validates that the source and target security lines are different from each other.
protected  boolean validateNoTransactionRestriction(EndowmentTransactionLine line, String prefix)
          This method checks if the KEMID restriction code is "NTRAN"
protected  boolean validateRegistration(boolean isValid, EndowmentSecurityDetailsDocumentBase document, boolean isSource)
          This method is a collection if validation performed on Registration Code.
protected  boolean validateSecurity(boolean isValid, EndowmentSecurityDetailsDocumentBase document, boolean isSource)
          This method is a collection if validation performed on Security.
protected  boolean validateSecurityEtranChartMatch(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument, EndowmentTransactionLine line, String prefix, boolean isSource)
          Validates that the security chart and the etran code chart match.
protected  boolean validateSourceTargetAmountEqual(SecurityTransferDocument securityTransferDocument)
          This method validates if the source & target units are equal.
protected  boolean validateSourceTargetUnitsEqual(SecurityTransferDocument securityTransferDocument)
          This method validates if the source & target units are equal.
 boolean validateSufficientUnits(boolean isAdd, EndowmentTransactionLinesDocument endowmentTransactionLinesDocument, EndowmentTransactionLine line, int transLineIndex, int taxLotIndex)
          Validates that the KEMID has sufficient units in the tax lots to perform the transaction.
protected  boolean validateTaxLots(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument, EndowmentTransactionLine transLine, int transLineIndex)
          Validates that the tax lots for a transaction line correspond to the information in that transaction line.
protected  boolean validateTotalUnits(EndowmentTransactionalDocument document, EndowmentTransactionLine transactionLine, int index)
          Checks that the transaction line units match the tax lot lines total number of units.
protected  boolean validateTransactionAmountGreaterThanZero(EndowmentTransactionLine line, String prefix)
          This method checks is the Transaction amount entered is greater than Zero.
protected  boolean validateTransactionAmountLessThanZero(EndowmentTransactionLine line, String prefix)
          This method checks is the Transaction amount entered is greater than Zero.
protected  boolean validateTransactionLine(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument, EndowmentTransactionLine line, int index)
          This method validates a transaction line.
protected  boolean validateTransactionUnitsAmountEqual(EndowmentTransactionLine line, String prefix)
          This method checks is the Transaction Units & Amount entered are equal.
protected  boolean validateTransactionUnitsGreaterThanZero(EndowmentTransactionLine line, String prefix)
          This method checks is the Transaction Units entered is greater than Zero.
protected  boolean validateTransactionUnitsLessThanZero(EndowmentTransactionLine line, String prefix)
          This method checks is the Transaction Units entered is greater than Zero.
 
Methods inherited from class org.kuali.kfs.module.endow.document.validation.impl.EndowmentTransactionalDocumentBaseRule
errorAlreadyExists, getEndowmentTransactionSecurity, getEndowmentTransactionSecurityPrefix, isRegistrationCodeActive, isRegistrationCodeEmpty, isSecurityActive, isSecurityCodeEmpty, isSubTypeEmpty, putDocumentError, putDocumentError, putFieldError, putFieldError, putFieldError, putGlobalError, putGlobalError, putGlobalError, putGlobalsError, putGlobalsError, validateRegistrationCode, validateSecurityClassCodeTypeNotLiability, validateSecurityClassTypeCode, validateSecurityCode
 
Methods inherited from class org.kuali.rice.kns.rules.DocumentRuleBase
getDataDictionaryService, getDictionaryValidationService, getDocumentHelperService, getIdentityManagementService, getKualiConfigurationService, getMaxDictionaryValidationDepth, getPersonService, getWorkflowInfoService, isAddHocRoutePersonValid, isAddHocRouteWorkgroupValid, isAdHocRouteRecipientsValid, isDocumentAttributesValid, isDocumentOverviewValid, isNoteValid, processAddAdHocRoutePerson, processAddAdHocRouteWorkgroup, processAddNote, processApproveDocument, processCustomAddAdHocRoutePersonBusinessRules, processCustomAddAdHocRouteWorkgroupBusinessRules, processCustomAddNoteBusinessRules, processCustomApproveDocumentBusinessRules, processCustomSaveDocumentBusinessRules, processCustomSendAdHocRequests, processRouteDocument, processSaveDocument, processSendAdHocRequests, setMaxDictionaryValidationDepth, validateSensitiveDataValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EndowmentTransactionLinesDocumentBaseRules

public EndowmentTransactionLinesDocumentBaseRules()
Method Detail

processDeleteTransactionLineRules

public boolean processDeleteTransactionLineRules(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument,
                                                 EndowmentTransactionLine endowmentTransactionLine)
Specified by:
processDeleteTransactionLineRules in interface DeleteTransactionLineRule<EndowmentTransactionLinesDocument,EndowmentTransactionLine>
See Also:
DeleteTransactionLineRule.processDeleteTransactionLineRules(org.kuali.kfs.module.endow.document.EndowmentTransactionLinesDocument, org.kuali.kfs.module.endow.businessobject.EndowmentTransactionLine)

processAddTransactionLineRules

public boolean processAddTransactionLineRules(EndowmentTransactionLinesDocument document,
                                              EndowmentTransactionLine line)
Specified by:
processAddTransactionLineRules in interface AddTransactionLineRule<EndowmentTransactionLinesDocument,EndowmentTransactionLine>
See Also:
AddTransactionLineRule.processAddTransactionLineRules(org.kuali.kfs.module.endow.document.EndowmentTransactionLinesDocument, org.kuali.kfs.module.endow.businessobject.EndowmentTransactionLine)

processRefreshTransactionLineRules

public boolean processRefreshTransactionLineRules(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument,
                                                  EndowmentTransactionLine endowmentTransactionLine,
                                                  Number index)
Description copied from interface: RefreshTransactionLineRule
This method...

Specified by:
processRefreshTransactionLineRules in interface RefreshTransactionLineRule<EndowmentTransactionLinesDocument,EndowmentTransactionLine,Number>
Returns:
See Also:
RefreshTransactionLineRule.processRefreshTransactionLineRules(org.kuali.kfs.module.endow.document.EndowmentTransactionLinesDocument, org.kuali.kfs.module.endow.businessobject.EndowmentTransactionLine, java.lang.Number)

processCustomRouteDocumentBusinessRules

protected boolean processCustomRouteDocumentBusinessRules(org.kuali.rice.kns.document.Document document)
Overrides:
processCustomRouteDocumentBusinessRules in class EndowmentTransactionalDocumentBaseRule
See Also:
DocumentRuleBase.processCustomRouteDocumentBusinessRules(org.kuali.rice.kns.document.Document)

getErrorPrefix

public String getErrorPrefix(EndowmentTransactionLine line,
                             int index)
This method obtains Prefix for Error fields in UI.

Parameters:
line -
index -
Returns:

getSecurityIDForValidation

public String getSecurityIDForValidation(EndowmentTransactionLinesDocument endowmentTransactionLinesDocumentBase,
                                         boolean isSource)
This method obtains security code from a document.

Parameters:
endowmentTransactionLinesDocumentBase -
line -
Returns:

getRegistrationForValidation

public String getRegistrationForValidation(EndowmentTransactionLinesDocument endowmentTransactionLinesDocumentBase,
                                           boolean isSource)
This method obtains Registration code from a document.

Parameters:
endowmentTransactionLinesDocumentBase -
line -
Returns:

getSecurityForValidation

public Security getSecurityForValidation(EndowmentTransactionLinesDocument endowmentTransactionLinesDocumentBase,
                                         boolean isSource)
This method obtains security from a document.

Parameters:
endowmentTransactionLinesDocumentBase -
line -
Returns:

validateTransactionLine

protected boolean validateTransactionLine(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument,
                                          EndowmentTransactionLine line,
                                          int index)
This method validates a transaction line.

Parameters:
line -
index -
Returns:

nonCashTransaction

protected boolean nonCashTransaction(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument)
This method checks if this is a non-cash transaction.

Parameters:
endowmentTransactionLinesDocumentBase -
Returns:

hasEtranCode

protected boolean hasEtranCode(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument)
Tells if the document has an etran code. Override this method in the BR class specific to your document to return whether the document has etran code or not.

Parameters:
endowmentTransactionLinesDocument -
Returns:
true by default. It should return true if the document has an etran code or false otherwise.

isKemIdCodeEmpty

protected boolean isKemIdCodeEmpty(EndowmentTransactionLine line,
                                   String prefix)
This method validates the KEMID code.

Parameters:
tranSecurity -
Returns:

validateKemId

protected boolean validateKemId(EndowmentTransactionLine line,
                                String prefix)
This method validates the KemId code and tries to create a KEMID object from the code.

Parameters:
line -
Returns:

isActiveKemId

protected boolean isActiveKemId(EndowmentTransactionLine line,
                                String prefix)
This method determines if the KEMID is active.

Parameters:
line -
Returns:

validateNoTransactionRestriction

protected boolean validateNoTransactionRestriction(EndowmentTransactionLine line,
                                                   String prefix)
This method checks if the KEMID restriction code is "NTRAN"

Parameters:
line -
Returns:

validateTransactionAmountGreaterThanZero

protected boolean validateTransactionAmountGreaterThanZero(EndowmentTransactionLine line,
                                                           String prefix)
This method checks is the Transaction amount entered is greater than Zero.

Parameters:
line -
Returns:

validateTransactionAmountLessThanZero

protected boolean validateTransactionAmountLessThanZero(EndowmentTransactionLine line,
                                                        String prefix)
This method checks is the Transaction amount entered is greater than Zero.

Parameters:
line -
Returns:

validateTransactionUnitsGreaterThanZero

protected boolean validateTransactionUnitsGreaterThanZero(EndowmentTransactionLine line,
                                                          String prefix)
This method checks is the Transaction Units entered is greater than Zero.

Parameters:
line -
Returns:

validateTransactionUnitsLessThanZero

protected boolean validateTransactionUnitsLessThanZero(EndowmentTransactionLine line,
                                                       String prefix)
This method checks is the Transaction Units entered is greater than Zero.

Parameters:
line -
Returns:

validateTransactionUnitsAmountEqual

protected boolean validateTransactionUnitsAmountEqual(EndowmentTransactionLine line,
                                                      String prefix)
This method checks is the Transaction Units & Amount entered are equal.

Parameters:
line -
prefix -
Returns:

validateEndowmentTransactionTypeCode

protected boolean validateEndowmentTransactionTypeCode(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument,
                                                       EndowmentTransactionLine line,
                                                       String prefix)
This method checks if the ETRAN code has a type code of E or I.

Parameters:
line -
Returns:

isEndowmentTransactionCodeEmpty

protected boolean isEndowmentTransactionCodeEmpty(EndowmentTransactionLine line,
                                                  String prefix)
This method validates the EndowmentTransaction code.

Parameters:
tranSecurity -
Returns:

validateEndowmentTransactionCode

protected boolean validateEndowmentTransactionCode(EndowmentTransactionLine line,
                                                   String prefix)
This method validates the EndowmentTransaction code and tries to create a EndowmentTransactionCode object from the code.

Parameters:
line -
Returns:

canKEMIDHaveAPrincipalTransaction

protected boolean canKEMIDHaveAPrincipalTransaction(EndowmentTransactionLine line,
                                                    String prefix)
This method validates if a KEMID can have a principal transaction when IP indicator is equal to P.

Parameters:
line -
Returns:

validateChartMatch

protected boolean validateChartMatch(EndowmentTransactionLine line,
                                     String prefix)
This method validates if the chart is matched between GL Account in the KEMID and GL Link in the Endowment Transaction Code. If the Chart codes do not match, the Etran Code field should be highlighted.

Parameters:
line -
Returns:

validateSecurityEtranChartMatch

protected boolean validateSecurityEtranChartMatch(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument,
                                                  EndowmentTransactionLine line,
                                                  String prefix,
                                                  boolean isSource)
Validates that the security chart and the etran code chart match.

Parameters:
endowmentTransactionLinesDocument -
line -
prefix -
isSource -
Returns:
true if valid, false otherwise

checkWhetherReducePermanentlyRestrictedFund

protected void checkWhetherReducePermanentlyRestrictedFund(EndowmentTransactionLine line,
                                                           String prefix)
For a true endowment, when the END_TRAN_LN_T: TRAN_IP_IND_CD is equal to P, a warning message will be placed in the document transaction line notifying the viewer that the transaction will reduce the value of the endowment at the time the transaction line is added. WARNING: This transaction will reduce permanently restricted funds!. However, the transaction line would be added on successfully.

Parameters:
line -

checkWhetherHaveSufficientFundsForCashBasedTransaction

protected void checkWhetherHaveSufficientFundsForCashBasedTransaction(EndowmentTransactionLine line,
                                                                      String prefix)
Upon adding the transaction line, the system will check to see if there are sufficient funds to process the transaction (END_AVAIL_CSH_T). If there are not, a warning message will be placed in the document transaction line notifying the viewer that there are not sufficient funds. -If END_TRAN_LN_T: TRAN_IP_IND_CD is equal to I verify against END_AVAIL_CSH_T: AVAIL_TOT_CSH -If END_TRAN_LN_T: TRAN_IP_IND_CD is equal to P verify against END_AVAIL_CSH_T: AVAIL_PRIN_CSH However, the transaction line would be added on successfully.

Parameters:
line -

templateMethod

protected boolean templateMethod(EndowmentTransactionLine line)

checkCashTransactionEndowmentCode

protected boolean checkCashTransactionEndowmentCode(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument,
                                                    EndowmentTransactionLine line,
                                                    String prefix)
This methods checks to ensure for cash Tx do not have a Etran.

Parameters:
endowmentTransactionLinesDocumentBase -
line -
prefix -
Returns:

transactionLineSizeGreaterThanZero

protected boolean transactionLineSizeGreaterThanZero(EndowmentTransactionLinesDocumentBase document,
                                                     boolean isSource)
Checks that the document has at least one transaction line.

Parameters:
document -
isSource -
Returns:
true if valid, false otherwise

validateRegistration

protected boolean validateRegistration(boolean isValid,
                                       EndowmentSecurityDetailsDocumentBase document,
                                       boolean isSource)
This method is a collection if validation performed on Registration Code. The validations are not null & valid registration code

Parameters:
isValid -
liabilityIncreaseDocument -
Returns:

validateSecurity

protected boolean validateSecurity(boolean isValid,
                                   EndowmentSecurityDetailsDocumentBase document,
                                   boolean isSource)
This method is a collection if validation performed on Security. The validations are not null, valid security,active & class code matches L

Parameters:
isValid -
document -
Returns:

validateNonDuplicateSecurityCodes

protected boolean validateNonDuplicateSecurityCodes(EndowmentSecurityDetailsDocumentBase document)
This method validates that the source and target security lines are different from each other.

Parameters:
document -
Returns:
True if source and target security codes are different

validateSufficientUnits

public boolean validateSufficientUnits(boolean isAdd,
                                       EndowmentTransactionLinesDocument endowmentTransactionLinesDocument,
                                       EndowmentTransactionLine line,
                                       int transLineIndex,
                                       int taxLotIndex)
Validates that the KEMID has sufficient units in the tax lots to perform the transaction.

Parameters:
endowmentTransactionLinesDocumentBase -
line -
index -
Returns:
true if valid, false otherwise

validateTaxLots

protected boolean validateTaxLots(EndowmentTransactionLinesDocument endowmentTransactionLinesDocument,
                                  EndowmentTransactionLine transLine,
                                  int transLineIndex)
Validates that the tax lots for a transaction line correspond to the information in that transaction line. It might be possible that the user has changed the KEMID or Security related data without refreshing the tax lot lines. On save we need to check that the tax lot lines relate to the KEMID in the transaction lines. Take the first tax lot for the transaction line and check if it is in the holding tax lots for that KEMID. This validation is needed in documents that support tax lot lines deletion as in that case the tax lot lines are not automatically refreshed on save/submit.

Parameters:
endowmentTransactionLinesDocument -
transLine -
transLineIndex -
Returns:

validateTotalUnits

protected boolean validateTotalUnits(EndowmentTransactionalDocument document,
                                     EndowmentTransactionLine transactionLine,
                                     int index)
Checks that the transaction line units match the tax lot lines total number of units.

Parameters:
document -
transactionLine -
index -
Returns:
true if valid, false otherwise

validateSourceTargetUnitsEqual

protected boolean validateSourceTargetUnitsEqual(SecurityTransferDocument securityTransferDocument)
This method validates if the source & target units are equal.

Parameters:
securityTransferDocument -
Returns:

validateSourceTargetAmountEqual

protected boolean validateSourceTargetAmountEqual(SecurityTransferDocument securityTransferDocument)
This method validates if the source & target units are equal.

Parameters:
securityTransferDocument -
Returns:


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