| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ImmutableDocument |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Created on Aug 12, 2007 by wyatt | |
| 3 | */ | |
| 4 | package org.homeunix.thecave.buddi.plugin.api.model; | |
| 5 | ||
| 6 | import java.util.Date; | |
| 7 | import java.util.List; | |
| 8 | ||
| 9 | import org.homeunix.thecave.buddi.i18n.keys.BudgetCategoryTypes; | |
| 10 | import org.homeunix.thecave.buddi.model.Document; | |
| 11 | ||
| 12 | /** | |
| 13 | * The API version of DataModel. This contains methods to access all other | |
| 14 | * objects in the model. This is the object passed to plugins which do not | |
| 15 | * require write access (such as reports and export plugins) | |
| 16 | * | |
| 17 | * @author wyatt | |
| 18 | * | |
| 19 | */ | |
| 20 | public interface ImmutableDocument extends ImmutableModelObject { | |
| 21 | ||
| 22 | /** | |
| 23 | * Returns the account referenced by the given name. | |
| 24 | * @param name | |
| 25 | * @return | |
| 26 | */ | |
| 27 | public ImmutableAccount getAccount(String name); | |
| 28 | ||
| 29 | /** | |
| 30 | * Returns a list of all immutable accounts in the model | |
| 31 | * @return | |
| 32 | */ | |
| 33 | public List<ImmutableAccount> getImmutableAccounts(); | |
| 34 | ||
| 35 | /** | |
| 36 | * Returns a list of all immutable budget categories in the model | |
| 37 | * @return | |
| 38 | */ | |
| 39 | public List<ImmutableBudgetCategory> getImmutableBudgetCategories(); | |
| 40 | ||
| 41 | /** | |
| 42 | * Returns the budget category referenced by the given full name. | |
| 43 | * @param fullName | |
| 44 | * @return | |
| 45 | */ | |
| 46 | public ImmutableBudgetCategory getBudgetCategory(String fullName); | |
| 47 | ||
| 48 | /** | |
| 49 | * Returns the wrapped object from the underlying data model. By | |
| 50 | * accessing this method, you bypass all protection which the Buddi API | |
| 51 | * gives you; it is not recommended to use this method unless you understand | |
| 52 | * the risks associated with it. | |
| 53 | * @return | |
| 54 | */ | |
| 55 | public Document getModel(); | |
| 56 | ||
| 57 | /** | |
| 58 | * Returns a list of all immutable transactions in the model | |
| 59 | * @return | |
| 60 | */ | |
| 61 | public List<ImmutableTransaction> getImmutableTransactions(); | |
| 62 | ||
| 63 | /** | |
| 64 | * Returns a list of all immutable transactions in the model which are | |
| 65 | * between startDate and endDate | |
| 66 | * @return | |
| 67 | */ | |
| 68 | public List<ImmutableTransaction> getImmutableTransactions(Date startDate, Date endDate); | |
| 69 | ||
| 70 | /** | |
| 71 | * Returns a list of all immutable transactions in the model which are | |
| 72 | * associatd with the given source | |
| 73 | * @return | |
| 74 | */ | |
| 75 | public List<ImmutableTransaction> getImmutableTransactions(ImmutableSource source); | |
| 76 | ||
| 77 | /** | |
| 78 | * Returns a list of all immutable transactions in the model which are associated with | |
| 79 | * source and between startDate and endDate | |
| 80 | * @return | |
| 81 | */ | |
| 82 | public List<ImmutableTransaction> getImmutableTransactions(ImmutableSource source, Date startDate, Date endDate); | |
| 83 | ||
| 84 | /** | |
| 85 | * Returns the type referenced by the given name. | |
| 86 | * @param name | |
| 87 | * @return | |
| 88 | */ | |
| 89 | public ImmutableAccountType getAccountType(String name); | |
| 90 | ||
| 91 | /** | |
| 92 | * Returns a list of all immutable types in the model | |
| 93 | * @return | |
| 94 | */ | |
| 95 | public List<ImmutableAccountType> getImmutableAccountTypes(); | |
| 96 | ||
| 97 | /** | |
| 98 | * Returns an ImmutableBudgetCategoryType object, with the given name. If the name is | |
| 99 | * not a valid one, returns null. | |
| 100 | * @param name | |
| 101 | * @return | |
| 102 | */ | |
| 103 | public ImmutableBudgetCategoryType getBudgetCategoryType(BudgetCategoryTypes name); | |
| 104 | ||
| 105 | /** | |
| 106 | * Returns an ImmutableBudgetCategoryType object, with the given name. If the name is | |
| 107 | * not a valid one, returns null. | |
| 108 | * | |
| 109 | * Although this method gives the same results as the other one, given the same input, | |
| 110 | * it is recommeneded to use the one which takes an enum if possible. That will ensure | |
| 111 | * that you do not make any mistakes with spelling, which may cause a null to be returned. | |
| 112 | * @param name | |
| 113 | * @return | |
| 114 | */ | |
| 115 | public ImmutableBudgetCategoryType getBudgetCategoryType(String name); | |
| 116 | ||
| 117 | /** | |
| 118 | * Returns the net worth in the model as of the given date. This is calculated by | |
| 119 | * summing the account balances for all accounts as of the given date. If the given | |
| 120 | * date is null, return the current balance of the account, as of the last transaction | |
| 121 | * (regardless of date). | |
| 122 | * @param date The date on which to calculate the net worth. Set this to null to return | |
| 123 | * the balance as of the last transaction. | |
| 124 | * @return | |
| 125 | */ | |
| 126 | public long getNetWorth(Date date); | |
| 127 | } |