| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
package org.homeunix.thecave.buddi.plugin.api.model.impl; |
| 5 | |
|
| 6 | |
import java.util.Date; |
| 7 | |
import java.util.List; |
| 8 | |
|
| 9 | |
import org.homeunix.thecave.buddi.model.BudgetCategory; |
| 10 | |
import org.homeunix.thecave.buddi.model.impl.WrapperLists; |
| 11 | |
import org.homeunix.thecave.buddi.plugin.api.exception.InvalidValueException; |
| 12 | |
import org.homeunix.thecave.buddi.plugin.api.model.ImmutableBudgetCategory; |
| 13 | |
import org.homeunix.thecave.buddi.plugin.api.model.ImmutableBudgetCategoryType; |
| 14 | |
import org.homeunix.thecave.buddi.plugin.api.model.MutableBudgetCategory; |
| 15 | |
|
| 16 | 0 | public class MutableBudgetCategoryImpl extends MutableSourceImpl implements MutableBudgetCategory { |
| 17 | |
|
| 18 | |
public MutableBudgetCategoryImpl(BudgetCategory budgetCategory) { |
| 19 | 0 | super(budgetCategory); |
| 20 | 0 | } |
| 21 | |
|
| 22 | |
public void setIncome(boolean income) throws InvalidValueException { |
| 23 | 0 | getBudgetCategory().setIncome(income); |
| 24 | 0 | } |
| 25 | |
|
| 26 | |
public void setParent(MutableBudgetCategory budgetCategory) throws InvalidValueException{ |
| 27 | 0 | if (budgetCategory == null) |
| 28 | 0 | getBudgetCategory().setParent(null); |
| 29 | |
else |
| 30 | 0 | getBudgetCategory().setParent(budgetCategory.getBudgetCategory()); |
| 31 | 0 | } |
| 32 | |
|
| 33 | |
public BudgetCategory getBudgetCategory() { |
| 34 | 0 | return (BudgetCategory) getSource(); |
| 35 | |
} |
| 36 | |
|
| 37 | |
public long getAmount(Date startDate, Date endDate) { |
| 38 | 0 | return getBudgetCategory().getAmount(startDate, endDate); |
| 39 | |
} |
| 40 | |
|
| 41 | |
public void setAmount(Date date, long amount) throws InvalidValueException{ |
| 42 | 0 | getBudgetCategory().setAmount(date, amount); |
| 43 | 0 | } |
| 44 | |
|
| 45 | |
public long getAmount(Date date) { |
| 46 | 0 | return getBudgetCategory().getAmount(date); |
| 47 | |
} |
| 48 | |
|
| 49 | |
public ImmutableBudgetCategoryType getBudgetPeriodType() { |
| 50 | 0 | return new ImmutableBudgetCategoryTypeImpl(getBudgetCategory().getBudgetPeriodType()); |
| 51 | |
} |
| 52 | |
|
| 53 | |
public void setBudgetCategoryType(ImmutableBudgetCategoryType budgetCategoryType) throws InvalidValueException{ |
| 54 | 0 | if (budgetCategoryType != null) |
| 55 | 0 | getBudgetCategory().setPeriodType(budgetCategoryType.getBudgetCategoryType()); |
| 56 | 0 | } |
| 57 | |
|
| 58 | |
public MutableBudgetCategory getParent() { |
| 59 | 0 | if (getBudgetCategory().getParent() != null) |
| 60 | 0 | return new MutableBudgetCategoryImpl(getBudgetCategory().getParent()); |
| 61 | 0 | return null; |
| 62 | |
} |
| 63 | |
|
| 64 | |
public boolean isIncome() { |
| 65 | 0 | return getBudgetCategory().isIncome(); |
| 66 | |
} |
| 67 | |
@Override |
| 68 | |
public String toString() { |
| 69 | 0 | return getFullName(); |
| 70 | |
} |
| 71 | |
|
| 72 | |
public List<MutableBudgetCategory> getAllChildren() { |
| 73 | 0 | return null; |
| 74 | |
} |
| 75 | |
|
| 76 | |
public List<MutableBudgetCategory> getChildren() { |
| 77 | 0 | return null; |
| 78 | |
} |
| 79 | |
|
| 80 | |
public List<MutableBudgetCategory> getAllMutableChildren() { |
| 81 | 0 | return new WrapperLists.ImmutableObjectWrapperList<MutableBudgetCategory, BudgetCategory>(getBudgetCategory().getDocument(), getBudgetCategory().getAllChildren()); |
| 82 | |
} |
| 83 | |
|
| 84 | |
public List<MutableBudgetCategory> getMutableChildren() { |
| 85 | 0 | return new WrapperLists.ImmutableObjectWrapperList<MutableBudgetCategory, BudgetCategory>(getBudgetCategory().getDocument(), getBudgetCategory().getChildren()); |
| 86 | |
} |
| 87 | |
|
| 88 | |
public List<ImmutableBudgetCategory> getAllImmutableChildren() { |
| 89 | 0 | return new WrapperLists.ImmutableObjectWrapperList<ImmutableBudgetCategory, BudgetCategory>(getBudgetCategory().getDocument(), getBudgetCategory().getAllChildren()); |
| 90 | |
} |
| 91 | |
|
| 92 | |
public List<ImmutableBudgetCategory> getImmutableChildren() { |
| 93 | 0 | return new WrapperLists.ImmutableObjectWrapperList<ImmutableBudgetCategory, BudgetCategory>(getBudgetCategory().getDocument(), getBudgetCategory().getChildren()); |
| 94 | |
} |
| 95 | |
|
| 96 | |
public List<Date> getBudgetedDates() { |
| 97 | 0 | return getBudgetCategory().getBudgetedDates(); |
| 98 | |
} |
| 99 | |
} |