Coverage Report - org.homeunix.thecave.buddi.plugin.api.model.impl.ImmutableTransactionImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
ImmutableTransactionImpl
0%
0/35
0%
0/14
1.7
 
 1  
 /*
 2  
  * Created on Aug 12, 2007 by wyatt
 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.Account;
 10  
 import org.homeunix.thecave.buddi.model.BudgetCategory;
 11  
 import org.homeunix.thecave.buddi.model.Split;
 12  
 import org.homeunix.thecave.buddi.model.Transaction;
 13  
 import org.homeunix.thecave.buddi.model.TransactionSplit;
 14  
 import org.homeunix.thecave.buddi.model.impl.WrapperLists;
 15  
 import org.homeunix.thecave.buddi.plugin.api.model.ImmutableSource;
 16  
 import org.homeunix.thecave.buddi.plugin.api.model.ImmutableTransaction;
 17  
 import org.homeunix.thecave.buddi.plugin.api.model.ImmutableTransactionSplit;
 18  
 
 19  
 public class ImmutableTransactionImpl extends ImmutableModelObjectImpl implements ImmutableTransaction {
 20  
         
 21  
         public ImmutableTransactionImpl(Transaction transaction) {
 22  0
                 super(transaction);
 23  0
         }
 24  
         
 25  
         public Transaction getTransaction(){
 26  0
                 return (Transaction) getRaw();
 27  
         }
 28  
         
 29  
         public boolean isClearedFrom() {
 30  0
                 return getTransaction().isClearedFrom();
 31  
         }
 32  
         public boolean isClearedTo() {
 33  0
                 return getTransaction().isClearedTo();
 34  
         }
 35  
         public Date getDate() {
 36  0
                 return getTransaction().getDate();
 37  
         }
 38  
         public String getDescription() {
 39  0
                 return getTransaction().getDescription();
 40  
         }
 41  
         public String getMemo() {
 42  0
                 return getTransaction().getMemo();
 43  
         }
 44  
         public String getNumber() {
 45  0
                 return getTransaction().getNumber();
 46  
         }
 47  
         public boolean isReconciledFrom() {
 48  0
                 return getTransaction().isReconciledFrom();
 49  
         }
 50  
         public boolean isReconciledTo() {
 51  0
                 return getTransaction().isReconciledTo();
 52  
         }
 53  
         public boolean isScheduled() {
 54  0
                 return getTransaction().isScheduled();
 55  
         }
 56  
         public List<ImmutableTransactionSplit> getImmutableFromSplits(){
 57  0
                 return new WrapperLists.ImmutableObjectWrapperList<ImmutableTransactionSplit, TransactionSplit>(getRaw().getDocument(), ((Transaction) getRaw()).getFromSplits());
 58  
         }
 59  
         public List<ImmutableTransactionSplit> getImmutableToSplits(){
 60  0
                 return new WrapperLists.ImmutableObjectWrapperList<ImmutableTransactionSplit, TransactionSplit>(getRaw().getDocument(), ((Transaction) getRaw()).getToSplits());
 61  
         }
 62  
         public ImmutableSource getFrom(){
 63  0
                 if (getTransaction().getFrom() instanceof Account)
 64  0
                         return new MutableAccountImpl((Account) getTransaction().getFrom());
 65  0
                 if (getTransaction().getFrom() instanceof BudgetCategory)
 66  0
                         return new MutableBudgetCategoryImpl((BudgetCategory) getTransaction().getFrom());
 67  0
                 if (getTransaction().getFrom() instanceof Split)
 68  0
                         return new ImmutableSplitImpl((Split) getTransaction().getFrom());
 69  0
                 return null;
 70  
         }
 71  
         public ImmutableSource getTo(){
 72  0
                 if (getTransaction().getTo() instanceof Account)
 73  0
                         return new MutableAccountImpl((Account) getTransaction().getTo());
 74  0
                 if (getTransaction().getTo() instanceof BudgetCategory)
 75  0
                         return new MutableBudgetCategoryImpl((BudgetCategory) getTransaction().getTo());
 76  0
                 if (getTransaction().getTo() instanceof Split)
 77  0
                         return new ImmutableSplitImpl((Split) getTransaction().getTo());
 78  0
                 return null;
 79  
         }
 80  
         public long getBalance(ImmutableSource source) {
 81  0
                 return getTransaction().getBalance(source.getUid());
 82  
         }
 83  
         public boolean isInflow(){
 84  0
                 return getTransaction().isInflow();
 85  
         }
 86  
         public long getAmount(){
 87  0
                 return getTransaction().getAmount();
 88  
         }
 89  
         
 90  
         @Override
 91  
         public boolean equals(Object obj) {
 92  0
                 if (obj instanceof ImmutableTransaction)
 93  0
                         return getUid().equals(((ImmutableTransaction) obj).getUid());
 94  0
                 return false;
 95  
         }
 96  
         
 97  
         public boolean isDeleted() {
 98  0
                 return getTransaction().isDeleted();
 99  
         }
 100  
 }