]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/json/ParsedLedgerTransaction.java
support both 1.14 and 1.15 JSON APIs
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / json / ParsedLedgerTransaction.java
index 62cf1d0a83fa0b662cb14f774461e413b4d6fe9b..e649b39c0195b9432ee45968065434eef62a9b19 100644 (file)
 
 package net.ktnx.mobileledger.json;
 
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
 import net.ktnx.mobileledger.model.LedgerTransaction;
-import net.ktnx.mobileledger.utils.Globals;
 
 import java.text.ParseException;
-import java.util.Date;
-import java.util.List;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class ParsedLedgerTransaction {
-    private String tdate, tdate2, tdescription, tcomment;
-    private int tindex;
-    private List<ParsedPosting> tpostings;
-    public ParsedLedgerTransaction() {
-    }
-    public String getTdate() {
-        return tdate;
-    }
-    public void setTdate(String tdate) {
-        this.tdate = tdate;
-    }
-    public String getTdate2() {
-        return tdate2;
-    }
-    public void setTdate2(String tdate2) {
-        this.tdate2 = tdate2;
-    }
-    public String getTdescription() {
-        return tdescription;
-    }
-    public void setTdescription(String tdescription) {
-        this.tdescription = tdescription;
-    }
-    public String getTcomment() {
-        return tcomment;
-    }
-    public void setTcomment(String tcomment) {
-        this.tcomment = tcomment;
-    }
-    public int getTindex() {
-        return tindex;
-    }
-    public void setTindex(int tindex) {
-        this.tindex = tindex;
-    }
-    public List<ParsedPosting> getTpostings() {
-        return tpostings;
-    }
-    public void setTpostings(List<ParsedPosting> tpostings) {
-        this.tpostings = tpostings;
-    }
-    public LedgerTransaction asLedgerTransaction() throws ParseException {
-        Date date = Globals.parseIsoDate(tdate);
-        LedgerTransaction tr = new LedgerTransaction(tindex, date, tdescription);
-
-        List<ParsedPosting> postings = tpostings;
 
-        if (postings != null) {
-            for (ParsedPosting p : postings) {
-                tr.addAccount(p.asLedgerAccount());
-            }
-        }
-        return tr;
-    }
+public interface ParsedLedgerTransaction {
+    LedgerTransaction asLedgerTransaction() throws ParseException;
 }