org.kuali.kfs.fp.document
Class JournalVoucherDocument

java.lang.Object
  extended by org.kuali.rice.kns.bo.BusinessObjectBase
      extended by org.kuali.rice.kns.bo.PersistableBusinessObjectBase
          extended by org.kuali.rice.kns.document.DocumentBase
              extended by org.kuali.rice.kns.document.TransactionalDocumentBase
                  extended by org.kuali.kfs.sys.document.FinancialSystemTransactionalDocumentBase
                      extended by org.kuali.kfs.sys.document.LedgerPostingDocumentBase
                          extended by org.kuali.kfs.sys.document.GeneralLedgerPostingDocumentBase
                              extended by org.kuali.kfs.sys.document.AccountingDocumentBase
                                  extended by org.kuali.kfs.fp.document.JournalVoucherDocument
All Implemented Interfaces:
Serializable, org.apache.ojb.broker.PersistenceBrokerAware, VoucherDocument, AccountingDocument, AmountTotaling, Correctable, FinancialSystemTransactionalDocument, GeneralLedgerPendingEntrySource, GeneralLedgerPostingDocument, LedgerPostingDocument, org.kuali.rice.kns.bo.BusinessObject, org.kuali.rice.kns.bo.PersistableBusinessObject, org.kuali.rice.kns.document.Copyable, org.kuali.rice.kns.document.Document, org.kuali.rice.kns.document.SessionDocument, org.kuali.rice.kns.document.TransactionalDocument
Direct Known Subclasses:
LaborJournalVoucherDocument

public class JournalVoucherDocument
extends AccountingDocumentBase
implements VoucherDocument, org.kuali.rice.kns.document.Copyable, Correctable, AmountTotaling

This is the business object that represents the JournalVoucherDocument in Kuali. This is a transactional document that will eventually post transactions to the G/L. It integrates with workflow and contains a single group of accounting lines. The Journal Voucher is unique in that we only make use of one accounting line list: the source accounting lines seeing as a JV only records accounting lines as debits or credits.

See Also:
Serialized Form

Field Summary
protected  BalanceType balanceType
           
protected  String balanceTypeCode
           
protected static org.apache.log4j.Logger LOG
           
protected  Date reversalDate
           
 
Fields inherited from class org.kuali.kfs.sys.document.AccountingDocumentBase
dataDictionaryEntry, nextSourceLineNumber, nextTargetLineNumber, sourceAccountingLineClass, sourceAccountingLines, targetAccountingLineClass, targetAccountingLines
 
Fields inherited from class org.kuali.kfs.sys.document.GeneralLedgerPostingDocumentBase
generalLedgerPendingEntries
 
Fields inherited from class org.kuali.kfs.sys.document.LedgerPostingDocumentBase
accountingPeriod, accountingPeriodService, checkPostingYearForCopy, dataDictionaryService, dateTimeService, postingPeriodCode, postingYear
 
Fields inherited from class org.kuali.kfs.sys.document.FinancialSystemTransactionalDocumentBase
documentHeader
 
Fields inherited from class org.kuali.rice.kns.document.DocumentBase
documentBusinessObject, documentNumber
 
Fields inherited from class org.kuali.rice.kns.bo.PersistableBusinessObjectBase
extension, versionNumber
 
Constructor Summary
JournalVoucherDocument()
          Constructs a JournalVoucherDocument instance.
 
Method Summary
 List<SufficientFundsItem> checkSufficientFunds()
          This method will check sufficient funds for the document
 void customizeExplicitGeneralLedgerPendingEntry(GeneralLedgerPendingEntrySourceDetail postable, GeneralLedgerPendingEntry explicitEntry)
          This method sets attributes on the explicitly general ledger pending entry specific to JournalVoucher documents.
 AccountingLineParser getAccountingLineParser()
          Used to get the appropriate AccountingLineParser for the Document
 BalanceType getBalanceType()
          This method retrieves the balance typ associated with this document.
 String getBalanceTypeCode()
          Gets the balanceTypeCode attribute.
 org.kuali.rice.kns.util.KualiDecimal getCreditTotal()
          This method calculates the credit total for a JV document keying off of the debit/credit code, only summing the accounting lines with a debitCreditCode that matched the debit constant, and returns the results.
 org.kuali.rice.kns.util.KualiDecimal getDebitTotal()
          This method calculates the debit total for a JV document keying off of the debit/debit code, only summing the accounting lines with a debitDebitCode that matched the debit constant, and returns the results.
 org.kuali.rice.kns.util.KualiDecimal getGeneralLedgerPendingEntryAmountForDetail(GeneralLedgerPendingEntrySourceDetail accountingLine)
          GLPE amounts are ALWAYS positive, so just take the absolute value of the accounting line's amount.
 Date getReversalDate()
          This method retrieves the reversal date associated with this document.
 Class getSourceAccountingLineClass()
          Returns the default Source accounting line class.
 String getSourceAccountingLinesSectionTitle()
          Overrides the base implementation to return an empty string.
 String getTargetAccountingLinesSectionTitle()
          Overrides the base implementation to return an empty string.
 org.kuali.rice.kns.util.KualiDecimal getTotalDollarAmount()
          This method determines the "total" for the JV document.
 boolean isDebit(GeneralLedgerPendingEntrySourceDetail postable)
          The following are credits (return false) (debitCreditCode isNotBlank) && debitCreditCode != 'D' The following are debits (return true) debitCreditCode == 'D' debitCreditCode isBlank
protected  void processJournalVoucherErrorCorrections()
          This method checks to make sure that the JV that we are dealing with was one that was created in debit/credit mode, not single amount entry mode.
 boolean processOffsetGeneralLedgerPendingEntry(GeneralLedgerPendingEntrySequenceHelper sequenceHelper, GeneralLedgerPendingEntrySourceDetail glpeSourceDetail, GeneralLedgerPendingEntry explicitEntry, GeneralLedgerPendingEntry offsetEntry)
          A Journal Voucher document doesn't generate an offset entry at all, so this method overrides to do nothing more than return true.
 void setBalanceType(BalanceType balanceType)
          Deprecated.  
 void setBalanceTypeCode(String balanceTypeCode)
          Sets the balanceTypeCode attribute value.
 void setReversalDate(Date reversalDate)
          This method sets the reversal date associated with this document.
 void toErrorCorrection()
          Converts this Document instance into an error correction of itself.
 
Methods inherited from class org.kuali.kfs.sys.document.AccountingDocumentBase
addSourceAccountingLine, addTargetAccountingLine, buildAccountingLineMap, buildListOfDeletionAwareLists, copyAccountingLines, customizeOffsetGeneralLedgerPendingEntry, generateDocumentGeneralLedgerPendingEntries, generateEvents, generateGeneralLedgerPendingEntries, generateSaveEvents, getDataDictionaryEntry, getDocumentClassForAccountingLineValueAllowedValidation, getEntryValue, getGeneralLedgerPendingEntrySourceDetails, getNextSourceLineNumber, getNextTargetLineNumber, getPersistedSourceAccountingLinesForComparison, getPersistedTargetAccountingLinesForComparison, getSourceAccountingLine, getSourceAccountingLineEntryName, getSourceAccountingLines, getSourceAccountingLinesForComparison, getSourceTotal, getTargetAccountingLine, getTargetAccountingLineClass, getTargetAccountingLineEntryName, getTargetAccountingLines, getTargetAccountingLinesForComparison, getTargetTotal, prepareForSave, processExplicitGeneralLedgerPendingEntry, setNextSourceLineNumber, setNextTargetLineNumber, setSourceAccountingLines, setTargetAccountingLines, toCopy, updatePostingYearForAccountingLines
 
Methods inherited from class org.kuali.kfs.sys.document.GeneralLedgerPostingDocumentBase
addPendingEntry, changeGeneralLedgerPendingEntriesApprovedStatusCode, clearAnyGeneralLedgerPendingEntries, documentPerformsSufficientFundsCheck, doRouteStatusChange, getGeneralLedgerPendingEntries, getGeneralLedgerPendingEntry, getPendingLedgerEntriesForSufficientFundsChecking, removeGeneralLedgerPendingEntries, setGeneralLedgerPendingEntries
 
Methods inherited from class org.kuali.kfs.sys.document.LedgerPostingDocumentBase
createInitialAccountingPeriod, getAccountingPeriod, getAccountingPeriodService, getDataDictionaryService, getDateTimeService, getFinancialDocumentTypeCode, getPostingPeriodCode, getPostingYear, retrieveCurrentAccountingPeriod, setAccountingPeriod, setPostingPeriodCode, setPostingYear
 
Methods inherited from class org.kuali.kfs.sys.document.FinancialSystemTransactionalDocumentBase
answerSplitNodeQuestion, getDocumentHeader, prepareForSave, processAfterRetrieve, setDocumentHeader
 
Methods inherited from class org.kuali.rice.kns.document.TransactionalDocumentBase
getAllowsCopy, isSessionDocument
 
Methods inherited from class org.kuali.rice.kns.document.DocumentBase
addCopyErrorDocumentNote, addPessimisticLock, afterLookup, afterWorkflowEngineProcess, beforeWorkflowEngineProcess, createPropertySerializabilityEvaluator, doActionTaken, doRouteLevelChange, getAdHocRoutePersons, getAdHocRouteWorkgroups, getBasePathToDocumentDuringSerialization, getCustomLockDescriptor, getDocumentBusinessObject, getDocumentNumber, getDocumentPropertySerizabilityEvaluator, getDocumentTitle, getLockClearningMethodNames, getNonLockingActionTakenCodes, getPessimisticLocks, getWorkflowEngineDocumentIdsToLock, getXmlForRouteReport, logErrors, populateDocumentForRouting, postProcessSave, refresh, refreshIfEmpty, refreshPessimisticLocks, refreshReferenceObject, serializeDocumentToXml, setAdHocRoutePersons, setAdHocRouteWorkgroups, setDocumentNumber, setNewDocumentHeader, setPessimisticLocks, toString, toStringBuilder, toStringMapper, useCustomLockDescriptors, validateBusinessRules, wrapDocumentWithMetadataForXmlSerialization
 
Methods inherited from class org.kuali.rice.kns.bo.PersistableBusinessObjectBase
addNote, afterDelete, afterInsert, afterUpdate, beforeDelete, beforeInsert, beforeInsert, beforeUpdate, beforeUpdate, deleteNote, getAttachmentService, getBoNote, getBoNotes, getExtension, getNoteService, getObjectId, getPersistenceService, getPersistenceStructureService, getVersionNumber, isAutoIncrementSet, isBoNotesSupport, isNewCollectionRecord, linkEditableUserFields, refreshNonUpdateableReferences, setAutoIncrementSet, setBoNotes, setExtension, setNewCollectionRecord, setObjectId, setVersionNumber, supportsBoNotes
 
Methods inherited from class org.kuali.rice.kns.bo.BusinessObjectBase
prepareForWorkflow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.kuali.kfs.sys.document.AccountingDocument
addSourceAccountingLine, addTargetAccountingLine, getDocumentClassForAccountingLineValueAllowedValidation, getNextSourceLineNumber, getNextTargetLineNumber, getSourceAccountingLine, getSourceAccountingLineEntryName, getSourceAccountingLines, getSourceTotal, getTargetAccountingLine, getTargetAccountingLineClass, getTargetAccountingLineEntryName, getTargetAccountingLines, getTargetTotal, setNextSourceLineNumber, setNextTargetLineNumber, setSourceAccountingLines, setTargetAccountingLines
 
Methods inherited from interface org.kuali.kfs.sys.document.GeneralLedgerPostingDocument
getGeneralLedgerPendingEntries, getGeneralLedgerPendingEntry, getPendingLedgerEntriesForSufficientFundsChecking, setGeneralLedgerPendingEntries
 
Methods inherited from interface org.kuali.kfs.sys.document.LedgerPostingDocument
getAccountingPeriod, getPostingPeriodCode, getPostingYear, setAccountingPeriod, setPostingPeriodCode, setPostingYear
 
Methods inherited from interface org.kuali.kfs.sys.document.FinancialSystemTransactionalDocument
answerSplitNodeQuestion, getDocumentHeader
 
Methods inherited from interface org.kuali.rice.kns.document.Document
addPessimisticLock, afterWorkflowEngineProcess, beforeWorkflowEngineProcess, doActionTaken, doRouteLevelChange, doRouteStatusChange, generateSaveEvents, getAdHocRoutePersons, getAdHocRouteWorkgroups, getAllowsCopy, getBasePathToDocumentDuringSerialization, getCustomLockDescriptor, getDocumentBusinessObject, getDocumentNumber, getDocumentPropertySerizabilityEvaluator, getDocumentTitle, getLockClearningMethodNames, getPessimisticLocks, getWorkflowEngineDocumentIdsToLock, getXmlForRouteReport, populateDocumentForRouting, postProcessSave, prepareForSave, prepareForSave, processAfterRetrieve, refreshPessimisticLocks, serializeDocumentToXml, setAdHocRoutePersons, setAdHocRouteWorkgroups, setDocumentHeader, setDocumentNumber, useCustomLockDescriptors, validateBusinessRules, wrapDocumentWithMetadataForXmlSerialization
 
Methods inherited from interface org.kuali.rice.kns.bo.PersistableBusinessObject
addNote, buildListOfDeletionAwareLists, deleteNote, getBoNote, getBoNotes, getExtension, getObjectId, getVersionNumber, isBoNotesSupport, isNewCollectionRecord, linkEditableUserFields, refreshNonUpdateableReferences, refreshReferenceObject, setAutoIncrementSet, setExtension, setNewCollectionRecord, setObjectId, setVersionNumber
 
Methods inherited from interface org.kuali.rice.kns.bo.BusinessObject
prepareForWorkflow, refresh
 
Methods inherited from interface org.apache.ojb.broker.PersistenceBrokerAware
afterDelete, afterInsert, afterLookup, afterUpdate, beforeDelete, beforeInsert, beforeUpdate
 
Methods inherited from interface org.kuali.kfs.sys.document.GeneralLedgerPendingEntrySource
addPendingEntry, clearAnyGeneralLedgerPendingEntries, generateDocumentGeneralLedgerPendingEntries, generateGeneralLedgerPendingEntries, getDocumentHeader, getFinancialDocumentTypeCode, getGeneralLedgerPendingEntrySourceDetails, getPostingYear
 
Methods inherited from interface org.kuali.rice.kns.document.Copyable
toCopy
 

Field Detail

LOG

protected static org.apache.log4j.Logger LOG

balanceTypeCode

protected String balanceTypeCode

balanceType

protected BalanceType balanceType

reversalDate

protected Date reversalDate
Constructor Detail

JournalVoucherDocument

public JournalVoucherDocument()
Constructs a JournalVoucherDocument instance.

Method Detail

checkSufficientFunds

public List<SufficientFundsItem> checkSufficientFunds()
Description copied from interface: GeneralLedgerPostingDocument
This method will check sufficient funds for the document

Specified by:
checkSufficientFunds in interface GeneralLedgerPostingDocument
Overrides:
checkSufficientFunds in class GeneralLedgerPostingDocumentBase
Returns:
a list of sufficientfundsitems that do not have sufficient funds. It returns an empty list if there is sufficient funds for the entire document
See Also:
GeneralLedgerPostingDocumentBase.checkSufficientFunds()

getSourceAccountingLineClass

public Class getSourceAccountingLineClass()
Description copied from class: AccountingDocumentBase
Returns the default Source accounting line class.

Specified by:
getSourceAccountingLineClass in interface AccountingDocument
Overrides:
getSourceAccountingLineClass in class AccountingDocumentBase
See Also:
AccountingDocumentBase.getSourceAccountingLineClass()

getBalanceType

public BalanceType getBalanceType()
This method retrieves the balance typ associated with this document.

Returns:
BalanceTyp

setBalanceType

@Deprecated
public void setBalanceType(BalanceType balanceType)
Deprecated. 

This method sets the balance type associated with this document.

Parameters:
balanceType -

getBalanceTypeCode

public String getBalanceTypeCode()
Gets the balanceTypeCode attribute.

Returns:
Returns the balanceTypeCode.

setBalanceTypeCode

public void setBalanceTypeCode(String balanceTypeCode)
Sets the balanceTypeCode attribute value.

Parameters:
balanceTypeCode - The balanceTypeCode to set.

getReversalDate

public Date getReversalDate()
This method retrieves the reversal date associated with this document.

Specified by:
getReversalDate in interface VoucherDocument
Returns:
java.sql.Date

setReversalDate

public void setReversalDate(Date reversalDate)
This method sets the reversal date associated with this document.

Specified by:
setReversalDate in interface VoucherDocument
Parameters:
reversalDate -

getSourceAccountingLinesSectionTitle

public String getSourceAccountingLinesSectionTitle()
Overrides the base implementation to return an empty string.

Specified by:
getSourceAccountingLinesSectionTitle in interface AccountingDocument
Overrides:
getSourceAccountingLinesSectionTitle in class AccountingDocumentBase
Returns:
String
See Also:
AccountingDocument.getSourceAccountingLinesSectionTitle()

getTargetAccountingLinesSectionTitle

public String getTargetAccountingLinesSectionTitle()
Overrides the base implementation to return an empty string.

Specified by:
getTargetAccountingLinesSectionTitle in interface AccountingDocument
Overrides:
getTargetAccountingLinesSectionTitle in class AccountingDocumentBase
Returns:
String
See Also:
AccountingDocument.getTargetAccountingLinesSectionTitle()

getDebitTotal

public org.kuali.rice.kns.util.KualiDecimal getDebitTotal()
This method calculates the debit total for a JV document keying off of the debit/debit code, only summing the accounting lines with a debitDebitCode that matched the debit constant, and returns the results.

Specified by:
getDebitTotal in interface VoucherDocument
Returns:
KualiDecimal

getCreditTotal

public org.kuali.rice.kns.util.KualiDecimal getCreditTotal()
This method calculates the credit total for a JV document keying off of the debit/credit code, only summing the accounting lines with a debitCreditCode that matched the debit constant, and returns the results.

Specified by:
getCreditTotal in interface VoucherDocument
Returns:
KualiDecimal

getTotalDollarAmount

public org.kuali.rice.kns.util.KualiDecimal getTotalDollarAmount()
This method determines the "total" for the JV document. If the selected balance type is an offset generation, then the method returns the total debits amount when it is greater than the total credit amount. otherwise, it returns total credit amount. When selected balance type is not an offset generation, the method returns the sum of all accounting line debit amounts.

Specified by:
getTotalDollarAmount in interface AmountTotaling
Overrides:
getTotalDollarAmount in class AccountingDocumentBase
Returns:
KualiDecimal the total of the JV document.

getAccountingLineParser

public AccountingLineParser getAccountingLineParser()
Used to get the appropriate AccountingLineParser for the Document

Specified by:
getAccountingLineParser in interface AccountingDocument
Overrides:
getAccountingLineParser in class AccountingDocumentBase
Returns:
AccountingLineParser

toErrorCorrection

public void toErrorCorrection()
                       throws org.kuali.rice.kew.exception.WorkflowException
Description copied from interface: Correctable
Converts this Document instance into an error correction of itself.

Specified by:
toErrorCorrection in interface Correctable
Overrides:
toErrorCorrection in class AccountingDocumentBase
Throws:
org.kuali.rice.kew.exception.WorkflowException
See Also:
AccountingDocumentBase.toErrorCorrection()

processJournalVoucherErrorCorrections

protected void processJournalVoucherErrorCorrections()
This method checks to make sure that the JV that we are dealing with was one that was created in debit/credit mode, not single amount entry mode. If this is a debit/credit JV, then iterate over each source line and flip the sign on the amount to nullify the super's effect, then flip the debit/credit code b/c an error corrected JV flips the debit/credit code.


isDebit

public boolean isDebit(GeneralLedgerPendingEntrySourceDetail postable)
                throws IllegalStateException
The following are credits (return false)
  1. (debitCreditCode isNotBlank) && debitCreditCode != 'D'
The following are debits (return true)
  1. debitCreditCode == 'D'
  2. debitCreditCode isBlank

Specified by:
isDebit in interface GeneralLedgerPendingEntrySource
Specified by:
isDebit in class AccountingDocumentBase
Parameters:
financialDocument - The document which contains the accounting line being analyzed.
accountingLine - The accounting line which will be analyzed to determine if it is a debit line.
Returns:
True if the accounting line provided is a debit accounting line, false otherwise.
Throws:
IllegalStateException - Thrown by method IsDebitUtiles.isDebitCode()
See Also:
org.kuali.rice.kns.rule.AccountingLineRule#isDebit(org.kuali.rice.kns.document.FinancialDocument, org.kuali.rice.kns.bo.AccountingLine), org.kuali.kfs.sys.document.validation.impl.AccountingDocumentRuleBase.IsDebitUtils#isDebitCode(String)

customizeExplicitGeneralLedgerPendingEntry

public void customizeExplicitGeneralLedgerPendingEntry(GeneralLedgerPendingEntrySourceDetail postable,
                                                       GeneralLedgerPendingEntry explicitEntry)
This method sets attributes on the explicitly general ledger pending entry specific to JournalVoucher documents. This includes setting the accounting period code and year (as selected by the user, the object type code, the balance type code, the debit/credit code, the encumbrance update code and the reversal date.

Overrides:
customizeExplicitGeneralLedgerPendingEntry in class AccountingDocumentBase
Parameters:
financialDocument - The document which contains the general ledger pending entry being modified.
accountingLine - The accounting line the explicit entry was generated from.
explicitEntry - The explicit entry being updated.
See Also:
org.kuali.module.financial.rules.FinancialDocumentRuleBase#customizeExplicitGeneralLedgerPendingEntry(org.kuali.rice.kns.document.FinancialDocument, org.kuali.rice.kns.bo.AccountingLine, org.kuali.module.gl.bo.GeneralLedgerPendingEntry)

processOffsetGeneralLedgerPendingEntry

public boolean processOffsetGeneralLedgerPendingEntry(GeneralLedgerPendingEntrySequenceHelper sequenceHelper,
                                                      GeneralLedgerPendingEntrySourceDetail glpeSourceDetail,
                                                      GeneralLedgerPendingEntry explicitEntry,
                                                      GeneralLedgerPendingEntry offsetEntry)
A Journal Voucher document doesn't generate an offset entry at all, so this method overrides to do nothing more than return true. This will be called by the parent's processGeneralLedgerPendingEntries method.

Overrides:
processOffsetGeneralLedgerPendingEntry in class AccountingDocumentBase
Parameters:
financialDocument - The document the offset will be stored within.
sequenceHelper - The sequence object to be modified.
accountingLineToCopy - The accounting line the offset is generated for.
explicitEntry - The explicit entry the offset will be generated for.
offsetEntry - The offset entry to be processed.
Returns:
This method always returns true.
See Also:
org.kuali.module.financial.rules.FinancialDocumentRuleBase#processOffsetGeneralLedgerPendingEntry(org.kuali.rice.kns.document.FinancialDocument, org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySequenceHelper, org.kuali.rice.kns.bo.AccountingLine, org.kuali.module.gl.bo.GeneralLedgerPendingEntry, org.kuali.module.gl.bo.GeneralLedgerPendingEntry)

getGeneralLedgerPendingEntryAmountForDetail

public org.kuali.rice.kns.util.KualiDecimal getGeneralLedgerPendingEntryAmountForDetail(GeneralLedgerPendingEntrySourceDetail accountingLine)
Description copied from class: AccountingDocumentBase
GLPE amounts are ALWAYS positive, so just take the absolute value of the accounting line's amount.

Specified by:
getGeneralLedgerPendingEntryAmountForDetail in interface GeneralLedgerPendingEntrySource
Overrides:
getGeneralLedgerPendingEntryAmountForDetail in class AccountingDocumentBase
Parameters:
accountingLine - the detail line from the general ledger pending entry source to find an amount for
Returns:
KualiDecimal The amount that will be used to populate the GLPE.
See Also:
org.kuali.kfs.sys.document.validation.impl.AccountingDocumentRuleBase#getGeneralLedgerPendingEntryAmountForAccountingLine(org.kuali.kfs.sys.businessobject.AccountingLine)


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