Package com.wesabe.xmlson

Examples of com.wesabe.xmlson.XmlsonObject.addProperty()


*/
public class AccountReferencePresenter {
  public XmlsonObject present(Account account) {
    // REVIEW coda@wesabe.com -- May 21, 2009: Replace account URI building once AccountResource is written
    final XmlsonObject root = new XmlsonObject("account");
    root.addProperty("uri", String.format("/accounts/%d", account.getRelativeId()));
    return root;
  }
}
View Full Code Here


public class FinancialInstPresenter {
  public FinancialInstPresenter() {}

  public XmlsonObject present(FinancialInst financialInst) {
    final XmlsonObject result = new XmlsonObject("financial-institution");
    result.addProperty("name", financialInst.getName());
    result.addProperty("id", financialInst.getWesabeId());
    return result;
  }

}
View Full Code Here

  public FinancialInstPresenter() {}

  public XmlsonObject present(FinancialInst financialInst) {
    final XmlsonObject result = new XmlsonObject("financial-institution");
    result.addProperty("name", financialInst.getName());
    result.addProperty("id", financialInst.getWesabeId());
    return result;
  }

}
View Full Code Here

   
    for (Map.Entry<Interval, MonetarySummaryWithSplits> summary : summaries.entrySet()) {
      final XmlsonObject item = new XmlsonObject("summary");
     
      final XmlsonObject interval = new XmlsonObject("interval");
      interval.addProperty("start", ISO_BASIC.print(summary.getKey().getStart()));
      interval.addProperty("end", ISO_BASIC.print(summary.getKey().getEnd()));
      item.add(interval);
      item.add(sumOfMoneyPresenter.present("spending", summary.getValue().getSpending(), locale));
      item.add(sumOfMoneyPresenter.present("earnings", summary.getValue().getEarnings(), locale));
      item.add(sumOfMoneyPresenter.present("net", summary.getValue().getNet(), locale));
View Full Code Here

    for (Map.Entry<Interval, MonetarySummaryWithSplits> summary : summaries.entrySet()) {
      final XmlsonObject item = new XmlsonObject("summary");
     
      final XmlsonObject interval = new XmlsonObject("interval");
      interval.addProperty("start", ISO_BASIC.print(summary.getKey().getStart()));
      interval.addProperty("end", ISO_BASIC.print(summary.getKey().getEnd()));
      item.add(interval);
      item.add(sumOfMoneyPresenter.present("spending", summary.getValue().getSpending(), locale));
      item.add(sumOfMoneyPresenter.present("earnings", summary.getValue().getEarnings(), locale));
      item.add(sumOfMoneyPresenter.present("net", summary.getValue().getNet(), locale));
     
View Full Code Here

      final XmlsonArray splits = new XmlsonArray("splits");
      for (Entry<Tag, MonetarySummary> entry : summary.getValue().getSplitSummaries().entrySet()) {
        final XmlsonObject splitsSummary = new XmlsonObject("split");
       
        final XmlsonObject tagName = new XmlsonObject("tag");
        tagName.addProperty("name", entry.getKey().toString());
        splitsSummary.add(tagName);
       
        splitsSummary.add(sumOfMoneyPresenter.present("spending", entry.getValue().getSpending(), locale));
        splitsSummary.add(sumOfMoneyPresenter.present("earnings", entry.getValue().getEarnings(), locale));
        splitsSummary.add(sumOfMoneyPresenter.present("net", entry.getValue().getNet(), locale));
View Full Code Here

    final XmlsonObject root = presentWithoutTransfer("transaction", txaction, locale);
   
    if (txaction.isPairedTransfer()) {
      root.add(presentWithoutTransfer("transfer", txaction.getTransferTxaction(), locale));
    } else if (txaction.isTransfer()) {
      root.addProperty("transfer", true);
    } else {
      root.addNullProperty("transfer");
    }
   
    return root;
View Full Code Here

    return root;
  }

  private XmlsonObject presentWithoutTransfer(String name, Txaction txaction, Locale locale) {
    final XmlsonObject root = new XmlsonObject(name);
    root.addProperty("id", txaction.getId());
    root.addProperty("uri", String.format("/transactions/%d", txaction.getId()));
    root.add(accountPresenter.present(txaction.getAccount()));
    root.addProperty("date", ISO_BASIC.print(txaction.getDatePosted()));
    root.addProperty("original-date", ISO_BASIC.print(txaction.getOriginalDatePosted()));
    root.add(moneyPresenter.present("amount", txaction.getAmount(), locale));
View Full Code Here

  }

  private XmlsonObject presentWithoutTransfer(String name, Txaction txaction, Locale locale) {
    final XmlsonObject root = new XmlsonObject(name);
    root.addProperty("id", txaction.getId());
    root.addProperty("uri", String.format("/transactions/%d", txaction.getId()));
    root.add(accountPresenter.present(txaction.getAccount()));
    root.addProperty("date", ISO_BASIC.print(txaction.getDatePosted()));
    root.addProperty("original-date", ISO_BASIC.print(txaction.getOriginalDatePosted()));
    root.add(moneyPresenter.present("amount", txaction.getAmount(), locale));
View Full Code Here

  private XmlsonObject presentWithoutTransfer(String name, Txaction txaction, Locale locale) {
    final XmlsonObject root = new XmlsonObject(name);
    root.addProperty("id", txaction.getId());
    root.addProperty("uri", String.format("/transactions/%d", txaction.getId()));
    root.add(accountPresenter.present(txaction.getAccount()));
    root.addProperty("date", ISO_BASIC.print(txaction.getDatePosted()));
    root.addProperty("original-date", ISO_BASIC.print(txaction.getOriginalDatePosted()));
    root.add(moneyPresenter.present("amount", txaction.getAmount(), locale));

    if (txaction.getMerchant() != null) {
      root.add(merchantPresenter.present(txaction.getMerchant()));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.