com.moneydance.apps.md.model
Class ParentTxn

java.lang.Object
  extended by com.moneydance.apps.md.model.AbstractTxn
      extended by com.moneydance.apps.md.model.ParentTxn
All Implemented Interfaces:
Txn

public final class ParentTxn
extends AbstractTxn

Concrete class that represents the "source" side of a transaction. Valid transactions of this type are associated with one or more destination (or split) transactions. The value of transactions of this type are the sum of the values of all of the associated splits.


Field Summary
 
Fields inherited from class com.moneydance.apps.md.model.AbstractTxn
BANK_TRANSACTION_TYPE, SPLIT_TRANSACTION_TYPE, STATUS_CLEARED, STATUS_RECONCILING, STATUS_UNRECONCILED, TAG_FI_ID, TAG_FITID_PREFIX, TAG_INVST_SPLIT_EXP, TAG_INVST_SPLIT_FEE, TAG_INVST_SPLIT_INC, TAG_INVST_SPLIT_SEC, TAG_INVST_SPLIT_TYPE, TAG_INVST_SPLIT_XFR, TAG_IS_NEW_TXN, TAG_ONLINE_PMT_ID, TAG_QIF_IMPORT_SESSION, TAG_QIF_INVST_ACTION, TAG_RECON_ASOFDT, TAG_RECON_DATE, TAG_SPLIT_ADDED, TAG_SPLIT_AMOUNT, TAG_SPLIT_CALC, TAG_SPLIT_PAIR, TRANSFER_TYPE_BANK, TRANSFER_TYPE_BUYSELL, TRANSFER_TYPE_BUYSELLXFR, TRANSFER_TYPE_DIVIDEND, TRANSFER_TYPE_DIVIDENDXFR, TRANSFER_TYPE_MISCINCEXP, TRANSFER_TYPE_SHORTCOVER
 
Constructor Summary
ParentTxn(int date, int taxDate, long dateEntered, java.lang.String checkNumber, Account account, java.lang.String description, java.lang.String memo, long id, byte status)
          Constructor as of build 350.
ParentTxn(long date, long taxDate, long dateEntered, java.lang.String checkNumber, Account account, java.lang.String description, java.lang.String memo, long id, byte status)
          Deprecated. Please use the constructor with int date parameters.
 
Method Summary
 void addSplit(SplitTxn newSplit)
          Add a "split" to this transaction.
 void clearTags()
          Remove all the tags associated with this transaction, and any of its splits.
 ParentTxn createNew()
          Create a new transaction with all of the same fields as this transaction.
 ParentTxn duplicate()
          Clone this transaction and all of its splits.
 AddressBook.AddressEntry getAddress()
          Returns the address book entry (if any) that is associated with this transaction.
 java.lang.String getCheckNumber()
          Get the check number associated with this transaction.
 long getDate()
          Deprecated. use getDateInt() instead
 long getDateEntered()
          Get the date that this transaction was entered.
 int getDateInt()
          Return the date encoded as an integer with decimal form YYYYMMDD
 java.lang.String getMemo()
          Get the memo associated with this transaction.
 AbstractTxn getOtherTxn(int i)
          Return the "other transaction" at the specified index.
 int getOtherTxnCount()
          Return the number of "other transactions".
 ParentTxn getParentTxn()
          Get the ParentTxn of this transfer.
 SplitTxn getSplit(int i)
          Return the split for this transaction at the given index.
 SplitTxn getSplitByID(long id)
          Get the SplitTxn with the given ID or return null if none of the SplitTxns have the given ID.
 int getSplitCount()
          Return the number of splits for this transaction.
 long getTaxDate()
          Deprecated. use getTaxDateInt() instead
 int getTaxDateInt()
          Return the tax date encoded as an integer with decimal form YYYYMMDD
 java.lang.String getTransferType()
          Get the type of transfer.
 long getValue()
          Get the value of this transaction in the currency assigned to the account that is associated with this transaction.
 int indexOfSplit(SplitTxn sTxn)
          Get the index of the specified split, or -1 if the split is not associated with this transaction.
 boolean isTransferTo(Account acct)
          Check whether or not this transaction includes a transfer to the given account.
 boolean removeSplit(int sTxnIdx)
          Remove the split at the specified index.
 boolean removeSplit(SplitTxn sTxn)
          Remove the specified split.
 void setAddress(AddressBook.AddressEntry newAddress)
          This method is only to receive addresses already added to the address book.
 void setCheckNumber(java.lang.String newCheckNumber)
          Set the check number associated with this transaction.
 void setDate(long newDate)
          Deprecated. use setDateInt(int) instead
 void setDateEntered(long newDateEntered)
          Set the date that this transaction was entered.
 void setDateInt(int newDate)
          Set the date (encoded as an int with decimal form YYYYMMDD) associated with this transaction.
 void setMemo(java.lang.String newMemo)
          Set the memo associated with this transaction.
 void setTaxDate(long newDate)
          Deprecated. use setTaxDateInt(int) instead
 void setTaxDateInt(int newDate)
          Set the tax date (encoded as an int with decimal form YYYYMMDD) associated with this transaction.
 void setTransferType(java.lang.String type)
          Set the type of transfer.
 void takeValuesFrom(ParentTxn otherTxn)
          Copy all of the values from the given transaction into this transaction
 java.lang.String toMultilineString()
           
 java.lang.String toString()
           
 
Methods inherited from class com.moneydance.apps.md.model.AbstractTxn
getAccount, getCheckNumAsInt, getDescription, getFIID, getFiTxnId, getStatus, getStatusChar, getTag, getTag, getTags, getTxnId, isDirty, isNew, needsToBePrinted, removeTag, resetDirty, setAccount, setDescription, setDirty, setFIID, setFiTxnId, setIsNew, setStatus, setTag, setTags, wasDownloaded
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParentTxn

public ParentTxn(long date,
                 long taxDate,
                 long dateEntered,
                 java.lang.String checkNumber,
                 Account account,
                 java.lang.String description,
                 java.lang.String memo,
                 long id,
                 byte status)
Deprecated. Please use the constructor with int date parameters.

Construct a parent transaction, with the given date, entry date, check number, account, description, tranasaction ID, and status


ParentTxn

public ParentTxn(int date,
                 int taxDate,
                 long dateEntered,
                 java.lang.String checkNumber,
                 Account account,
                 java.lang.String description,
                 java.lang.String memo,
                 long id,
                 byte status)
Constructor as of build 350. Constructs a ParentTxn object to which SplitTxn objects can be added, removed, or modified in order to add or remove value to the given account. The date and taxDate parameters are integers with the year, month, and day encoded in the decimal form YYYYMMDD.

Since:
build 350;
Method Detail

getDate

public final long getDate()
Deprecated. use getDateInt() instead

Get the date associated with this transaction.

Specified by:
getDate in class AbstractTxn

getDateInt

public final int getDateInt()
Return the date encoded as an integer with decimal form YYYYMMDD

Specified by:
getDateInt in interface Txn
Specified by:
getDateInt in class AbstractTxn

setDate

public final void setDate(long newDate)
Deprecated. use setDateInt(int) instead

Set the date associated with this transaction.


setDateInt

public final void setDateInt(int newDate)
Set the date (encoded as an int with decimal form YYYYMMDD) associated with this transaction.


getTaxDate

public final long getTaxDate()
Deprecated. use getTaxDateInt() instead

Get the tax date associated with this transaction.

Specified by:
getTaxDate in class AbstractTxn

getTaxDateInt

public final int getTaxDateInt()
Return the tax date encoded as an integer with decimal form YYYYMMDD

Specified by:
getTaxDateInt in interface Txn
Specified by:
getTaxDateInt in class AbstractTxn

setTaxDate

public final void setTaxDate(long newDate)
Deprecated. use setTaxDateInt(int) instead

Set the tax date associated with this transaction.


setTaxDateInt

public final void setTaxDateInt(int newDate)
Set the tax date (encoded as an int with decimal form YYYYMMDD) associated with this transaction.


clearTags

public final void clearTags()
Remove all the tags associated with this transaction, and any of its splits.


getAddress

public AddressBook.AddressEntry getAddress()
Returns the address book entry (if any) that is associated with this transaction.


setAddress

public void setAddress(AddressBook.AddressEntry newAddress)
This method is only to receive addresses already added to the address book.


getDateEntered

public final long getDateEntered()
Get the date that this transaction was entered.

Specified by:
getDateEntered in interface Txn
Specified by:
getDateEntered in class AbstractTxn

setDateEntered

public final void setDateEntered(long newDateEntered)
Set the date that this transaction was entered.


getOtherTxnCount

public final int getOtherTxnCount()
Return the number of "other transactions".

Specified by:
getOtherTxnCount in interface Txn
Specified by:
getOtherTxnCount in class AbstractTxn

getParentTxn

public final ParentTxn getParentTxn()
Get the ParentTxn of this transfer.

Specified by:
getParentTxn in interface Txn
Specified by:
getParentTxn in class AbstractTxn

getOtherTxn

public final AbstractTxn getOtherTxn(int i)
Return the "other transaction" at the specified index.

Specified by:
getOtherTxn in interface Txn
Specified by:
getOtherTxn in class AbstractTxn

isTransferTo

public final boolean isTransferTo(Account acct)
Check whether or not this transaction includes a transfer to the given account.

Specified by:
isTransferTo in interface Txn
Specified by:
isTransferTo in class AbstractTxn

getValue

public final long getValue()
Get the value of this transaction in the currency assigned to the account that is associated with this transaction.

Specified by:
getValue in interface Txn
Specified by:
getValue in class AbstractTxn

getCheckNumber

public final java.lang.String getCheckNumber()
Get the check number associated with this transaction.

Specified by:
getCheckNumber in interface Txn
Specified by:
getCheckNumber in class AbstractTxn

setCheckNumber

public final void setCheckNumber(java.lang.String newCheckNumber)
Set the check number associated with this transaction.


getMemo

public final java.lang.String getMemo()
Get the memo associated with this transaction.


setMemo

public final void setMemo(java.lang.String newMemo)
Set the memo associated with this transaction.


getTransferType

public final java.lang.String getTransferType()
Get the type of transfer. Usually only used in the investment register to differentiate between buy, sell, and stock split transfers.

Specified by:
getTransferType in interface Txn
Specified by:
getTransferType in class AbstractTxn

setTransferType

public final void setTransferType(java.lang.String type)
Set the type of transfer. Usually only used in the investment register to differentiate between buy, sell, and stock split transactions.


addSplit

public final void addSplit(SplitTxn newSplit)
Add a "split" to this transaction. This should only be called from the TransactionSet, and when reading transactions from a file or database


getSplit

public final SplitTxn getSplit(int i)
Return the split for this transaction at the given index.


getSplitCount

public final int getSplitCount()
Return the number of splits for this transaction.


removeSplit

public final boolean removeSplit(int sTxnIdx)
Remove the split at the specified index.


removeSplit

public final boolean removeSplit(SplitTxn sTxn)
Remove the specified split.


indexOfSplit

public final int indexOfSplit(SplitTxn sTxn)
Get the index of the specified split, or -1 if the split is not associated with this transaction.


getSplitByID

public final SplitTxn getSplitByID(long id)
Get the SplitTxn with the given ID or return null if none of the SplitTxns have the given ID.


duplicate

public final ParentTxn duplicate()
Clone this transaction and all of its splits. This should only be used for temporarily maintaining a copy of this transaction and copying this transaction to another data file. Warning: Do *not* add this duplicate transaction back to the TransactionSet because it may cause all sorts of nasty problems.


takeValuesFrom

public final void takeValuesFrom(ParentTxn otherTxn)
Copy all of the values from the given transaction into this transaction


createNew

public final ParentTxn createNew()
Create a new transaction with all of the same fields as this transaction. but with a txn ID of -1 so that the transaction can be added back to the transaction set as a copy of this one.


toMultilineString

public java.lang.String toMultilineString()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object