Exemplo n.º 1
0
 private List<QifTransaction> fromTransactions(
     List<Transaction> transactions,
     Map<Long, Category> categoriesMap,
     Map<Long, Account> accountsMap) {
   List<QifTransaction> qifTransactions = new ArrayList<QifTransaction>(transactions.size());
   for (Transaction transaction : transactions) {
     QifTransaction qifTransaction =
         QifTransaction.fromTransaction(transaction, categoriesMap, accountsMap);
     qifTransactions.add(qifTransaction);
   }
   return qifTransactions;
 }
Exemplo n.º 2
0
 private void writeTransactionsForAccount(
     QifBufferedWriter qifWriter, QifAccount qifAccount, Account account) throws IOException {
   Cursor c = getBlotterForAccount(account);
   try {
     boolean addHeader = true;
     while (c.moveToNext()) {
       if (addHeader) {
         qifWriter.write("!Type:").write(qifAccount.type).newLine();
         addHeader = false;
       }
       QifTransaction qifTransaction = QifTransaction.fromBlotterCursor(c, categoriesMap);
       if (qifTransaction.isSplit()) {
         List<QifTransaction> qifSplits =
             fromTransactions(
                 em.getSplitsForTransaction(qifTransaction.id), categoriesMap, accountsMap);
         qifTransaction.setSplits(qifSplits);
       }
       qifTransaction.writeTo(qifWriter, options);
     }
   } finally {
     c.close();
   }
 }