| 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.model.ImmutableBudgetCategory; |
| 12 | |
import org.homeunix.thecave.buddi.plugin.api.model.ImmutableBudgetCategoryType; |
| 13 | |
|
| 14 | |
public class ImmutableBudgetCategoryImpl extends ImmutableSourceImpl implements ImmutableBudgetCategory { |
| 15 | |
|
| 16 | |
public ImmutableBudgetCategoryImpl(BudgetCategory budgetCategory) { |
| 17 | 0 | super(budgetCategory); |
| 18 | 0 | } |
| 19 | |
|
| 20 | |
public boolean isIncome() { |
| 21 | 0 | return getBudgetCategory().isIncome(); |
| 22 | |
} |
| 23 | |
public ImmutableBudgetCategory getParent() { |
| 24 | 0 | if (getBudgetCategory().getParent() != null) |
| 25 | 0 | return new MutableBudgetCategoryImpl(getBudgetCategory().getParent()); |
| 26 | 0 | return null; |
| 27 | |
} |
| 28 | |
|
| 29 | |
public BudgetCategory getBudgetCategory(){ |
| 30 | 0 | return (BudgetCategory) getRaw(); |
| 31 | |
} |
| 32 | |
|
| 33 | |
public long getAmount(Date startDate, Date endDate) { |
| 34 | 0 | return getBudgetCategory().getAmount(startDate, endDate); |
| 35 | |
} |
| 36 | |
|
| 37 | |
public long getAmount(Date date) { |
| 38 | 0 | return getBudgetCategory().getAmount(date); |
| 39 | |
} |
| 40 | |
|
| 41 | |
public ImmutableBudgetCategoryType getBudgetPeriodType() { |
| 42 | 0 | return new ImmutableBudgetCategoryTypeImpl(getBudgetCategory().getBudgetPeriodType()); |
| 43 | |
} |
| 44 | |
|
| 45 | |
@Override |
| 46 | |
public String toString() { |
| 47 | 0 | return getFullName(); |
| 48 | |
} |
| 49 | |
|
| 50 | |
public List<ImmutableBudgetCategory> getAllImmutableChildren() { |
| 51 | 0 | return new WrapperLists.ImmutableObjectWrapperList<ImmutableBudgetCategory, BudgetCategory>(getBudgetCategory().getDocument(), getBudgetCategory().getAllChildren()); |
| 52 | |
} |
| 53 | |
|
| 54 | |
public List<ImmutableBudgetCategory> getImmutableChildren() { |
| 55 | 0 | return new WrapperLists.ImmutableObjectWrapperList<ImmutableBudgetCategory, BudgetCategory>(getBudgetCategory().getDocument(), getBudgetCategory().getChildren()); |
| 56 | |
} |
| 57 | |
|
| 58 | |
public List<Date> getBudgetedDates() { |
| 59 | 0 | return getBudgetCategory().getBudgetedDates(); |
| 60 | |
} |
| 61 | |
} |