org.homeunix.thecave.buddi.model.impl
Class AccountImpl

java.lang.Object
  extended by org.homeunix.thecave.buddi.model.impl.ModelObjectImpl
      extended by org.homeunix.thecave.buddi.model.impl.SourceImpl
          extended by org.homeunix.thecave.buddi.model.impl.AccountImpl
All Implemented Interfaces:
java.lang.Comparable<ModelObject>, Account, ModelObject, Source

public class AccountImpl
extends SourceImpl
implements Account

Default implementation of an Account. You should not create this object directly; instead, please use the ModelFactory to create it, as this will ensure that all required fields are correctly set.

Author:
wyatt

Field Summary
 
Fields inherited from class org.homeunix.thecave.buddi.model.impl.SourceImpl
deleted, name, notes
 
Fields inherited from class org.homeunix.thecave.buddi.model.impl.ModelObjectImpl
document, modifiedTime, uid
 
Constructor Summary
AccountImpl()
           
 
Method Summary
 int compareTo(ModelObject arg0)
           
 AccountType getAccountType()
          Get the account type
 long getBalance()
          Returns the current balance.
 long getBalance(java.util.Date d)
          Returns the balance as of the given date.
 java.lang.String getFullName()
          Returns the full name of this source.
 long getOverdraftCreditLimit()
          Returns the overdraft limit for Debit accounts, or Credit Limit for Credit accounts.
 java.util.Date getStartDate()
          Returns the starting date of this account.
 long getStartingBalance()
          Returns the starting balance associated with this account.
 void setAccountType(AccountType type)
          Sets the account type
 void setBalance(long balance)
           
 void setName(java.lang.String name)
          Sets the name of this source.
 void setOverdraftCreditLimit(long overdraftCreditLimit)
          Sets the overdraft limit for debit accounts, or the credit limit for credit accounts.
 void setStartDate(java.util.Date startDate)
          Sets the starting date of this account.
 void setStartingBalance(long startingBalance)
          Sets the starting balance
 void updateBalance()
          Updates the balance for this account, by navigating all associated transactions.
 
Methods inherited from class org.homeunix.thecave.buddi.model.impl.SourceImpl
getName, getNotes, isDeleted, setDeleted, setNotes, toString
 
Methods inherited from class org.homeunix.thecave.buddi.model.impl.ModelObjectImpl
equals, getDocument, getModified, getUid, setChanged, setDocument, setModified, setModified, setUid
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.homeunix.thecave.buddi.model.Source
getName, getNotes, isDeleted, setDeleted, setNotes
 
Methods inherited from interface org.homeunix.thecave.buddi.model.ModelObject
getDocument, getModified, getUid, setChanged, setDocument
 

Constructor Detail

AccountImpl

public AccountImpl()
Method Detail

getStartingBalance

public long getStartingBalance()
Description copied from interface: Account
Returns the starting balance associated with this account.

Specified by:
getStartingBalance in interface Account
Returns:

setStartingBalance

public void setStartingBalance(long startingBalance)
Description copied from interface: Account
Sets the starting balance

Specified by:
setStartingBalance in interface Account

getStartDate

public java.util.Date getStartDate()
Description copied from interface: Account
Returns the starting date of this account.

Specified by:
getStartDate in interface Account
Returns:

setStartDate

public void setStartDate(java.util.Date startDate)
Description copied from interface: Account
Sets the starting date of this account.

Specified by:
setStartDate in interface Account

getBalance

public long getBalance()
Description copied from interface: Account
Returns the current balance. This is a volatile value, and is generated by calling updateBalance().

Specified by:
getBalance in interface Account
Returns:

setBalance

public void setBalance(long balance)

getAccountType

public AccountType getAccountType()
Description copied from interface: Account
Get the account type

Specified by:
getAccountType in interface Account
Returns:

setAccountType

public void setAccountType(AccountType type)
Description copied from interface: Account
Sets the account type

Specified by:
setAccountType in interface Account

setName

public void setName(java.lang.String name)
             throws InvalidValueException
Description copied from interface: Source
Sets the name of this source.

Specified by:
setName in interface Source
Overrides:
setName in class SourceImpl
Throws:
InvalidValueException

updateBalance

public void updateBalance()
Description copied from interface: Account
Updates the balance for this account, by navigating all associated transactions. Calling this will also update the balanceTo or balanceFrom fields in each transaction, representing the balance at the time of that transaction.

Specified by:
updateBalance in interface Account

getFullName

public java.lang.String getFullName()
Description copied from interface: Source
Returns the full name of this source. The details of this will differ for Accounts and Budget Categories.

Specified by:
getFullName in interface Source
Returns:

getBalance

public long getBalance(java.util.Date d)
Description copied from interface: Account
Returns the balance as of the given date.

Specified by:
getBalance in interface Account
Returns:

compareTo

public int compareTo(ModelObject arg0)
Specified by:
compareTo in interface java.lang.Comparable<ModelObject>
Specified by:
compareTo in interface ModelObject
Overrides:
compareTo in class ModelObjectImpl

getOverdraftCreditLimit

public long getOverdraftCreditLimit()
Description copied from interface: Account
Returns the overdraft limit for Debit accounts, or Credit Limit for Credit accounts.

Specified by:
getOverdraftCreditLimit in interface Account
Returns:

setOverdraftCreditLimit

public void setOverdraftCreditLimit(long overdraftCreditLimit)
                             throws InvalidValueException
Description copied from interface: Account
Sets the overdraft limit for debit accounts, or the credit limit for credit accounts.

Specified by:
setOverdraftCreditLimit in interface Account
Throws:
InvalidValueException