|
From: Pelle B. <pe...@us...> - 2004-03-31 23:23:02
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/simple In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28687/src/java/org/neuclear/ledger/simple Modified Files: SimpleLedger.java Log Message: Reworked the ID's of the transactions. The primary ID is now the request ID. Receipt ID's are optional and added using a separate set method. The various interactive passphrase agents now have shell methods for the new interactive approach. Index: SimpleLedger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/simple/SimpleLedger.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SimpleLedger.java 29 Mar 2004 20:05:17 -0000 1.8 --- SimpleLedger.java 31 Mar 2004 23:11:09 -0000 1.9 *************** *** 4,7 **** --- 4,12 ---- * $Id$ * $Log$ + * Revision 1.9 2004/03/31 23:11:09 pelle + * Reworked the ID's of the transactions. The primary ID is now the request ID. + * Receipt ID's are optional and added using a separate set method. + * The various interactive passphrase agents now have shell methods for the new interactive approach. + * * Revision 1.8 2004/03/29 20:05:17 pelle * LedgerServlet works now at least for a straight non date restricted browse. *************** *** 125,130 **** */ public PostedTransaction performTransaction(final UnPostedTransaction trans) throws UnBalancedTransactionException, InvalidTransactionException { - if (!trans.isBalanced()) - throw new UnBalancedTransactionException(this, trans); final PostedTransaction posted = new PostedTransaction(trans, new Date()); return post(posted); --- 130,133 ---- *************** *** 132,136 **** private PostedTransaction post(final PostedTransaction posted) { ! ledger.put(posted.getId(), posted); postToBook(posted); updateBalances(posted); --- 135,139 ---- private PostedTransaction post(final PostedTransaction posted) { ! ledger.put(posted.getRequestId(), posted); postToBook(posted); updateBalances(posted); *************** *** 191,198 **** */ public PostedHeldTransaction performHeldTransfer(final UnPostedHeldTransaction trans) throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { - if (!trans.isBalanced()) - throw new UnBalancedTransactionException(this, trans); final PostedHeldTransaction posted = new PostedHeldTransaction(trans, new Date()); ! held.put(posted.getId(), posted); postToBook(posted); return posted; --- 194,199 ---- */ public PostedHeldTransaction performHeldTransfer(final UnPostedHeldTransaction trans) throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { final PostedHeldTransaction posted = new PostedHeldTransaction(trans, new Date()); ! held.put(posted.getRequestId(), posted); postToBook(posted); return posted; *************** *** 209,214 **** */ public void performCancelHold(PostedHeldTransaction hold) throws LowlevelLedgerException, UnknownTransactionException { ! if (held.containsKey(hold.getId())) ! held.remove(hold.getId()); } --- 210,215 ---- */ public void performCancelHold(PostedHeldTransaction hold) throws LowlevelLedgerException, UnknownTransactionException { ! if (held.containsKey(hold.getRequestId())) ! held.remove(hold.getRequestId()); } *************** *** 229,237 **** */ public PostedTransaction performCompleteHold(PostedHeldTransaction hold, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, TransactionExpiredException, UnknownTransactionException { ! if (!held.containsKey(hold.getId())) ! throw new UnknownTransactionException(this, hold.getId()); if (hold.getExpiryTime().before(new Date())) throw new TransactionExpiredException(this, hold); ! held.remove(hold.getId()); PostedTransaction posted = new PostedTransaction(hold, new Date(), amount, comment); return post(posted); --- 230,238 ---- */ public PostedTransaction performCompleteHold(PostedHeldTransaction hold, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, TransactionExpiredException, UnknownTransactionException { ! if (!held.containsKey(hold.getRequestId())) ! throw new UnknownTransactionException(this, hold.getRequestId()); if (hold.getExpiryTime().before(new Date())) throw new TransactionExpiredException(this, hold); ! held.remove(hold.getRequestId()); PostedTransaction posted = new PostedTransaction(hold, new Date(), amount, comment); return post(posted); *************** *** 327,330 **** --- 328,337 ---- } + public void setReceiptId(String id, String receipt) throws LowlevelLedgerException, UnknownTransactionException { + if (!ledger.containsKey(id)) + throw new UnknownTransactionException(this, id); + ((PostedTransaction) ledger.get(id)).setReceiptId(receipt); + } + public double getTestBalance() throws LowlevelLedgerException { Iterator iter = balances.keySet().iterator(); *************** *** 426,430 **** } ! setRow(tran.getId(), tran.getRequestId(), counterparty, tran.getComment(), tran.getTransactionTime(), item.getAmount(), null, null, null); } --- 433,437 ---- } ! setRow(tran.getRequestId(), counterparty, tran.getComment(), tran.getTransactionTime(), item.getAmount(), null, null, null); } |