Class BudgetItem
java.lang.Object
com.infinitekind.moneydance.model.MoneydanceSyncableItem
com.infinitekind.moneydance.model.BudgetItem
- All Implemented Interfaces:
com.infinitekind.tiksync.SyncableItem,java.lang.Comparable
public final class BudgetItem extends MoneydanceSyncableItem implements java.lang.Comparable
Represents one item in a budget
-
Field Summary
Fields Modifier and Type Field Description static intINDEFINITE_END_DATEstatic intINTERVAL_ANNUALLYstatic intINTERVAL_BI_MONTHLYstatic intINTERVAL_BI_WEEKLYstatic intINTERVAL_DAILYstatic intINTERVAL_MONTHLYstatic intINTERVAL_NO_REPEATstatic intINTERVAL_ONCE_ANNUALLYstatic intINTERVAL_ONCE_BI_MONTHLYstatic intINTERVAL_ONCE_BI_WEEKLYstatic intINTERVAL_ONCE_MONTHLYstatic intINTERVAL_ONCE_SEMI_ANNUALLYstatic intINTERVAL_ONCE_SEMI_MONTHLYstatic intINTERVAL_ONCE_TRI_MONTHLYstatic intINTERVAL_ONCE_TRI_WEEKLYstatic intINTERVAL_ONCE_WEEKLYstatic intINTERVAL_SEMI_ANNUALLYstatic intINTERVAL_SEMI_MONTHLYstatic intINTERVAL_TRI_MONTHLYstatic intINTERVAL_TRI_WEEKLYstatic intINTERVAL_WEEKLYstatic java.lang.StringSYNCABLE_TYPE_VALUEFields inherited from class com.infinitekind.moneydance.model.MoneydanceSyncableItem
book, info, SECURITY_SUBTYPES_ITEM_TYPE -
Method Summary
Modifier and Type Method Description intcompareTo(java.lang.Object itemObj)booleancontainsDate(int asOfDate)Determine if the given date is within the overall date range of the budget item.BudgetItemduplicateAsNew(Budget newBudget)AccountgetAccount()Returns the specific account, if any, to or from which funds will be moved.longgetAmount()Returns the amount that was budgeted, specified in the currency of the transfer account.longgetAmountRelativeToPeriod(BudgetPeriod budgetPeriod)Get the amount of this budget item relative to the give BudgetPeriodlonggetAmountRelativeToPeriod(BudgetPeriod budgetPeriod, CurrencyType inCurrency)Get the amount of this budget item relative to the given BudgetPeriodBudgetgetBudget()longgetBudgetImpact(AbstractTxn txn)Returns the amount that the given transaction has on this budget item, if any.CurrencyTypegetCurrency()Returns the currency that applies to this budget item.DateRangegetDateRange()intgetInterval()Returns the type of repeating interval.intgetIntervalEnd(int asOfDate)Returns the last date of the interval that contains the given date.intgetIntervalEndDate()Returns the ending date for the last interval, if any.floatgetIntervalProration(int asOfDate)Return a float from zero to 1 indicating how far through the interval the current date is.floatgetIntervalProration(int startDate, int endDate)Return a non-negative float value indicating how much the amount of this budget item should be multiplied by in order to get the budgeted amount for the given period.intgetIntervalStart(int asOfDate)Returns the beginning date of the interval that contains the given date.intgetIntervalStartDate()Returns the starting date for the first intervaljava.lang.StringgetSyncItemType()Subclasses should override this to return a static string identifying their type of objectAccountgetTransferAccount()Returns the specific category or account from or to which funds will be moved.booleanisIncome()Return true if this item is considered an incomeprotected voiditemWasUpdated()Read the information from the underlying storagevoidsetAccount(Account newAccount)Sets the specific account, if any, to or from which funds will be moved.voidsetAmount(long newAmount)Sets the amount that was budgeted, specified in the currency of the transfer account.voidsetBudget(Budget b)voidsetBudgetPeriod(BudgetPeriod budgetPeriod)Sets the interval based on the given BudgetPeriodvoidsetInterval(int interval)Sets the type of repeating interval.voidsetIntervalEndDate(int intervalEnd)Sets the ending date for the last interval, if any.voidsetIntervalStartDate(int intervalStart)Sets the starting date for the first intervalvoidsetTransferAccount(Account category)Sets the specific category or account from or to which funds will be moved.java.lang.StringtoString()java.lang.StringtoString(CustomDateFormat dateFmt)Methods inherited from class com.infinitekind.moneydance.model.MoneydanceSyncableItem
addParameters, addTags, autoSyncsChanges, decodeKeywordList, deleteItem, doesParameterExist, duplicate, encodeKeywordList, equals, getAccountParameter, getAddress, getAddressParameter, getBook, getBooleanParameter, getCurrencyParameter, getCurrencyParameter, getCurrencyParameter, getDoubleParameter, getIntParameter, getKeywords, getLongParameter, getOriginalItem, getParameter, getParameter, getParameterCount, getParameterKeys, getPreference, getPreferenceBoolean, getPreferenceDouble, getPreferenceInt, getPreferenceIntArray, getPreferenceLong, getPreferenceStringList, getPreferenceSublist, getPreferenceSubset, getStringListParameter, getSyncInfo, getSyncTimestamp, getUUID, hasBeenSynced, hashCode, hasKeywordSubstring, initialize, isInEditingMode, isSyncable, itemWasUpdated, itemWillSync, itemWillSync, makeSyncableItem, removeParameter, setAccountParameter, setAddress, setAddressParameter, setCurrencyParameter, setCurrencyParameter, setCurrencyParameter, setDirty, setEditingMode, setKeywords, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameterNoNotify, setPreference, setPreference, setPreference, syncItem
-
Field Details
-
SYNCABLE_TYPE_VALUE
public static final java.lang.String SYNCABLE_TYPE_VALUE- See Also:
- Constant Field Values
-
INTERVAL_NO_REPEAT
public static final int INTERVAL_NO_REPEAT- See Also:
- Constant Field Values
-
INTERVAL_DAILY
public static final int INTERVAL_DAILY- See Also:
- Constant Field Values
-
INTERVAL_WEEKLY
public static final int INTERVAL_WEEKLY- See Also:
- Constant Field Values
-
INTERVAL_BI_WEEKLY
public static final int INTERVAL_BI_WEEKLY- See Also:
- Constant Field Values
-
INTERVAL_TRI_WEEKLY
public static final int INTERVAL_TRI_WEEKLY- See Also:
- Constant Field Values
-
INTERVAL_SEMI_MONTHLY
public static final int INTERVAL_SEMI_MONTHLY- See Also:
- Constant Field Values
-
INTERVAL_MONTHLY
public static final int INTERVAL_MONTHLY- See Also:
- Constant Field Values
-
INTERVAL_BI_MONTHLY
public static final int INTERVAL_BI_MONTHLY- See Also:
- Constant Field Values
-
INTERVAL_TRI_MONTHLY
public static final int INTERVAL_TRI_MONTHLY- See Also:
- Constant Field Values
-
INTERVAL_SEMI_ANNUALLY
public static final int INTERVAL_SEMI_ANNUALLY- See Also:
- Constant Field Values
-
INTERVAL_ANNUALLY
public static final int INTERVAL_ANNUALLY- See Also:
- Constant Field Values
-
INTERVAL_ONCE_WEEKLY
public static final int INTERVAL_ONCE_WEEKLY- See Also:
- Constant Field Values
-
INTERVAL_ONCE_BI_WEEKLY
public static final int INTERVAL_ONCE_BI_WEEKLY- See Also:
- Constant Field Values
-
INTERVAL_ONCE_TRI_WEEKLY
public static final int INTERVAL_ONCE_TRI_WEEKLY- See Also:
- Constant Field Values
-
INTERVAL_ONCE_SEMI_MONTHLY
public static final int INTERVAL_ONCE_SEMI_MONTHLY- See Also:
- Constant Field Values
-
INTERVAL_ONCE_MONTHLY
public static final int INTERVAL_ONCE_MONTHLY- See Also:
- Constant Field Values
-
INTERVAL_ONCE_BI_MONTHLY
public static final int INTERVAL_ONCE_BI_MONTHLY- See Also:
- Constant Field Values
-
INTERVAL_ONCE_TRI_MONTHLY
public static final int INTERVAL_ONCE_TRI_MONTHLY- See Also:
- Constant Field Values
-
INTERVAL_ONCE_SEMI_ANNUALLY
public static final int INTERVAL_ONCE_SEMI_ANNUALLY- See Also:
- Constant Field Values
-
INTERVAL_ONCE_ANNUALLY
public static final int INTERVAL_ONCE_ANNUALLY- See Also:
- Constant Field Values
-
INDEFINITE_END_DATE
public static final int INDEFINITE_END_DATE- See Also:
- Constant Field Values
-
-
Method Details
-
getSyncItemType
public final java.lang.String getSyncItemType()Description copied from class:MoneydanceSyncableItemSubclasses should override this to return a static string identifying their type of object- Specified by:
getSyncItemTypein interfacecom.infinitekind.tiksync.SyncableItem- Overrides:
getSyncItemTypein classMoneydanceSyncableItem
-
itemWasUpdated
protected void itemWasUpdated()Read the information from the underlying storage- Overrides:
itemWasUpdatedin classMoneydanceSyncableItem
-
duplicateAsNew
-
getBudget
-
setBudget
-
getCurrency
Returns the currency that applies to this budget item. Basically just the currency of the transfer account, or the currency of the account if there is no transfer account. If there is account or transfer account then this returns null. -
getAccount
Returns the specific account, if any, to or from which funds will be moved. If this is null, then the budgeted amount applies to all transfers to or from the transfer account. -
setAccount
Sets the specific account, if any, to or from which funds will be moved. If this is null, then the budgeted amount applies to all transfers to or from the transfer account. -
getBudgetImpact
Returns the amount that the given transaction has on this budget item, if any. -
getIntervalStart
public int getIntervalStart(int asOfDate)Returns the beginning date of the interval that contains the given date. If the given date does not fall within the range for this item then return zero. -
compareTo
public int compareTo(java.lang.Object itemObj)- Specified by:
compareToin interfacejava.lang.Comparable
-
containsDate
public boolean containsDate(int asOfDate)Determine if the given date is within the overall date range of the budget item.- Parameters:
asOfDate- The integer date to test.- Returns:
- True if the item is in date, false if it falls outside of the items date range.
-
getIntervalEnd
public int getIntervalEnd(int asOfDate)Returns the last date of the interval that contains the given date. If the given date does not fall within the range for this item then return zero. -
getIntervalProration
public float getIntervalProration(int startDate, int endDate)Return a non-negative float value indicating how much the amount of this budget item should be multiplied by in order to get the budgeted amount for the given period. -
getIntervalProration
public float getIntervalProration(int asOfDate)Return a float from zero to 1 indicating how far through the interval the current date is. -
getTransferAccount
Returns the specific category or account from or to which funds will be moved. -
isIncome
public boolean isIncome()Return true if this item is considered an income -
setTransferAccount
Sets the specific category or account from or to which funds will be moved. -
getAmountRelativeToPeriod
Get the amount of this budget item relative to the give BudgetPeriod- Parameters:
budgetPeriod-- Returns:
-
getAmountRelativeToPeriod
Get the amount of this budget item relative to the given BudgetPeriod- Parameters:
budgetPeriod-inCurrency- the currency to which the result should be converted, or null to not convert- Returns:
-
getAmount
public long getAmount()Returns the amount that was budgeted, specified in the currency of the transfer account. -
setAmount
public void setAmount(long newAmount)Sets the amount that was budgeted, specified in the currency of the transfer account. -
setBudgetPeriod
Sets the interval based on the given BudgetPeriod- Parameters:
budgetPeriod-
-
getInterval
public int getInterval()Returns the type of repeating interval. Can be any one of the INTERVAL_ constants. -
setInterval
public void setInterval(int interval)Sets the type of repeating interval. Can be any one of the INTERVAL_ constants. -
getIntervalStartDate
public int getIntervalStartDate()Returns the starting date for the first interval -
setIntervalStartDate
public void setIntervalStartDate(int intervalStart)Sets the starting date for the first interval -
getIntervalEndDate
public int getIntervalEndDate()Returns the ending date for the last interval, if any. If the interval is INTERVAL_NO_REPEAT, then this is the ending date for the manually specified interval -
setIntervalEndDate
public void setIntervalEndDate(int intervalEnd)Sets the ending date for the last interval, if any. If the interval is INTERVAL_NO_REPEAT, then this is the ending date for the manually specified interval -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
toString
-
getDateRange
-