jgnash.engine
Class InvestmentTransaction

java.lang.Object
  extended by jgnash.engine.StoredObject
      extended by jgnash.engine.Transaction
          extended by jgnash.engine.InvestmentTransaction
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Transaction>

public class InvestmentTransaction
extends Transaction

Class for investment transactions.

All TransactionEntry(s) must be of the same security

Version:
$Id$
Author:
Craig Cavanaugh
See Also:
Serialized Form

Field Summary
private static long serialVersionUID
           
 
Fields inherited from class jgnash.engine.Transaction
transactionEntries
 
Constructor Summary
InvestmentTransaction()
           
 
Method Summary
 void addTransactionEntry(TransactionEntry entry)
          Returns the balance of the transaction amount with respect to the supplied account.
 java.math.BigDecimal getFees()
          Sum transaction fees
(package private)  java.math.BigDecimal getFees(Account account)
          Sum transaction fees
 Account getInvestmentAccount()
           
 java.util.List<TransactionEntry> getInvestmentFeeEntries()
          Get a list of transaction entries tagged as investment fees
 java.util.List<TransactionEntry> getInvestmentGainLossEntries()
          Get a list of transaction entries tagged as gains and loss
 java.math.BigDecimal getMarketValue(java.math.BigDecimal sharePrice)
          Return the market value of the transaction based on the supplied share price
 java.math.BigDecimal getMarketValue(java.util.Date date)
          Return the market value of the transaction based on the latest share price
 java.math.BigDecimal getPrice()
          Returns the price per share
 java.math.BigDecimal getQuantity()
          Returns the number of shares assigned to this transaction.
 SecurityNode getSecurityNode()
           
(package private)  java.math.BigDecimal getSignedQuantity()
          Returns the number of shares assigned to this transaction.
 java.math.BigDecimal getTotal(Account account)
          Calculates the total of the value of the shares, gains, fees, etc.
 TransactionType getTransactionType()
           
 
Methods inherited from class jgnash.engine.Transaction
addTransactionEntries, clone, compareTo, equalsIgnoreDate, getAccounts, getAmount, getCommonAccount, getDate, getDateEntered, getFitid, getLock, getMemo, getNumber, getPayee, getReconciled, getTransactionEntries, getTransactionEntriesByTag, readResolve, removeTransactionEntry, setDate, setDateEntered, setFitid, setMemo, setNumber, setPayee, setReconciled, setReconciled, size, toString
 
Methods inherited from class jgnash.engine.StoredObject
equals, getUuid, hashCode, isMarkedForRemoval, setMarkedForRemoval
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

InvestmentTransaction

public InvestmentTransaction()
Method Detail

getTransactionType

public TransactionType getTransactionType()
Overrides:
getTransactionType in class Transaction

getInvestmentAccount

public Account getInvestmentAccount()

addTransactionEntry

public void addTransactionEntry(TransactionEntry entry)
Description copied from class: Transaction
Returns the balance of the transaction amount with respect to the supplied account. Value will be positive or negative depending if the transaction debits or credits the account.

Overrides:
addTransactionEntry in class Transaction
Parameters:
entry - new TransactionEntry to add
See Also:
TransactionEntry

getPrice

public java.math.BigDecimal getPrice()
Returns the price per share

Returns:
the price per share

getQuantity

public java.math.BigDecimal getQuantity()
Returns the number of shares assigned to this transaction.

Returns:
the quantity of securities for this transaction
See Also:
getSignedQuantity()

getSignedQuantity

java.math.BigDecimal getSignedQuantity()
Returns the number of shares assigned to this transaction.

Returns:
the quantity of securities for this transaction
See Also:
getSignedQuantity()

getSecurityNode

public SecurityNode getSecurityNode()

getFees

public java.math.BigDecimal getFees()
Sum transaction fees

Returns:
transaction fees

getFees

java.math.BigDecimal getFees(Account account)
Sum transaction fees

Parameters:
account - account to calculate fees against
Returns:
transaction fees

getInvestmentFeeEntries

public java.util.List<TransactionEntry> getInvestmentFeeEntries()
Get a list of transaction entries tagged as investment fees

Returns:
list of investment fees
See Also:
TransactionTag.INVESTMENT_FEE

getInvestmentGainLossEntries

public java.util.List<TransactionEntry> getInvestmentGainLossEntries()
Get a list of transaction entries tagged as gains and loss

Returns:
list of gains and loss entries
See Also:
TransactionTag.GAIN_LOSS

getMarketValue

public java.math.BigDecimal getMarketValue(java.math.BigDecimal sharePrice)
Return the market value of the transaction based on the supplied share price

Parameters:
sharePrice - share price
Returns:
the value of this transaction

getMarketValue

public java.math.BigDecimal getMarketValue(java.util.Date date)
Return the market value of the transaction based on the latest share price

Parameters:
date - Date to base market value against
Returns:
the value of this transaction

getTotal

public java.math.BigDecimal getTotal(Account account)
Calculates the total of the value of the shares, gains, fees, etc. as it pertains to an account.

Not intended for use to calculate account balances

Parameters:
account - The Account to calculate the total against
Returns:
total resulting total for this transaction
See Also:
AbstractInvestmentTransactionEntry.getTotal()