|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjgnash.engine.StoredObject
jgnash.engine.Account
public class Account
Abstract Account class
| Field Summary | |
|---|---|
private java.math.BigDecimal |
accountBalance
Balance of the account |
private java.lang.String |
accountNumber
User definable account number |
private java.lang.String |
accountType
|
private java.lang.String |
bankId
User definable bank id. |
private AccountType |
cachedAccountType
|
private java.util.concurrent.locks.ReadWriteLock |
childLock
|
private java.util.List<Account> |
children
|
private CurrencyNode |
currencyNode
CurrencyNode for this account |
private java.lang.String |
description
|
private boolean |
locked
|
private static java.util.logging.Logger |
logger
|
private java.lang.String |
name
|
private java.lang.String |
notes
|
(package private) Account |
parentAccount
|
private boolean |
placeHolder
|
private java.util.Map<java.lang.String,java.lang.Object> |
propertyMap
|
private AccountProxy |
proxy
|
private java.math.BigDecimal |
reconciledBalance
Reconciled balance of the account |
(package private) java.util.List<SecurityNode> |
securities
|
private static long |
serialVersionUID
|
private java.util.concurrent.locks.ReadWriteLock |
transactionLock
|
(package private) java.util.List<Transaction> |
transactions
|
private boolean |
visible
|
| Constructor Summary | |
|---|---|
Account()
No argument public constructor for reflection purposes. |
|
Account(AccountType type,
CurrencyNode node)
|
|
| Method Summary | |
|---|---|
protected boolean |
addChild(Account child)
Add account child account given it's reference |
boolean |
addSecurity(SecurityNode node)
Adds account commodity to the list and ensures duplicates are not added. |
(package private) boolean |
addTransaction(Transaction tran)
Adds account transaction in chronological order |
private java.math.BigDecimal |
adjustForExchangeRate(java.math.BigDecimal amount,
CurrencyNode node)
|
(package private) void |
clearCachedBalances()
Clear cached account balances so they will be recalculated |
java.lang.Object |
clone()
When overridden, this should return account shallow copy only. |
int |
compareTo(Account acc)
Compares two Account for ordering. |
boolean |
contains(Account account)
Determine if the supplied account is a child of this account |
boolean |
contains(Transaction tran)
Determines if the specified transaction is attach to this account |
boolean |
containsSecurity(SecurityNode node)
|
boolean |
equals(java.lang.Object other)
Default equals override |
java.lang.String |
getAccountNumber()
Returns the account number. |
private static java.lang.String |
getAccountSeparator()
|
AccountType |
getAccountType()
|
java.math.BigDecimal |
getBalance()
The account balance is cached to improve performance and reduce thrashing of the GC system. |
private java.math.BigDecimal |
getBalance(CurrencyNode node)
The account balance is cached to improve performance and reduce thrashing of the GC system. |
java.math.BigDecimal |
getBalance(java.util.Date date)
Returns the account balance up to and inclusive of the supplied date |
java.math.BigDecimal |
getBalance(java.util.Date date,
CurrencyNode node)
Returns the account balance up to and inclusive of the supplied date. |
java.math.BigDecimal |
getBalance(java.util.Date start,
java.util.Date end)
Returns the balance of the transactions inclusive of the start and end dates. |
java.math.BigDecimal |
getBalance(java.util.Date startDate,
java.util.Date endDate,
CurrencyNode node)
Returns the account balance up to and inclusive of the supplied date. |
java.math.BigDecimal |
getBalanceAt(int index)
Get the account balance up to account specified index. |
java.lang.String |
getBankId()
|
java.math.BigDecimal |
getCashBalance()
Returns the cash balance of this account |
int |
getChildCount()
Returns the number of children this account has |
java.util.List<Account> |
getChildren()
Returns account list of the children |
CurrencyNode |
getCurrencyNode()
Returns the commodity node for this account. |
int |
getDepth()
|
java.lang.String |
getDescription()
|
java.util.Date |
getFirstUnreconciledTransactionDate()
Returns the date of the first unreconciled transaction |
java.math.BigDecimal |
getMarketValue()
Returns the market value of this account |
java.lang.String |
getName()
|
java.lang.String |
getNextTransactionNumber()
Searches through the transactions and determines the next largest transaction number. |
java.lang.String |
getNotes()
Returns the notes for this account |
java.math.BigDecimal |
getOpeningBalanceForReconcile()
Get the default opening balance for reconciling the account |
Account |
getParent()
Returns the parent account. |
java.lang.String |
getPathName()
|
java.util.Set<AccountProperty> |
getProperties()
Returns account Set of AccountProperties added to this account. |
java.lang.Object |
getProperty(AccountProperty key)
Gets an account property |
(package private) AccountProxy |
getProxy()
|
java.math.BigDecimal |
getReconciledBalance()
The reconciled balance is cached to improve performance and reduce thrashing of the GC system. |
private java.math.BigDecimal |
getReconciledBalance(CurrencyNode node)
|
java.math.BigDecimal |
getReconciledTreeBalance()
Returns the reconciled balance of the account plus any child accounts. |
private java.math.BigDecimal |
getReconciledTreeBalance(CurrencyNode node)
Returns the reconciled balance of the account plus any child accounts. |
java.util.Set<SecurityNode> |
getSecurities()
|
Transaction |
getTransactionAt(int index)
Returns the transaction at the specified index |
int |
getTransactionCount()
Returns the number of transactions attached to this account. |
(package private) java.util.concurrent.locks.ReadWriteLock |
getTransactionLock()
|
java.util.List<Transaction> |
getTransactions()
Returns account shallow copy of the transaction array for this account |
java.util.List<Transaction> |
getTransactions(java.util.Date startDate,
java.util.Date endDate)
Returns an array of transactions that occur after account specified cut off date. |
java.math.BigDecimal |
getTreeBalance()
Returns the balance of the account plus any child accounts |
private java.math.BigDecimal |
getTreeBalance(CurrencyNode node)
Returns the balance of the account plus any child accounts. |
java.math.BigDecimal |
getTreeBalance(java.util.Date start,
java.util.Date end)
Returns the the balance of the account plus any child accounts inclusive of the start and end dates. |
java.math.BigDecimal |
getTreeBalance(java.util.Date start,
java.util.Date end,
CurrencyNode node)
Returns the the balance of the account plus any child accounts inclusive of the start and end dates. |
java.util.Set<SecurityNode> |
getUsedSecurities()
Returns a set of used SecurityNodes |
int |
hashCode()
Override hashCode to use uuid |
int |
indexOf(Transaction tran)
Returns the index of the specified Transaction within this Account. |
boolean |
instanceOf(AccountType type)
Shortcut method to check account type |
boolean |
isLocked()
|
boolean |
isParent()
Determines is this account has any child accounts. |
boolean |
isPlaceHolder()
|
boolean |
isVisible()
Returns the visibility of the account |
boolean |
memberOf(AccountGroup group)
Shortcut method to check account group membership |
protected java.lang.Object |
readResolve()
|
(package private) boolean |
removeChild(Account child)
Removes account child account. |
protected boolean |
removeProperty(AccountProperty key)
Remove an AccountProperty from this account |
(package private) boolean |
removeSecurity(SecurityNode node)
Remove a security |
(package private) boolean |
removeTransaction(Transaction tran)
Removes the specified transaction from this account |
void |
setAccountNumber(java.lang.String account)
|
(package private) void |
setAccountType(AccountType type)
|
void |
setBankId(java.lang.String bankId)
|
(package private) void |
setCurrencyNode(CurrencyNode node)
Sets the commodity node for this account. |
void |
setDescription(java.lang.String desc)
|
void |
setLocked(boolean locked)
|
void |
setName(java.lang.String newName)
|
void |
setNotes(java.lang.String notes)
Sets the notes for this account |
boolean |
setParent(Account account)
Sets the parent of this account |
void |
setPlaceHolder(boolean placeHolder)
|
void |
setProperty(AccountProperty key,
java.lang.Object value)
Sets / Adds an AccountProperty |
void |
setVisible(boolean visible)
Changes the visibility of the account |
private void |
sortChildren()
|
java.lang.String |
toString()
|
| Methods inherited from class jgnash.engine.StoredObject |
|---|
getUuid, isMarkedForRemoval, setMarkedForRemoval |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
private java.lang.String accountType
private transient AccountType cachedAccountType
private boolean placeHolder
private boolean locked
Account parentAccount
private boolean visible
private java.lang.String name
private java.lang.String description
private java.lang.String notes
private CurrencyNode currencyNode
private java.util.List<Account> children
java.util.List<Transaction> transactions
java.util.List<SecurityNode> securities
private java.math.BigDecimal accountBalance
private java.math.BigDecimal reconciledBalance
private java.lang.String accountNumber
private java.lang.String bankId
private java.util.Map<java.lang.String,java.lang.Object> propertyMap
private transient java.util.concurrent.locks.ReadWriteLock transactionLock
private transient java.util.concurrent.locks.ReadWriteLock childLock
private transient AccountProxy proxy
private static final java.util.logging.Logger logger
| Constructor Detail |
|---|
public Account()
public Account(AccountType type,
CurrencyNode node)
| Method Detail |
|---|
java.util.concurrent.locks.ReadWriteLock getTransactionLock()
AccountProxy getProxy()
final void setAccountType(AccountType type)
public void setProperty(AccountProperty key,
java.lang.Object value)
key - AccountPropertyvalue - actual object to add or setprotected boolean removeProperty(AccountProperty key)
key - AccountProperty to remove
public java.lang.Object getProperty(AccountProperty key)
key - AccountProperty to get
public java.util.Set<AccountProperty> getProperties()
void clearCachedBalances()
boolean addTransaction(Transaction tran)
tran - the Transaction to be added
boolean removeTransaction(Transaction tran)
tran - the Transaction to be removed
public boolean contains(Transaction tran)
tran - the Transaction to look for
public boolean contains(Account account)
account - to check
public java.util.List<Transaction> getTransactions()
public Transaction getTransactionAt(int index)
throws java.lang.IndexOutOfBoundsException
index - the index of the transaction to return.
java.lang.IndexOutOfBoundsException - if the index is out of boundspublic int getTransactionCount()
public java.lang.String getNextTransactionNumber()
protected boolean addChild(Account child)
child - The child account to add to this account.
boolean removeChild(Account child)
child - The child account to remove.
private void sortChildren()
public java.util.List<Account> getChildren()
public int indexOf(Transaction tran)
tran - the Transaction to look for
public int getChildCount()
public Account getParent()
public boolean setParent(Account account)
account - The new parent account
public boolean isParent()
public java.math.BigDecimal getBalance()
private java.math.BigDecimal getBalance(CurrencyNode node)
node - CurrencyNode to get balance against
public java.math.BigDecimal getBalanceAt(int index)
index - the balance of this account at the specified index.
public java.math.BigDecimal getReconciledBalance()
private java.math.BigDecimal getReconciledBalance(CurrencyNode node)
private java.math.BigDecimal adjustForExchangeRate(java.math.BigDecimal amount,
CurrencyNode node)
public java.util.Date getFirstUnreconciledTransactionDate()
public java.math.BigDecimal getOpeningBalanceForReconcile()
AccountProxy.getOpeningBalanceForReconcile()public java.math.BigDecimal getTreeBalance()
private java.math.BigDecimal getTreeBalance(CurrencyNode node)
node - The commodity to convert balance to
private java.math.BigDecimal getReconciledTreeBalance(CurrencyNode node)
node - The commodity to convert balance to
public java.math.BigDecimal getReconciledTreeBalance()
public java.math.BigDecimal getBalance(java.util.Date start,
java.util.Date end)
start - The inclusive start dateend - The inclusive end date
public java.math.BigDecimal getBalance(java.util.Date startDate,
java.util.Date endDate,
CurrencyNode node)
startDate - start dateendDate - end datenode - The commodity to convert balance to
public java.math.BigDecimal getTreeBalance(java.util.Date start,
java.util.Date end)
start - Start date inclusiveend - End date inclusive
public java.math.BigDecimal getTreeBalance(java.util.Date start,
java.util.Date end,
CurrencyNode node)
start - start dateend - end datenode - CurrencyNode to use for balance
public java.math.BigDecimal getBalance(java.util.Date date)
date - The inclusive ending date
public java.math.BigDecimal getBalance(java.util.Date date,
CurrencyNode node)
node - The commodity to convert balance todate - The inclusive ending date
public java.util.List<Transaction> getTransactions(java.util.Date startDate,
java.util.Date endDate)
startDate - starting cut off dateendDate - ending cut off date
final void setCurrencyNode(CurrencyNode node)
node - The new commodity node for this account.public final CurrencyNode getCurrencyNode()
public boolean isLocked()
public void setLocked(boolean locked)
public boolean isPlaceHolder()
public void setPlaceHolder(boolean placeHolder)
public java.lang.String getDescription()
public void setDescription(java.lang.String desc)
public java.lang.String getName()
public void setName(java.lang.String newName)
public java.lang.String getPathName()
private static java.lang.String getAccountSeparator()
public AccountType getAccountType()
public boolean isVisible()
public void setVisible(boolean visible)
visible - the new account visibilitypublic void setNotes(java.lang.String notes)
notes - the notes for this accountpublic java.lang.String getNotes()
public int compareTo(Account acc)
compareTo in interface java.lang.Comparable<Account>acc - the Account to be compared.
0 if the argument Account is equal to this Account; account value less than
0 if this Account is before the Account argument; and account value greater than
0 if this Account is after the Account argument.public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object other)
StoredObject
equals in class StoredObjectother - object to compareObject.equals(java.lang.Object)public int hashCode()
StoredObject
hashCode in class StoredObjectObject.hashCode()public void setAccountNumber(java.lang.String account)
public java.lang.String getAccountNumber()
public boolean addSecurity(SecurityNode node)
node - SecurityNode to add
boolean removeSecurity(SecurityNode node)
node - SecurityNode to remove
public boolean containsSecurity(SecurityNode node)
public java.math.BigDecimal getMarketValue()
public java.util.Set<SecurityNode> getSecurities()
public java.util.Set<SecurityNode> getUsedSecurities()
public java.math.BigDecimal getCashBalance()
public int getDepth()
public final boolean instanceOf(AccountType type)
type - AccountType to compare against
public final boolean memberOf(AccountGroup group)
group - AccountGroup to compare against
public java.lang.String getBankId()
public void setBankId(java.lang.String bankId)
protected java.lang.Object readResolve()
public java.lang.Object clone()
clone in class StoredObject
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||