Class AbstractTxn
java.lang.Object
com.infinitekind.moneydance.model.MoneydanceSyncableItem
com.infinitekind.moneydance.model.AbstractTxn
- All Implemented Interfaces:
Txn,com.infinitekind.tiksync.SyncableItem
public abstract class AbstractTxn extends MoneydanceSyncableItem implements Txn
This is the base class for all types of transactions. Each
transaction is assigned to one account and has an amount that
adds to, or subtracts from the value of the account. Each
transaction can also have an associated set of 'tags'. Tags
are arbitrary key-value pairs of String objects. Typically
a transaction will have two sides 1) a "parent" transaction,
and 2) one or more "split" transactions. The value of the
parent transaction is defined by the sum of the values of
the split transactions (possibly adjusted by the rate
of each of the split transactions).
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractTxn.ClearedStatus -
Field Summary
Fields Modifier and Type Field Description static intBANK_TRANSACTION_TYPEstatic java.lang.StringPRINT_CHECKNUM_PREFIXstatic java.lang.StringPRINT_CHECKNUM_SUFFIXstatic intSPLIT_TRANSACTION_TYPEstatic byteSTATUS_CLEAREDstatic byteSTATUS_RECONCILINGstatic byteSTATUS_UNRECONCILEDprotected java.lang.StringsyncIDstatic java.lang.StringTAG_FI_IDstatic java.lang.StringTAG_FITID_PREFIXstatic java.lang.StringTAG_INVST_SPLIT_EXPstatic java.lang.StringTAG_INVST_SPLIT_FEEstatic java.lang.StringTAG_INVST_SPLIT_INCstatic java.lang.StringTAG_INVST_SPLIT_SECstatic java.lang.StringTAG_INVST_SPLIT_TYPEstatic java.lang.StringTAG_INVST_SPLIT_XFRstatic java.lang.StringTAG_INVST_TXN_TYPEstatic java.lang.StringTAG_IS_NEW_TXNstatic java.lang.StringTAG_ONLINE_PMT_IDstatic java.lang.StringTAG_QIF_IMPORT_SESSIONstatic java.lang.StringTAG_QIF_INVST_ACTIONstatic java.lang.StringTAG_RECON_ASOFDTstatic java.lang.StringTAG_RECON_DATEstatic java.lang.StringTAG_SPLIT_ADDEDstatic java.lang.StringTAG_SPLIT_AMOUNTstatic java.lang.StringTAG_SPLIT_CALCstatic java.lang.StringTAG_SPLIT_PAIRstatic java.lang.StringTRANSFER_TYPE_BANKstatic java.lang.StringTRANSFER_TYPE_BUYSELLstatic java.lang.StringTRANSFER_TYPE_BUYSELLXFRstatic java.lang.StringTRANSFER_TYPE_DIVIDENDstatic java.lang.StringTRANSFER_TYPE_DIVIDENDXFRstatic java.lang.StringTRANSFER_TYPE_MISCINCEXPstatic java.lang.StringTRANSFER_TYPE_SHORTCOVERFields inherited from class com.infinitekind.moneydance.model.MoneydanceSyncableItem
book, info, SECURITY_SUBTYPES_ITEM_TYPE -
Constructor Summary
Constructors Constructor Description AbstractTxn(AccountBook book)Construct a transaction with the given account, description, transaction ID (-1 for a new transaction) and status. -
Method Summary
Modifier and Type Method Description protected booleanautoSyncsChanges()transactions are explicitly updated when recording a transactionAccountgetAccount()Get the account associated with this transaction.AddressBookEntrygetAddress()Returns the address book entry (if any) that is associated with this transaction.java.util.List<java.lang.String>getAttachmentKeys()Return a list of tag names for attachments to this objectjava.lang.StringgetAttachmentTag(java.lang.String tagName)Return the storage location, if any, that is associated with the given tag name.intgetCheckNumAsInt()Get the check number as an integer (returns 0 if it's not an integer)longgetCheckNumAsLong()Get the check number as a long (returns 0 if it's not an integer value)abstract java.lang.StringgetCheckNumber()Get the checknumber associated with this transaction.AbstractTxn.ClearedStatusgetClearedStatus()Get the status associated with this transaction.abstract longgetDateEntered()Get the date that this transaction was entered.abstract intgetDateInt()Get the date of this transactionintgetDatePostedOnline()Return the date that this transaction was posted or cleared with the bank, if available, from the online information.java.lang.StringgetDescription()Get the description associated with this transaction.java.lang.StringgetFIID()Returns the identifier for the financial institution from which this transaction was downloaded, or null if no financial institution information has been provided.java.lang.StringgetFiTxnId(int protocolId)Return the ID that the financial institution uses to identify this transaction.longgetOldTxnID()OnlineTxngetOriginalOnlineTxn()Return a copy of the OnlineTxn that was used to record a local transaction, if any.abstract AbstractTxngetOtherTxn(int i)Get the transaction that make up the other side of this transaction at the specified index.abstract intgetOtherTxnCount()Get the number of transactions from the "other side" of this transaction.abstract ParentTxngetParentTxn()Get the ParentTxn of this transfer.bytegetStatus()Get the status associated with this transaction.chargetStatusChar()Get a character that indicates the status of this transactioncom.infinitekind.tiksync.SyncRecordgetTags()abstract intgetTaxDateInt()Get the date of this transaction for tax purposes.abstract java.lang.StringgetTransferType()Get the type of transaction.abstract longgetValue()Get the value of this transaction, in the currency assigned to the account for this transaction.booleanhasAttachments()Return true if if this transaction has any attachmentsbooleanisDirty()Returns true if this transaction has been modified since it was last saved.booleanisNew()Returns whether or not this transaction should be considered "unread" since having been downloadedabstract booleanisTransferTo(Account acct)Check whether or not this transaction includes a transfer to the given account.protected voiditemWasUpdated()This is called after an item is updated by calling itemWasUpdated(SyncRecord).protected voiditemWillSync()This is called just before an item will be stored and/or synced when itemWillSync(SyncRecord) is called.voidloadFromStorage(java.util.Map<java.lang.String,java.lang.String> newTags)Set the TagSet associated with this object.booleanneedsToBePrinted()Returns true if this transaction has been marked as to-be-printed.voidremoveAttachmentTag(java.lang.String tagName)Remove the specified attachment tag, along with the file that it containsvoidresetDirty()Mark this transaction as unmodified.voidsetAccount(Account newAccount)Set the account associated with this transaction.voidsetAttachmentTag(java.lang.String tagName, java.io.File file)Set the file that is associated with the given tag name, copying the file into the data set's internal storage.voidsetClearedStatus(AbstractTxn.ClearedStatus newStatus)Set the status associated with this transaction.voidsetDescription(java.lang.String newDescription)Set the description associated with this transaction.voidsetDirty()Mark this transaction as modified, and needing to be saved.voidsetFIID(java.lang.String fiID)Sets the identifier for the financial institution from which this transaction was downloaded.voidsetFiTxnId(int protocolId, java.lang.String fitid)Set the ID that the financial institution uses to identify this transaction.voidsetIsNew(boolean isNew)Sets whether or not this transaction should be considered "unread" since having been downloadedvoidsetOriginalOnlineTxn(OnlineTxn onlineTxn)Set the online transaction information as received from the bank's online interface, or null to clear the online information for this transaction.voidsetStatus(byte newStatusByte)Set the status associated with this transaction.booleanwasDownloaded()Return true iff this transaction has a FI transaction ID associated with it.Methods inherited from class com.infinitekind.moneydance.model.MoneydanceSyncableItem
addParameters, addTags, decodeKeywordList, deleteItem, doesParameterExist, duplicate, encodeKeywordList, equals, getAccountParameter, getAddressParameter, getBook, getBooleanParameter, getCurrencyParameter, getCurrencyParameter, getCurrencyParameter, getDoubleParameter, getIntParameter, getKeywords, getLongParameter, getOriginalItem, getParameter, getParameter, getParameterCount, getParameterKeys, getPreference, getPreferenceBoolean, getPreferenceDouble, getPreferenceInt, getPreferenceIntArray, getPreferenceLong, getPreferenceStringList, getPreferenceSublist, getPreferenceSubset, getStringListParameter, getSyncInfo, getSyncItemType, getSyncTimestamp, getUUID, hasBeenSynced, hashCode, hasKeywordSubstring, initialize, isInEditingMode, isSyncable, itemWasUpdated, itemWillSync, makeSyncableItem, removeParameter, setAccountParameter, setAddress, setAddressParameter, setCurrencyParameter, setCurrencyParameter, setCurrencyParameter, setEditingMode, setKeywords, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameterNoNotify, setPreference, setPreference, setPreference, syncItemMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.infinitekind.moneydance.model.Txn
getKeywords, getParameter, getParameter
-
Field Details
-
PRINT_CHECKNUM_PREFIX
public static final java.lang.String PRINT_CHECKNUM_PREFIX- See Also:
- Constant Field Values
-
PRINT_CHECKNUM_SUFFIX
public static final java.lang.String PRINT_CHECKNUM_SUFFIX- See Also:
- Constant Field Values
-
STATUS_CLEARED
public static final byte STATUS_CLEARED- See Also:
- Constant Field Values
-
STATUS_RECONCILING
public static final byte STATUS_RECONCILING- See Also:
- Constant Field Values
-
STATUS_UNRECONCILED
public static final byte STATUS_UNRECONCILED- See Also:
- Constant Field Values
-
BANK_TRANSACTION_TYPE
public static final int BANK_TRANSACTION_TYPE- See Also:
- Constant Field Values
-
SPLIT_TRANSACTION_TYPE
public static final int SPLIT_TRANSACTION_TYPE- See Also:
- Constant Field Values
-
TRANSFER_TYPE_BANK
public static final java.lang.String TRANSFER_TYPE_BANK- See Also:
- Constant Field Values
-
TRANSFER_TYPE_BUYSELL
public static final java.lang.String TRANSFER_TYPE_BUYSELL- See Also:
- Constant Field Values
-
TRANSFER_TYPE_SHORTCOVER
public static final java.lang.String TRANSFER_TYPE_SHORTCOVER- See Also:
- Constant Field Values
-
TRANSFER_TYPE_BUYSELLXFR
public static final java.lang.String TRANSFER_TYPE_BUYSELLXFR- See Also:
- Constant Field Values
-
TRANSFER_TYPE_DIVIDEND
public static final java.lang.String TRANSFER_TYPE_DIVIDEND- See Also:
- Constant Field Values
-
TRANSFER_TYPE_DIVIDENDXFR
public static final java.lang.String TRANSFER_TYPE_DIVIDENDXFR- See Also:
- Constant Field Values
-
TRANSFER_TYPE_MISCINCEXP
public static final java.lang.String TRANSFER_TYPE_MISCINCEXP- See Also:
- Constant Field Values
-
TAG_INVST_TXN_TYPE
public static final java.lang.String TAG_INVST_TXN_TYPE- See Also:
- Constant Field Values
-
TAG_FITID_PREFIX
public static final java.lang.String TAG_FITID_PREFIX- See Also:
- Constant Field Values
-
TAG_FI_ID
public static final java.lang.String TAG_FI_ID- See Also:
- Constant Field Values
-
TAG_ONLINE_PMT_ID
public static final java.lang.String TAG_ONLINE_PMT_ID- See Also:
- Constant Field Values
-
TAG_QIF_IMPORT_SESSION
public static final java.lang.String TAG_QIF_IMPORT_SESSION- See Also:
- Constant Field Values
-
TAG_QIF_INVST_ACTION
public static final java.lang.String TAG_QIF_INVST_ACTION- See Also:
- Constant Field Values
-
TAG_SPLIT_CALC
public static final java.lang.String TAG_SPLIT_CALC- See Also:
- Constant Field Values
-
TAG_SPLIT_ADDED
public static final java.lang.String TAG_SPLIT_ADDED- See Also:
- Constant Field Values
-
TAG_SPLIT_AMOUNT
public static final java.lang.String TAG_SPLIT_AMOUNT- See Also:
- Constant Field Values
-
TAG_SPLIT_PAIR
public static final java.lang.String TAG_SPLIT_PAIR- See Also:
- Constant Field Values
-
TAG_IS_NEW_TXN
public static final java.lang.String TAG_IS_NEW_TXN- See Also:
- Constant Field Values
-
TAG_INVST_SPLIT_TYPE
public static final java.lang.String TAG_INVST_SPLIT_TYPE- See Also:
- Constant Field Values
-
TAG_INVST_SPLIT_FEE
public static final java.lang.String TAG_INVST_SPLIT_FEE- See Also:
- Constant Field Values
-
TAG_INVST_SPLIT_SEC
public static final java.lang.String TAG_INVST_SPLIT_SEC- See Also:
- Constant Field Values
-
TAG_INVST_SPLIT_XFR
public static final java.lang.String TAG_INVST_SPLIT_XFR- See Also:
- Constant Field Values
-
TAG_INVST_SPLIT_EXP
public static final java.lang.String TAG_INVST_SPLIT_EXP- See Also:
- Constant Field Values
-
TAG_INVST_SPLIT_INC
public static final java.lang.String TAG_INVST_SPLIT_INC- See Also:
- Constant Field Values
-
TAG_RECON_DATE
public static final java.lang.String TAG_RECON_DATE- See Also:
- Constant Field Values
-
TAG_RECON_ASOFDT
public static final java.lang.String TAG_RECON_ASOFDT- See Also:
- Constant Field Values
-
syncID
protected java.lang.String syncID
-
-
Constructor Details
-
AbstractTxn
Construct a transaction with the given account, description, transaction ID (-1 for a new transaction) and status.
-
-
Method Details
-
itemWasUpdated
protected void itemWasUpdated()Description copied from class:MoneydanceSyncableItemThis is called after an item is updated by calling itemWasUpdated(SyncRecord). This can occur from the syncing process or from being loaded locally. Override this method to be notified.- Overrides:
itemWasUpdatedin classMoneydanceSyncableItem
-
itemWillSync
protected void itemWillSync()Description copied from class:MoneydanceSyncableItemThis is called just before an item will be stored and/or synced when itemWillSync(SyncRecord) is called. Override this method to be notified or if you'd like to store anything into the info record to be synced.- Overrides:
itemWillSyncin classMoneydanceSyncableItem
-
autoSyncsChanges
protected boolean autoSyncsChanges()transactions are explicitly updated when recording a transaction- Overrides:
autoSyncsChangesin classMoneydanceSyncableItem
-
getOldTxnID
public long getOldTxnID() -
getDateEntered
public abstract long getDateEntered()Get the date that this transaction was entered.- Specified by:
getDateEnteredin interfaceTxn
-
getDateInt
public abstract int getDateInt()Get the date of this transaction- Specified by:
getDateIntin interfaceTxn
-
getTaxDateInt
public abstract int getTaxDateInt()Get the date of this transaction for tax purposes.- Specified by:
getTaxDateIntin interfaceTxn
-
getValue
public abstract long getValue()Get the value of this transaction, in the currency assigned to the account for this transaction. -
getParentTxn
Get the ParentTxn of this transfer.- Specified by:
getParentTxnin interfaceTxn
-
getOtherTxnCount
public abstract int getOtherTxnCount()Get the number of transactions from the "other side" of this transaction. For splits, this will always be 1. For ParentTxns, this will be the number of splits.- Specified by:
getOtherTxnCountin interfaceTxn
-
getOtherTxn
Get the transaction that make up the other side of this transaction at the specified index. For SplitTxns, this index should always be 0 because there is only one "other transaction". for ParentTxns, this will return the split at the specified index.- Specified by:
getOtherTxnin interfaceTxn
-
isTransferTo
Check whether or not this transaction includes a transfer to the given account.- Specified by:
isTransferToin interfaceTxn
-
getTransferType
public abstract java.lang.String getTransferType()Get the type of transaction. Usually only used in the investment register to differentiate between buy, sell, and stock split transactions.- Specified by:
getTransferTypein interfaceTxn
-
getAccount
Get the account associated with this transaction.- Specified by:
getAccountin interfaceTxn
-
setAccount
Set the account associated with this transaction. -
getDescription
public final java.lang.String getDescription()Get the description associated with this transaction.- Specified by:
getDescriptionin interfaceTxn
-
setDescription
public final void setDescription(java.lang.String newDescription)Set the description associated with this transaction. -
getStatusChar
public final char getStatusChar()Get a character that indicates the status of this transaction- Specified by:
getStatusCharin interfaceTxn
-
getStatus
public final byte getStatus()Get the status associated with this transaction. -
getClearedStatus
Description copied from interface:TxnGet the status associated with this transaction.- Specified by:
getClearedStatusin interfaceTxn
-
setClearedStatus
Set the status associated with this transaction.- Specified by:
setClearedStatusin interfaceTxn
-
setStatus
public final void setStatus(byte newStatusByte)Set the status associated with this transaction. -
getCheckNumber
public abstract java.lang.String getCheckNumber()Get the checknumber associated with this transaction.- Specified by:
getCheckNumberin interfaceTxn
-
getCheckNumAsInt
public int getCheckNumAsInt()Get the check number as an integer (returns 0 if it's not an integer)- Specified by:
getCheckNumAsIntin interfaceTxn
-
getCheckNumAsLong
public long getCheckNumAsLong()Get the check number as a long (returns 0 if it's not an integer value) -
getFiTxnId
public final java.lang.String getFiTxnId(int protocolId)Return the ID that the financial institution uses to identify this transaction. Specific to the protocolId which is defined in OnlineTxn. -
setFiTxnId
public final void setFiTxnId(int protocolId, java.lang.String fitid)Set the ID that the financial institution uses to identify this transaction. The TID is specific to the protocol type which is defined in OnlineTxn. -
getFIID
public final java.lang.String getFIID()Returns the identifier for the financial institution from which this transaction was downloaded, or null if no financial institution information has been provided. -
setFIID
public final void setFIID(java.lang.String fiID)Sets the identifier for the financial institution from which this transaction was downloaded. If null is provided then the FI ID is removed from this tranaction. -
wasDownloaded
public final boolean wasDownloaded()Return true iff this transaction has a FI transaction ID associated with it. This method is only avaialable as of build 551 -
isNew
public boolean isNew()Returns whether or not this transaction should be considered "unread" since having been downloaded -
setIsNew
public void setIsNew(boolean isNew)Sets whether or not this transaction should be considered "unread" since having been downloaded -
isDirty
public boolean isDirty()Returns true if this transaction has been modified since it was last saved. -
setDirty
public final void setDirty()Mark this transaction as modified, and needing to be saved.- Overrides:
setDirtyin classMoneydanceSyncableItem
-
resetDirty
public final void resetDirty()Mark this transaction as unmodified. This should be called only after being saved. -
getTags
public final com.infinitekind.tiksync.SyncRecord getTags() -
loadFromStorage
public final void loadFromStorage(java.util.Map<java.lang.String,java.lang.String> newTags)Set the TagSet associated with this object. This should only be called when initially constructing this object by the system. In other words, DON'T USE THIS! -
getAddress
Returns the address book entry (if any) that is associated with this transaction.- Overrides:
getAddressin classMoneydanceSyncableItem
-
needsToBePrinted
public final boolean needsToBePrinted()Returns true if this transaction has been marked as to-be-printed. -
getAttachmentTag
public java.lang.String getAttachmentTag(java.lang.String tagName)Return the storage location, if any, that is associated with the given tag name. The resulting file can be retrieved by calling one of the file reading methods on the account book's local storage interface: InputStream attachmentIn = transaction.getBook().getLocalStorage().openFileForReading(transaction.getAttachmentTag(tagName)); -
setAttachmentTag
public void setAttachmentTag(java.lang.String tagName, java.io.File file) throws java.lang.ExceptionSet the file that is associated with the given tag name, copying the file into the data set's internal storage.- Throws:
java.lang.Exception
-
removeAttachmentTag
public void removeAttachmentTag(java.lang.String tagName)Remove the specified attachment tag, along with the file that it contains -
hasAttachments
public boolean hasAttachments()Return true if if this transaction has any attachments -
getAttachmentKeys
public java.util.List<java.lang.String> getAttachmentKeys()Return a list of tag names for attachments to this object -
getOriginalOnlineTxn
Return a copy of the OnlineTxn that was used to record a local transaction, if any. The OnlineTxn will contain information such as the date the transaction was posted as well as the original description and memo fields as downloaded from the bank.- Since:
- Moneydance build 1525 (v2017)
-
setOriginalOnlineTxn
Set the online transaction information as received from the bank's online interface, or null to clear the online information for this transaction.- Since:
- Moneydance build 1525 (v2017)
-
getDatePostedOnline
public int getDatePostedOnline()Return the date that this transaction was posted or cleared with the bank, if available, from the online information. If no online information is available for this transaction then this returns the results of getDateInt().- Since:
- Moneydance build 1525 (v2017)
-