org.homeunix.thecave.buddi.plugin.api.model.impl
Class ImmutableDocumentImpl

java.lang.Object
  extended by org.homeunix.thecave.buddi.plugin.api.model.impl.ImmutableModelObjectImpl
      extended by org.homeunix.thecave.buddi.plugin.api.model.impl.ImmutableDocumentImpl
All Implemented Interfaces:
java.lang.Comparable<ImmutableModelObject>, ImmutableDocument, ImmutableModelObject

public class ImmutableDocumentImpl
extends ImmutableModelObjectImpl
implements ImmutableDocument


Constructor Summary
ImmutableDocumentImpl(Document model)
           
 
Method Summary
 ImmutableAccount getAccount(java.lang.String name)
          Returns the account referenced by the given name.
 ImmutableAccountType getAccountType(java.lang.String name)
          Returns the type referenced by the given name.
 ImmutableBudgetCategory getBudgetCategory(java.lang.String fullName)
          Returns the budget category referenced by the given full name.
 ImmutableBudgetCategoryType getBudgetCategoryType(BudgetCategoryTypes name)
          Returns an ImmutableBudgetCategoryType object, with the given name.
 ImmutableBudgetCategoryType getBudgetCategoryType(java.lang.String name)
          Returns an ImmutableBudgetCategoryType object, with the given name.
 java.util.List<ImmutableAccount> getImmutableAccounts()
          Returns a list of all immutable accounts in the model
 java.util.List<ImmutableAccountType> getImmutableAccountTypes()
          Returns a list of all immutable types in the model
 java.util.List<ImmutableBudgetCategory> getImmutableBudgetCategories()
          Returns a list of all immutable budget categories in the model
 java.util.List<ImmutableTransaction> getImmutableTransactions()
          Returns a list of all immutable transactions in the model
 java.util.List<ImmutableTransaction> getImmutableTransactions(java.util.Date startDate, java.util.Date endDate)
          Returns a list of all immutable transactions in the model which are between startDate and endDate
 java.util.List<ImmutableTransaction> getImmutableTransactions(ImmutableSource source)
          Returns a list of all immutable transactions in the model which are associatd with the given source
 java.util.List<ImmutableTransaction> getImmutableTransactions(ImmutableSource source, java.util.Date startDate, java.util.Date endDate)
          Returns a list of all immutable transactions in the model which are associated with source and between startDate and endDate
 Document getModel()
          Returns the wrapped object from the underlying data model.
 long getNetWorth(java.util.Date date)
          Returns the net worth in the model as of the given date.
 java.lang.String toString()
           
 
Methods inherited from class org.homeunix.thecave.buddi.plugin.api.model.impl.ImmutableModelObjectImpl
compareTo, equals, getModified, getRaw, getUid, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.homeunix.thecave.buddi.plugin.api.model.ImmutableModelObject
getModified, getRaw, getUid
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

ImmutableDocumentImpl

public ImmutableDocumentImpl(Document model)
Method Detail

getAccount

public ImmutableAccount getAccount(java.lang.String name)
Description copied from interface: ImmutableDocument
Returns the account referenced by the given name.

Specified by:
getAccount in interface ImmutableDocument
Returns:

getImmutableAccounts

public java.util.List<ImmutableAccount> getImmutableAccounts()
Description copied from interface: ImmutableDocument
Returns a list of all immutable accounts in the model

Specified by:
getImmutableAccounts in interface ImmutableDocument
Returns:

getImmutableBudgetCategories

public java.util.List<ImmutableBudgetCategory> getImmutableBudgetCategories()
Description copied from interface: ImmutableDocument
Returns a list of all immutable budget categories in the model

Specified by:
getImmutableBudgetCategories in interface ImmutableDocument
Returns:

getBudgetCategory

public ImmutableBudgetCategory getBudgetCategory(java.lang.String fullName)
Description copied from interface: ImmutableDocument
Returns the budget category referenced by the given full name.

Specified by:
getBudgetCategory in interface ImmutableDocument
Returns:

getModel

public Document getModel()
Description copied from interface: ImmutableDocument
Returns the wrapped object from the underlying data model. By accessing this method, you bypass all protection which the Buddi API gives you; it is not recommended to use this method unless you understand the risks associated with it.

Specified by:
getModel in interface ImmutableDocument
Returns:

getImmutableTransactions

public java.util.List<ImmutableTransaction> getImmutableTransactions()
Description copied from interface: ImmutableDocument
Returns a list of all immutable transactions in the model

Specified by:
getImmutableTransactions in interface ImmutableDocument
Returns:

getImmutableTransactions

public java.util.List<ImmutableTransaction> getImmutableTransactions(java.util.Date startDate,
                                                                     java.util.Date endDate)
Description copied from interface: ImmutableDocument
Returns a list of all immutable transactions in the model which are between startDate and endDate

Specified by:
getImmutableTransactions in interface ImmutableDocument
Returns:

getImmutableTransactions

public java.util.List<ImmutableTransaction> getImmutableTransactions(ImmutableSource source)
Description copied from interface: ImmutableDocument
Returns a list of all immutable transactions in the model which are associatd with the given source

Specified by:
getImmutableTransactions in interface ImmutableDocument
Returns:

getImmutableTransactions

public java.util.List<ImmutableTransaction> getImmutableTransactions(ImmutableSource source,
                                                                     java.util.Date startDate,
                                                                     java.util.Date endDate)
Description copied from interface: ImmutableDocument
Returns a list of all immutable transactions in the model which are associated with source and between startDate and endDate

Specified by:
getImmutableTransactions in interface ImmutableDocument
Returns:

getAccountType

public ImmutableAccountType getAccountType(java.lang.String name)
Description copied from interface: ImmutableDocument
Returns the type referenced by the given name.

Specified by:
getAccountType in interface ImmutableDocument
Returns:

getImmutableAccountTypes

public java.util.List<ImmutableAccountType> getImmutableAccountTypes()
Description copied from interface: ImmutableDocument
Returns a list of all immutable types in the model

Specified by:
getImmutableAccountTypes in interface ImmutableDocument
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class ImmutableModelObjectImpl

getBudgetCategoryType

public ImmutableBudgetCategoryType getBudgetCategoryType(BudgetCategoryTypes name)
Description copied from interface: ImmutableDocument
Returns an ImmutableBudgetCategoryType object, with the given name. If the name is not a valid one, returns null.

Specified by:
getBudgetCategoryType in interface ImmutableDocument
Returns:

getBudgetCategoryType

public ImmutableBudgetCategoryType getBudgetCategoryType(java.lang.String name)
Description copied from interface: ImmutableDocument
Returns an ImmutableBudgetCategoryType object, with the given name. If the name is not a valid one, returns null. Although this method gives the same results as the other one, given the same input, it is recommeneded to use the one which takes an enum if possible. That will ensure that you do not make any mistakes with spelling, which may cause a null to be returned.

Specified by:
getBudgetCategoryType in interface ImmutableDocument
Returns:

getNetWorth

public long getNetWorth(java.util.Date date)
Description copied from interface: ImmutableDocument
Returns the net worth in the model as of the given date. This is calculated by summing the account balances for all accounts as of the given date. If the given date is null, return the current balance of the account, as of the last transaction (regardless of date).

Specified by:
getNetWorth in interface ImmutableDocument
Parameters:
date - The date on which to calculate the net worth. Set this to null to return the balance as of the last transaction.
Returns: