adding algorithm debug statments. fixing / improving build
[Bookkeeping.git] / src / com / interrupt / bookkeeping / cc / executor / LoadHelper.java
blobf930182f1acf0511b2f2a23a84f6c5b468765d7d
1 package com.interrupt.bookkeeping.cc.executor;
4 import org.apache.log4j.Logger;
6 import com.interrupt.bob.base.Bob;
7 import com.interrupt.bob.base.IBob;
8 import com.interrupt.bookkeeping.cc.CommandOptionVisitor;
9 import com.interrupt.bookkeeping.cc.ExpressionVisitor;
10 import com.interrupt.bookkeeping.cc.bkell.Bkell;
11 import com.interrupt.bookkeeping.cc.bkell.aauth.Aauthentication;
12 import com.interrupt.bookkeeping.cc.bkell.command.IResult;
13 import com.interrupt.bookkeeping.cc.bkell.command.LoadCommand;
14 import com.interrupt.bookkeeping.cc.node.AOptsCommandInput;
15 import com.interrupt.bookkeeping.cc.node.AXmlCommandInput;
16 //import com.interrupt.bookkeeping.cc.node.AXpathCommandInput;
17 import com.interrupt.bookkeeping.system.BookkeepingSystemProperties;
18 import com.interrupt.bookkeeping.users.IUser;
19 import com.interrupt.bookkeeping.users.User;
20 import com.interrupt.bookkeeping.util.Util;
22 public class LoadHelper extends AbstractHelper {
25 private Logger logger = Logger.getLogger(LoadHelper.class);
26 public static IResult execute(IUser user, LoadCommand loadCommand, AXmlCommandInput cinput) {
28 String cinput_s = cinput.toString();
30 /** filter XML to get rid of spaces
32 String input_3 = Util.filterSpacesFromXML(cinput_s);
33 Logger.getLogger(LoadHelper.class).debug("LoadHelper / CommandInput / XML["+input_3+"]"); //** generate token, option, input
34 Logger.getLogger(LoadHelper.class).debug(loadCommand.toXML(false));
36 // setup command
37 Bob bob = new Bob();
38 IBob created = bob.load( input_3, BookkeepingSystemProperties.instance().getProperty("bob.def") );
39 loadCommand.addTokenLiteral(created);
41 // execute command
42 IResult result = loadCommand.execute(user);
43 return result;
45 public static IResult execute(IUser user, LoadCommand loadCommand, AOptsCommandInput cinput) {
47 CommandOptionVisitor covisitor = new CommandOptionVisitor();
48 covisitor.setCommand(loadCommand);
49 cinput.apply(covisitor);
51 // execute command
52 Logger.getLogger(LoadHelper.class).debug(loadCommand);
54 IResult result = loadCommand.execute(user);
55 return result;
57 //public static IResult execute(IUser user, LoadCommand loadCommand, AXpathCommandInput cinput) {
58 public static IResult execute(IUser user, LoadCommand loadCommand, Object cinput) {
60 IResult result = loadCommand.execute(user);
61 return result;
65 public static void main(String args[]) {
67 LoadHelper.reparse("<debit xmlns='com/interrupt/bookkeeping/account' id='def' amount='1.50' />");