Class ParentTxn

  • All Implemented Interfaces:
    Txn, com.infinitekind.tiksync.SyncableItem

    public final class ParentTxn
    extends AbstractTxn
    implements com.infinitekind.tiksync.SyncableItem
    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 Detail

      • SYNCABLE_TYPE_VALUE

        public static final java.lang.String SYNCABLE_TYPE_VALUE
        See Also:
        Constant Field Values
    • Constructor Detail

    • Method Detail

      • itemWasUpdated

        public void itemWasUpdated()
        Description copied from class: MoneydanceSyncableItem
        This 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:
        itemWasUpdated in class AbstractTxn
      • itemWillSync

        public void itemWillSync()
        Description copied from class: MoneydanceSyncableItem
        This 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:
        itemWillSync in class AbstractTxn
      • getSyncItemType

        public final java.lang.String getSyncItemType()
        Description copied from class: MoneydanceSyncableItem
        Subclasses should override this to return a static string identifying their type of object
        Specified by:
        getSyncItemType in interface com.infinitekind.tiksync.SyncableItem
        Overrides:
        getSyncItemType in class MoneydanceSyncableItem
      • 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
      • setDateInt

        public final void setDateInt​(int newDate)
        Set the date (encoded as an int with decimal form YYYYMMDD) associated with this transaction.
      • 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
      • setTaxDateInt

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

        public final void setDateEntered​(long newDateEntered)
        Set the date that this transaction was entered.
      • 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
      • isDirty

        public boolean isDirty()
        Returns true if this transaction has been modified since it was last saved.
        Overrides:
        isDirty 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)
        Deprecated.
        please use set/getInvestTxnType()
        Set the type of transfer. Usually only used in the investment register to differentiate between buy, sell, and stock split transactions.
      • getInvestTxnType

        public InvestTxnType getInvestTxnType()
        Return the type of transaction (buy, sell, transfer, dividend, bank/transfer, etc)
        Returns:
        The investment transaction type for this transaction
        Since:
        Moneydance 2017.7 build 1662
      • setInvestTxnType

        public void setInvestTxnType​(InvestTxnType txnType)
        Set the transaction type (buy, sell, dividend, bank, etc) for this transaction
        Since:
        Moneydance 2017.7 build 1662
      • 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 splitToRemove)
        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.
      • 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.
        Overrides:
        duplicate in class MoneydanceSyncableItem
      • duplicateAsNew

        public final ParentTxn duplicateAsNew()
        Create a new transaction with all of the same core 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
      • makeParentTxn

        public static ParentTxn makeParentTxn​(AccountBook book,
                                              int date,
                                              int taxDate,
                                              long dateEntered,
                                              java.lang.String checkNumber,
                                              Account account,
                                              java.lang.String description,
                                              java.lang.String memo,
                                              long id,
                                              byte status)
        Shortcut to create a ParentTxn object.