2 package com
.interrupt
.bookkeeping
.action
;
5 import java
.util
.Iterator
;
7 import org
.apache
.log4j
.Logger
;
9 import com
.interrupt
.bob
.base
.BobSystem
;
11 import com
.interrupt
.bookkeeping
.account
.IDebit
;
12 import com
.interrupt
.bookkeeping
.account
.GDebit
;
13 import com
.interrupt
.bookkeeping
.account
.ICredit
;
14 import com
.interrupt
.bookkeeping
.account
.GCredit
;
15 import com
.interrupt
.bookkeeping
.account
.IAccount
;
16 import com
.interrupt
.bookkeeping
.account
.IAccounts
;
17 import com
.interrupt
.bookkeeping
.account
.Accounts
;
18 import com
.interrupt
.bookkeeping
.journal
.IEntry
;
19 import com
.interrupt
.bookkeeping
.journal
.Transaction
;
20 import com
.interrupt
.bookkeeping
.journal
.Entry
;
21 import com
.interrupt
.bookkeeping
.exception
.EntryException
;
22 import com
.interrupt
.bookkeeping
.exception
.AccountException
;
23 import com
.interrupt
.bookkeeping
.exception
.WorkflowException
;
24 import com
.interrupt
.bookkeeping
.users
.User
;
25 import com
.interrupt
.bookkeeping
.util
.Util
;
26 import com
.interrupt
.bookkeeping
.workflow
.StateManager
;
27 import com
.interrupt
.bob
.base
.IBob
;
28 import com
.interrupt
.bob
.base
.IVisitor
;
30 public class ReverseAction
extends AbstractAction
implements IVisitor
{
33 private Logger logger
= Logger
.getLogger(ReverseAction
.class);
34 public void execute(IBob ibob
, User user
) {
36 super.execute(ibob
, user
);
40 public void visit(IBob bob
) throws WorkflowException
{
42 logger
.debug("ReverseAction:visiting: ["+bob
.getClass()+"]");
47 String svalue
= entry
.getState();
49 throw new WorkflowException("'state' value is NULL");
51 if(!svalue
.equals(Util
.CLOSED_STATE
)) {
52 throw new WorkflowException("state of Entry["+entry
.getId()+"] must be 'CLOSED' / ["+entry
.getState()+"]");
55 StateManager smanager
= new StateManager();
56 smanager
.transition(entry
,Util
.REVERSED_STATE
);
59 catch(ClassCastException e
) {
61 // not a real error; we can only reverse <entry/>