org.kuali.kfs.sys.document.service.impl
Class DebitDeterminerServiceImpl

java.lang.Object
  extended by org.kuali.kfs.sys.document.service.impl.DebitDeterminerServiceImpl
All Implemented Interfaces:
DebitDeterminerService

public class DebitDeterminerServiceImpl
extends Object
implements DebitDeterminerService

Default implementation of the DebitDeterminerService.


Field Summary
protected static String isDebitCalculationIllegalStateExceptionMessage
           
protected static String isErrorCorrectionIllegalStateExceptionMessage
           
protected static String isInvalidLineTypeIllegalArgumentExceptionMessage
           
 
Constructor Summary
DebitDeterminerServiceImpl()
           
 
Method Summary
 void disallowErrorCorrectionDocumentCheck(GeneralLedgerPendingEntrySource poster)
          throws an IllegalStateException if the document is an error correction.
 String getDebitCalculationIllegalStateExceptionMessage()
          Gets the isDebitCalculationIllegalStateExceptionMessage attribute.
 String getErrorCorrectionIllegalStateExceptionMessage()
          Gets the isErrorCorrectionIllegalStateExceptionMessage attribute.
 String getInvalidLineTypeIllegalArgumentExceptionMessage()
          Gets the isInvalidLineTypeIllegalArgumentExceptionMessage attribute.
 boolean isAsset(GeneralLedgerPendingEntrySourceDetail postable)
          Determines whether an accounting line is an asset line.
 boolean isAssetTypeCode(String objectTypeCode)
          Determines whether the objectTypeCode is an asset.
 boolean isDebitCode(String debitCreditCode)
           
 boolean isDebitConsideringNothingPositiveOnly(GeneralLedgerPendingEntrySource poster, GeneralLedgerPendingEntrySourceDetail postable)
           object type is not included in determining if a line is debit or credit.
 boolean isDebitConsideringSection(AccountingDocument accountingDocument, AccountingLine accountingLine)
           accounting line section (source/target) type is included in determining if a line is debit or credit.
 boolean isDebitConsideringSectionAndTypePositiveOnly(AccountingDocument accountingDocument, AccountingLine accountingLine)
           accounting line section (source/target) and object type is included in determining if a line is debit or credit.
 boolean isDebitConsideringType(GeneralLedgerPendingEntrySource poster, GeneralLedgerPendingEntrySourceDetail postable)
           object type is included in determining if a line is debit or credit.
 boolean isErrorCorrection(GeneralLedgerPendingEntrySource poster)
          Convience method for determine if a document is an error correction document.
 boolean isExpense(GeneralLedgerPendingEntrySourceDetail postable)
          Check object code type to determine whether the accounting line is expense.
 boolean isExpenseOrAsset(GeneralLedgerPendingEntrySourceDetail postable)
          Determines whether an accounting line is an expense or asset.
 boolean isIncome(GeneralLedgerPendingEntrySourceDetail postable)
          Determines whether an accounting line is an income line or not.
 boolean isIncomeOrLiability(GeneralLedgerPendingEntrySourceDetail postable)
          Determines whether an accounting line is an income or liability line.
 boolean isLiability(GeneralLedgerPendingEntrySourceDetail postable)
          Determines whether an accounting line is a liability line.
 boolean isLiabilityTypeCode(String objectTypeCode)
          Determines whether the objectTypeCode is a liability.
 boolean isRevenue(GeneralLedgerPendingEntrySourceDetail postable)
          Check object code type to determine whether the accounting line is revenue.
 void setAccountingDocumentRuleUtils(AccountingDocumentRuleHelperService accountingDocumentRuleUtil)
          Sets the accountingDocumentRuleUtils attribute value.
 void setOptionsService(OptionsService optionsService)
          Sets the optionsService attribute value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isDebitCalculationIllegalStateExceptionMessage

protected static final String isDebitCalculationIllegalStateExceptionMessage
See Also:
Constant Field Values

isErrorCorrectionIllegalStateExceptionMessage

protected static final String isErrorCorrectionIllegalStateExceptionMessage
See Also:
Constant Field Values

isInvalidLineTypeIllegalArgumentExceptionMessage

protected static final String isInvalidLineTypeIllegalArgumentExceptionMessage
See Also:
Constant Field Values
Constructor Detail

DebitDeterminerServiceImpl

public DebitDeterminerServiceImpl()
Method Detail

disallowErrorCorrectionDocumentCheck

public void disallowErrorCorrectionDocumentCheck(GeneralLedgerPendingEntrySource poster)
Description copied from interface: DebitDeterminerService
throws an IllegalStateException if the document is an error correction. otherwise does nothing

Specified by:
disallowErrorCorrectionDocumentCheck in interface DebitDeterminerService
See Also:
DebitDeterminerService.disallowErrorCorrectionDocumentCheck(org.kuali.kfs.sys.document.GeneralLedgerPendingEntrySource)

isAsset

public boolean isAsset(GeneralLedgerPendingEntrySourceDetail postable)
Description copied from interface: DebitDeterminerService
Determines whether an accounting line is an asset line.

Specified by:
isAsset in interface DebitDeterminerService
Returns:
boolean True if a line is an asset line.
See Also:
DebitDeterminerService.isAsset(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail)

isAssetTypeCode

public boolean isAssetTypeCode(String objectTypeCode)
Description copied from interface: DebitDeterminerService
Determines whether the objectTypeCode is an asset.

Specified by:
isAssetTypeCode in interface DebitDeterminerService
Returns:
Is she asset or something completely different?
See Also:
DebitDeterminerService.isAssetTypeCode(java.lang.String)

isDebitCode

public boolean isDebitCode(String debitCreditCode)
Specified by:
isDebitCode in interface DebitDeterminerService
Returns:
true if debitCreditCode equals the the debit constant
See Also:
DebitDeterminerService.isDebitCode(java.lang.String)

isDebitConsideringNothingPositiveOnly

public boolean isDebitConsideringNothingPositiveOnly(GeneralLedgerPendingEntrySource poster,
                                                     GeneralLedgerPendingEntrySourceDetail postable)
Description copied from interface: DebitDeterminerService
  1. object type is not included in determining if a line is debit or credit.
  2. accounting line section (source/target) is not included in determining if a line is debit or credit.
the following are credits (return false)
  1. none
the following are debits (return true)
  1. (isIncome || isLiability || isExpense || isAsset) && (lineAmount > 0)
the following are invalid ( throws an IllegalStateException)
  1. lineAmount <= 0
  2. ! (isIncome || isLiability || isExpense || isAsset)

Specified by:
isDebitConsideringNothingPositiveOnly in interface DebitDeterminerService
Returns:
boolean
See Also:
DebitDeterminerService.isDebitConsideringNothingPositiveOnly(org.kuali.kfs.sys.document.GeneralLedgerPendingEntrySource, org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail)

isDebitConsideringSection

public boolean isDebitConsideringSection(AccountingDocument accountingDocument,
                                         AccountingLine accountingLine)
Description copied from interface: DebitDeterminerService
  1. accounting line section (source/target) type is included in determining if a line is debit or credit.
  2. zero line amounts are never allowed
the following are credits (return false)
  1. isSourceLine && (isIncome || isExpense || isAsset || isLiability) && (lineAmount > 0)
  2. isTargetLine && (isIncome || isExpense || isAsset || isLiability) && (lineAmount < 0)
the following are debits (return true)
  1. isSourceLine && (isIncome || isExpense || isAsset || isLiability) && (lineAmount < 0)
  2. isTargetLine && (isIncome || isExpense || isAsset || isLiability) && (lineAmount > 0)
the following are invalid ( throws an IllegalStateException)
  1. lineAmount == 0
  2. ! (isIncome || isLiability || isExpense || isAsset)

Specified by:
isDebitConsideringSection in interface DebitDeterminerService
Returns:
boolean
See Also:
DebitDeterminerService.isDebitConsideringSection(org.kuali.kfs.sys.document.AccountingDocument, org.kuali.kfs.sys.businessobject.AccountingLine)

isDebitConsideringSectionAndTypePositiveOnly

public boolean isDebitConsideringSectionAndTypePositiveOnly(AccountingDocument accountingDocument,
                                                            AccountingLine accountingLine)
Description copied from interface: DebitDeterminerService
  1. accounting line section (source/target) and object type is included in determining if a line is debit or credit.
  2. negative line amounts are Only allowed during error correction
the following are credits (return false)
  1. isSourceLine && (isExpense || isAsset) && (lineAmount > 0)
  2. isTargetLine && (isIncome || isLiability) && (lineAmount > 0)
  3. isErrorCorrection && isSourceLine && (isIncome || isLiability) && (lineAmount < 0)
  4. isErrorCorrection && isTargetLine && (isExpense || isAsset) && (lineAmount < 0)
the following are debits (return true)
  1. isSourceLine && (isIncome || isLiability) && (lineAmount > 0)
  2. isTargetLine && (isExpense || isAsset) && (lineAmount > 0)
  3. isErrorCorrection && (isExpense || isAsset) && (lineAmount < 0)
  4. isErrorCorrection && (isIncome || isLiability) && (lineAmount < 0)
the following are invalid ( throws an IllegalStateException)
  1. !isErrorCorrection && !(lineAmount > 0)

Specified by:
isDebitConsideringSectionAndTypePositiveOnly in interface DebitDeterminerService
Returns:
boolean
See Also:
DebitDeterminerService.isDebitConsideringSectionAndTypePositiveOnly(org.kuali.kfs.sys.document.AccountingDocument, org.kuali.kfs.sys.businessobject.AccountingLine)

isDebitConsideringType

public boolean isDebitConsideringType(GeneralLedgerPendingEntrySource poster,
                                      GeneralLedgerPendingEntrySourceDetail postable)
Description copied from interface: DebitDeterminerService
  1. object type is included in determining if a line is debit or credit.
the following are credits (return false)
  1. (isIncome || isLiability) && (lineAmount > 0)
  2. (isExpense || isAsset) && (lineAmount < 0)
the following are debits (return true)
  1. (isIncome || isLiability) && (lineAmount < 0)
  2. (isExpense || isAsset) && (lineAmount > 0)
the following are invalid ( throws an IllegalStateException)
  1. document isErrorCorrection
  2. lineAmount == 0
  3. ! (isIncome || isLiability || isExpense || isAsset)

Specified by:
isDebitConsideringType in interface DebitDeterminerService
Returns:
boolean
See Also:
DebitDeterminerService.isDebitConsideringType(org.kuali.kfs.sys.document.GeneralLedgerPendingEntrySource, org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail)

isErrorCorrection

public boolean isErrorCorrection(GeneralLedgerPendingEntrySource poster)
Description copied from interface: DebitDeterminerService
Convience method for determine if a document is an error correction document.

Specified by:
isErrorCorrection in interface DebitDeterminerService
Returns:
true if document is an error correct
See Also:
DebitDeterminerService.isErrorCorrection(org.kuali.kfs.sys.document.GeneralLedgerPendingEntrySource)

isExpense

public boolean isExpense(GeneralLedgerPendingEntrySourceDetail postable)
Description copied from interface: DebitDeterminerService
Check object code type to determine whether the accounting line is expense.

Specified by:
isExpense in interface DebitDeterminerService
Returns:
boolean True if the line is an expense line.
See Also:
DebitDeterminerService.isExpense(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail)

isExpenseOrAsset

public boolean isExpenseOrAsset(GeneralLedgerPendingEntrySourceDetail postable)
Description copied from interface: DebitDeterminerService
Determines whether an accounting line is an expense or asset.

Specified by:
isExpenseOrAsset in interface DebitDeterminerService
Returns:
boolean True if it's an expense or asset.
See Also:
DebitDeterminerService.isExpenseOrAsset(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail)

isIncome

public boolean isIncome(GeneralLedgerPendingEntrySourceDetail postable)
Description copied from interface: DebitDeterminerService
Determines whether an accounting line is an income line or not. This goes agains the configurable object type code list in the ApplicationParameter mechanism. This list can be configured externally.

Specified by:
isIncome in interface DebitDeterminerService
Returns:
boolean True if the line is an income line.
See Also:
DebitDeterminerService.isIncome(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail)

isIncomeOrLiability

public boolean isIncomeOrLiability(GeneralLedgerPendingEntrySourceDetail postable)
Description copied from interface: DebitDeterminerService
Determines whether an accounting line is an income or liability line.

Specified by:
isIncomeOrLiability in interface DebitDeterminerService
Returns:
boolean True if the line is an income or liability line.
See Also:
DebitDeterminerService.isIncomeOrLiability(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail)

isLiability

public boolean isLiability(GeneralLedgerPendingEntrySourceDetail postable)
Description copied from interface: DebitDeterminerService
Determines whether an accounting line is a liability line.

Specified by:
isLiability in interface DebitDeterminerService
Returns:
boolean True if the line is a liability line.
See Also:
DebitDeterminerService.isLiability(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail)

isLiabilityTypeCode

public boolean isLiabilityTypeCode(String objectTypeCode)
Description copied from interface: DebitDeterminerService
Determines whether the objectTypeCode is a liability.

Specified by:
isLiabilityTypeCode in interface DebitDeterminerService
Returns:
Is she liability or something completely different?
See Also:
DebitDeterminerService.isLiabilityTypeCode(java.lang.String)

isRevenue

public boolean isRevenue(GeneralLedgerPendingEntrySourceDetail postable)
Description copied from interface: DebitDeterminerService
Check object code type to determine whether the accounting line is revenue.

Specified by:
isRevenue in interface DebitDeterminerService
Returns:
boolean True if the line is a revenue line.
See Also:
DebitDeterminerService.isRevenue(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail)

setAccountingDocumentRuleUtils

public void setAccountingDocumentRuleUtils(AccountingDocumentRuleHelperService accountingDocumentRuleUtil)
Sets the accountingDocumentRuleUtils attribute value.

Parameters:
accountingDocumentRuleUtils - The accountingDocumentRuleUtils to set.

setOptionsService

public void setOptionsService(OptionsService optionsService)
Sets the optionsService attribute value.

Parameters:
optionsService - The optionsService to set.

getDebitCalculationIllegalStateExceptionMessage

public String getDebitCalculationIllegalStateExceptionMessage()
Gets the isDebitCalculationIllegalStateExceptionMessage attribute.

Specified by:
getDebitCalculationIllegalStateExceptionMessage in interface DebitDeterminerService
Returns:
Returns the isDebitCalculationIllegalStateExceptionMessage.

getErrorCorrectionIllegalStateExceptionMessage

public String getErrorCorrectionIllegalStateExceptionMessage()
Gets the isErrorCorrectionIllegalStateExceptionMessage attribute.

Specified by:
getErrorCorrectionIllegalStateExceptionMessage in interface DebitDeterminerService
Returns:
Returns the isErrorCorrectionIllegalStateExceptionMessage.

getInvalidLineTypeIllegalArgumentExceptionMessage

public String getInvalidLineTypeIllegalArgumentExceptionMessage()
Gets the isInvalidLineTypeIllegalArgumentExceptionMessage attribute.

Specified by:
getInvalidLineTypeIllegalArgumentExceptionMessage in interface DebitDeterminerService
Returns:
Returns the isInvalidLineTypeIllegalArgumentExceptionMessage.


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