org.geebis.books.model.account
Class Account<T extends Account>

java.lang.Object
  extended by org.geebis.books.model.account.Account<T>
All Implemented Interfaces:
java.io.Serializable, Labelable
Direct Known Subclasses:
AccountsPayableAccount, AccountsReceivableAccount, BankAccount, CostOfGoodsSoldAccount, CreditCardAccount, EquityAccount, ExpenseAccount, FixedAssetAccount, IncomeAccount, LongTermLiabilityAccount, OtherAssetAccount, OtherCurrentAssetAccount, OtherCurrentLiabilityAccount, OtherExpenseAccount, OtherIncomeAccount

@Name(value="account")
public abstract class Account<T extends Account>
extends java.lang.Object
implements Labelable, java.io.Serializable

The Account class represents an account of funds.

See Also:
Serialized Form

Constructor Summary
protected Account()
           
protected Account(java.lang.String name)
           
 
Method Summary
 void addSubAccount(T account)
          Adds an account as a sub account to this account if it's not already a sub account
 java.lang.Double getAmount()
          Gets the amount in the account
 java.lang.String getDescription()
          Gets the description of the account
 java.lang.Long getId()
           
 java.util.Set<Label> getLabels()
          Gets the labels for this account
 java.lang.String getName()
          Gets the name of the account.
 java.util.List<T> getSubAccounts()
          Gets the sub accounts for this account
 java.lang.Double getTotal()
          Calculates the total value in this account including sub accounts
 java.lang.Integer getVersion()
           
 void removeSubAccount(T account)
          Removes an account as a sub account from this account
 void setAmount(java.lang.Double amount)
          Sets the amount in the account
 void setDescription(java.lang.String description)
          Sets the description of the account
 void setId(java.lang.Long id)
           
 void setLabels(java.util.Set<Label> labels)
          Sets the labels for this account
 void setName(java.lang.String name)
          Sets the name of the account
 void setSubAccounts(java.util.List<T> subAccounts)
          Sets the sub accounts for this account
 void setVersion(java.lang.Integer version)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Account

protected Account()

Account

protected Account(java.lang.String name)
Method Detail

getName

public java.lang.String getName()
Gets the name of the account. This is the unique identifier that is used throughout the system to identify the account.

Returns:
the name of the account

setName

public void setName(java.lang.String name)
Sets the name of the account

Parameters:
name - the new name for the account

getDescription

public java.lang.String getDescription()
Gets the description of the account

Returns:
the description of the account

setDescription

public void setDescription(java.lang.String description)
Sets the description of the account

Parameters:
description - the new description of the account

getAmount

public java.lang.Double getAmount()
Gets the amount in the account

Returns:
the amount in the account

setAmount

public void setAmount(java.lang.Double amount)
Sets the amount in the account

Parameters:
amount - the new amount in the account

getSubAccounts

public java.util.List<T> getSubAccounts()
Gets the sub accounts for this account

Returns:
the list of sub accounts for this account

setSubAccounts

public void setSubAccounts(java.util.List<T> subAccounts)
Sets the sub accounts for this account

Parameters:
subAccounts - the new list of accounts to use as the sub accounts for this account

getLabels

public java.util.Set<Label> getLabels()
Gets the labels for this account

Specified by:
getLabels in interface Labelable
Returns:
the labels for this account

setLabels

public void setLabels(java.util.Set<Label> labels)
Sets the labels for this account

Parameters:
labels - the new labels for this account

getVersion

public java.lang.Integer getVersion()

setVersion

public void setVersion(java.lang.Integer version)

getId

public java.lang.Long getId()

setId

public void setId(java.lang.Long id)

getTotal

public java.lang.Double getTotal()
Calculates the total value in this account including sub accounts

Returns:
the value of this account and sub accounts

addSubAccount

public void addSubAccount(T account)
                   throws IncompatibleAccountException
Adds an account as a sub account to this account if it's not already a sub account

Parameters:
account - the account to add as a sub account
Throws:
IncompatibleAccountException - if the passed in account cannot be added as a subaccount of this account

removeSubAccount

public void removeSubAccount(T account)
Removes an account as a sub account from this account

Parameters:
account - the sub account to remove