1 package com
.interrupt
.bookkeeping
.cc
.bkell
.command
;
4 import java
.lang
.reflect
.InvocationTargetException
;
6 import java
.util
.Iterator
;
8 import org
.apache
.log4j
.Logger
;
10 import com
.interrupt
.bookkeeping
.journal
.Journal
;
12 import com
.interrupt
.bob
.base
.IBob
;
13 import com
.interrupt
.bob
.util
.Util
;
14 import com
.interrupt
.bookkeeping
.cc
.ExpressionVisitor
;
15 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.ITokenLiterals
;
16 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.IResult
;
17 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.GResult
;
18 import com
.interrupt
.bookkeeping
.exception
.BkellException
;
19 import com
.interrupt
.bookkeeping
.exception
.CommandException
;
20 import com
.interrupt
.bookkeeping
.journal
.IEntry
;
21 import com
.interrupt
.bookkeeping
.journal
.IJournal
;
22 import com
.interrupt
.bookkeeping
.users
.IUser
;
24 public class AddCommand
extends AddRemoveReverseCommon
{
27 private Logger logger
= Logger
.getLogger(AddCommand
.class);
36 /* execute this command, add the 'token.literals' to the 'token.reciever'
38 public IResult
execute(IUser user
) {
40 logger
.debug("AddCommand.execute: "+ this.toXML(false));
43 IBob treciever
= this.getTokenReciever();
45 ITokenLiterals tliterals
= this.getTokenLiterals();
46 List allLiterals
= tliterals
.allChildren();
47 Iterator titer
= allLiterals
.iterator();
48 IBob eachLiteral
= null;
49 while( titer
.hasNext() ) {
51 eachLiteral
= (IBob
)titer
.next();
53 Class defParams
[] = { eachLiteral
.getClass() };
54 IBob methParams
[] = { eachLiteral
};
56 logger
.debug("adding >> treceiver["+treciever
.getClass()+" / "+treciever
+"] / token["+eachLiteral
.getClass()+" / "+eachLiteral
.getTagName()
57 +"] / defParams["+defParams
+"] / methParams["+methParams
+"]");
60 Util
.evalReflectedAdd(treciever
, eachLiteral
.getTagName(), defParams
, methParams
);
62 catch(NoSuchMethodException e
) {
63 BkellException bke
= com
.interrupt
.bookkeeping
.util
.Util
.generateBkellException(e
);
66 catch(IllegalAccessException e
) {
67 BkellException bke
= com
.interrupt
.bookkeeping
.util
.Util
.generateBkellException(e
);
70 catch(InvocationTargetException e
) {
71 BkellException bke
= com
.interrupt
.bookkeeping
.util
.Util
.generateBkellException(e
);
78 //** TODO - update treciever into DB
81 IResult result
= new GResult();
82 result
.addChild(treciever
);