org.homeunix.thecave.buddi.model
Interface BudgetCategory

All Superinterfaces:
java.lang.Comparable<ModelObject>, Expandable, ModelObject, Source
All Known Implementing Classes:
BudgetCategoryImpl

public interface BudgetCategory
extends Source, Expandable


Method Summary
 java.util.List<BudgetCategory> getAllChildren()
          Returns a list of all children for this budget category, inluding deleted ones.
 long getAmount(java.util.Date periodDate)
          Returns the budgeted amount associated with this given budget category, for the date in which the given period date exists.
 long getAmount(java.util.Date startDate, java.util.Date endDate)
          Returns the budgeted amount associated with this budget category, over the given date range.
 java.util.List<java.util.Date> getBudgetedDates()
          Returns a list of all dates for this budget period which have budget information set for them.
 BudgetCategoryType getBudgetPeriodType()
          Returns the Budget Period type.
 java.util.List<BudgetCategory> getChildren()
          Returns a list of children for this budget category.
 BudgetCategory getParent()
          Returns the parent budget category
 boolean isIncome()
          Does this budget category represent an income category?
 void setAmount(java.util.Date periodDate, long amount)
          Sets the budgeted amount for the given time period.
 void setIncome(boolean income)
          Sets the income flag on this budget category
 void setParent(BudgetCategory parent)
          Sets the parent for this budget category.
 void setPeriodType(BudgetCategoryType periodType)
          Sets the Budget Period type.
 
Methods inherited from interface org.homeunix.thecave.buddi.model.Source
getFullName, getName, getNotes, isDeleted, setDeleted, setName, setNotes
 
Methods inherited from interface org.homeunix.thecave.buddi.model.ModelObject
compareTo, getDocument, getModified, getUid, setChanged, setDocument
 
Methods inherited from interface org.homeunix.thecave.buddi.model.Expandable
isExpanded, setExpanded
 

Method Detail

getAmount

long getAmount(java.util.Date periodDate)
Returns the budgeted amount associated with this given budget category, for the date in which the given period date exists.

Parameters:
periodDate -
Returns:

getAmount

long getAmount(java.util.Date startDate,
               java.util.Date endDate)
Returns the budgeted amount associated with this budget category, over the given date range. If the start and / or end dates do not fall exactly on a budget period, then we calculate how much of the budget period is contained. For instance, assume that we pass in April 15 and July 20 as the dates, and that the associated budget category type is 'Monthly'. Assume that for April we have budgeted $100, for May and June we have budgeted $200 each, and for July we have budgeted $300. To find the final amount, we will add $50 (15 days / 30 days for April * $100) and $200 (May) and $200 (June) and $193 (20 days / 31 days for July * $300), for a total of $643. If you pass in the start date as the first day in the period, and the end day as the last day, you will get back the same number as if you called getAmount(Date) with a day in the same budget period.

Parameters:
startDate -
endDate -
Returns:

getBudgetPeriodType

BudgetCategoryType getBudgetPeriodType()
Returns the Budget Period type. One of the values in Enum BudgePeriodKeys.

Returns:

getParent

BudgetCategory getParent()
Returns the parent budget category

Returns:

getChildren

java.util.List<BudgetCategory> getChildren()
Returns a list of children for this budget category. The contents of this list will include only children which match the current preferences for deleted items. This means that if the user has specified to only show non-deleted sources, we will not return deleted children here. To get a list of all children, regardles of deleted state, use the getAllChildren() method.

Returns:

getAllChildren

java.util.List<BudgetCategory> getAllChildren()
Returns a list of all children for this budget category, inluding deleted ones.

Returns:

isIncome

boolean isIncome()
Does this budget category represent an income category?

Returns:

setAmount

void setAmount(java.util.Date periodDate,
               long amount)
               throws InvalidValueException
Sets the budgeted amount for the given time period.

Parameters:
periodDate -
amount -
Throws:
InvalidValueException

setIncome

void setIncome(boolean income)
               throws InvalidValueException
Sets the income flag on this budget category

Parameters:
income -
Throws:
InvalidValueException

setParent

void setParent(BudgetCategory parent)
               throws InvalidValueException
Sets the parent for this budget category.

Parameters:
parent -
Throws:
InvalidValueException

setPeriodType

void setPeriodType(BudgetCategoryType periodType)
                   throws InvalidValueException
Sets the Budget Period type.

Parameters:
periodType -
Throws:
InvalidValueException

getBudgetedDates

java.util.List<java.util.Date> getBudgetedDates()
Returns a list of all dates for this budget period which have budget information set for them. We basically look at the budget backing map, and return all keys for non-zero values.

Returns: