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

java.lang.Object
  extended by org.homeunix.thecave.buddi.plugin.api.model.impl.ImmutableModelObjectImpl
      extended by org.homeunix.thecave.buddi.plugin.api.model.impl.MutableModelObjectImpl
          extended by org.homeunix.thecave.buddi.plugin.api.model.impl.MutableSourceImpl
              extended by org.homeunix.thecave.buddi.plugin.api.model.impl.MutableBudgetCategoryImpl
All Implemented Interfaces:
java.lang.Comparable<ImmutableModelObject>, ImmutableBudgetCategory, ImmutableModelObject, ImmutableSource, MutableBudgetCategory, MutableSource

public class MutableBudgetCategoryImpl
extends MutableSourceImpl
implements MutableBudgetCategory


Constructor Summary
MutableBudgetCategoryImpl(BudgetCategory budgetCategory)
           
 
Method Summary
 java.util.List<MutableBudgetCategory> getAllChildren()
           
 java.util.List<ImmutableBudgetCategory> getAllImmutableChildren()
          Returns all children of this budget category, regardless of delete flag state.
 java.util.List<MutableBudgetCategory> getAllMutableChildren()
          Returns all children of this budget category, regardless of delete flag state.
 long getAmount(java.util.Date date)
          Returns the budgeted amount for the given date.
 long getAmount(java.util.Date startDate, java.util.Date endDate)
          Returns the budgeted amount spread across the date range.
 BudgetCategory getBudgetCategory()
          Returns the wrapped object from the underlying data model.
 java.util.List<java.util.Date> getBudgetedDates()
          Returns a list of all dates for this budget period which have budget information set for them.
 ImmutableBudgetCategoryType getBudgetPeriodType()
          Returns the budget period type associated with this budget category.
 java.util.List<MutableBudgetCategory> getChildren()
           
 java.util.List<ImmutableBudgetCategory> getImmutableChildren()
          Returns all visible children of this budget category.
 java.util.List<MutableBudgetCategory> getMutableChildren()
          Returns all visible children of this budget category.
 MutableBudgetCategory getParent()
          Returns the parent of this ImmutableBudgetCategory, or null if there is no parent.
 boolean isIncome()
          Does this ImmutableBudgetCategory represent an income category?
 void setAmount(java.util.Date date, long amount)
          Sets the amount for the budget period which contains the given date.
 void setBudgetCategoryType(ImmutableBudgetCategoryType budgetCategoryType)
          Sets the budget period type associated with this budget category.
 void setIncome(boolean income)
          Sets whether this budget category represents income or not.
 void setParent(MutableBudgetCategory budgetCategory)
          Sets the parent of this budget category.
 java.lang.String toString()
           
 
Methods inherited from class org.homeunix.thecave.buddi.plugin.api.model.impl.MutableSourceImpl
getFullName, getName, getNotes, getSource, isDeleted, setDeleted, setName, setNotes
 
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.ImmutableSource
getFullName, getName, getNotes, getSource, isDeleted
 
Methods inherited from interface org.homeunix.thecave.buddi.plugin.api.model.ImmutableModelObject
getModified, getRaw, getUid
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.homeunix.thecave.buddi.plugin.api.model.MutableSource
setDeleted, setName, setNotes
 
Methods inherited from interface org.homeunix.thecave.buddi.plugin.api.model.ImmutableSource
getFullName, getName, getNotes, getSource, isDeleted
 
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

MutableBudgetCategoryImpl

public MutableBudgetCategoryImpl(BudgetCategory budgetCategory)
Method Detail

setIncome

public void setIncome(boolean income)
               throws InvalidValueException
Description copied from interface: MutableBudgetCategory
Sets whether this budget category represents income or not.

Specified by:
setIncome in interface MutableBudgetCategory
Throws:
InvalidValueException

setParent

public void setParent(MutableBudgetCategory budgetCategory)
               throws InvalidValueException
Description copied from interface: MutableBudgetCategory
Sets the parent of this budget category. Set to null for no parent.

Specified by:
setParent in interface MutableBudgetCategory
Throws:
InvalidValueException

getBudgetCategory

public BudgetCategory getBudgetCategory()
Description copied from interface: ImmutableBudgetCategory
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:
getBudgetCategory in interface ImmutableBudgetCategory
Returns:

getAmount

public long getAmount(java.util.Date startDate,
                      java.util.Date endDate)
Description copied from interface: ImmutableBudgetCategory
Returns the budgeted amount spread across the date range. For instance, given a monthly budget period, and the date range Sept 15 - Sept 30, and September had a value of 100 for the given budget category, we would return 50.

Specified by:
getAmount in interface ImmutableBudgetCategory
Returns:

setAmount

public void setAmount(java.util.Date date,
                      long amount)
               throws InvalidValueException
Description copied from interface: MutableBudgetCategory
Sets the amount for the budget period which contains the given date. This is defined by the currently selected BudgetCategoryType object associated with this category.

Specified by:
setAmount in interface MutableBudgetCategory
Throws:
InvalidValueException

getAmount

public long getAmount(java.util.Date date)
Description copied from interface: ImmutableBudgetCategory
Returns the budgeted amount for the given date.

Specified by:
getAmount in interface ImmutableBudgetCategory
Returns:

getBudgetPeriodType

public ImmutableBudgetCategoryType getBudgetPeriodType()
Description copied from interface: ImmutableBudgetCategory
Returns the budget period type associated with this budget category.

Specified by:
getBudgetPeriodType in interface ImmutableBudgetCategory
Returns:

setBudgetCategoryType

public void setBudgetCategoryType(ImmutableBudgetCategoryType budgetCategoryType)
                           throws InvalidValueException
Description copied from interface: MutableBudgetCategory
Sets the budget period type associated with this budget category.

Specified by:
setBudgetCategoryType in interface MutableBudgetCategory
Throws:
InvalidValueException

getParent

public MutableBudgetCategory getParent()
Description copied from interface: ImmutableBudgetCategory
Returns the parent of this ImmutableBudgetCategory, or null if there is no parent.

Specified by:
getParent in interface ImmutableBudgetCategory
Specified by:
getParent in interface MutableBudgetCategory
Returns:

isIncome

public boolean isIncome()
Description copied from interface: ImmutableBudgetCategory
Does this ImmutableBudgetCategory represent an income category?

Specified by:
isIncome in interface ImmutableBudgetCategory
Returns:

toString

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

getAllChildren

public java.util.List<MutableBudgetCategory> getAllChildren()

getChildren

public java.util.List<MutableBudgetCategory> getChildren()

getAllMutableChildren

public java.util.List<MutableBudgetCategory> getAllMutableChildren()
Description copied from interface: MutableBudgetCategory
Returns all children of this budget category, regardless of delete flag state.

Specified by:
getAllMutableChildren in interface MutableBudgetCategory
Returns:

getMutableChildren

public java.util.List<MutableBudgetCategory> getMutableChildren()
Description copied from interface: MutableBudgetCategory
Returns all visible children of this budget category. 'Visible Children' are defined to be all children which do not have the deleted flag set, plus all children which have the deleted flag set IIF the Preferences define that the user wants to see deleted sources. This method is mostly used for GUI functions, such as reports and graphs; if you want to access the model it is usually a better idea to use the getAllChildren() method, which will return all children regardless of delete flag state.

Specified by:
getMutableChildren in interface MutableBudgetCategory
Returns:

getAllImmutableChildren

public java.util.List<ImmutableBudgetCategory> getAllImmutableChildren()
Description copied from interface: ImmutableBudgetCategory
Returns all children of this budget category, regardless of delete flag state.

Specified by:
getAllImmutableChildren in interface ImmutableBudgetCategory
Returns:

getImmutableChildren

public java.util.List<ImmutableBudgetCategory> getImmutableChildren()
Description copied from interface: ImmutableBudgetCategory
Returns all visible children of this budget category. 'Visible Children' are defined to be all children which do not have the deleted flag set, plus all children which have the deleted flag set IIF the Preferences define that the user wants to see deleted sources. This method is mostly used for GUI functions, such as reports and graphs; if you want to access the model it is usually a better idea to use the getAllChildren() method, which will return all children regardless of delete flag state.

Specified by:
getImmutableChildren in interface ImmutableBudgetCategory
Returns:

getBudgetedDates

public java.util.List<java.util.Date> getBudgetedDates()
Description copied from interface: ImmutableBudgetCategory
Returns a list of all dates for this budget period which have budget information set for them. Any date for this budget period which has an associated amount of anything other than zero will be returned here.

Specified by:
getBudgetedDates in interface ImmutableBudgetCategory
Returns: