holy s**tgit status I lost my most recent changes in origin/master -> trying to put...
[Bookkeeping.git] / src / com / interrupt / bookkeeping / cc / executor / LoadHelper.java
bloba0896267d8c319bfaabdcb90ffc8f910bca08597
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 {
24 private Logger logger = Logger.getLogger(LoadHelper.class);
25 public static IResult execute(IUser user, LoadCommand loadCommand, AXmlCommandInput cinput) {
27 String cinput_s = cinput.toString();
29 /** filter XML to get rid of spaces
31 String input_3 = Util.filterSpacesFromXML(cinput_s);
32 Logger.getLogger(LoadHelper.class).debug("LoadHelper / CommandInput / XML["+input_3+"]"); //** generate token, option, input
33 Logger.getLogger(LoadHelper.class).debug(loadCommand.toXML(false));
35 // setup command
36 Bob bob = new Bob();
37 IBob created = bob.load( input_3, BookkeepingSystemProperties.instance().getProperty("bob.def") );
38 loadCommand.addTokenLiteral(created);
40 // execute command
41 IResult result = loadCommand.execute(user);
42 return result;
44 public static IResult execute(IUser user, LoadCommand loadCommand, AOptsCommandInput cinput) {
46 CommandOptionVisitor covisitor = new CommandOptionVisitor();
47 covisitor.setCommand(loadCommand);
48 cinput.apply(covisitor);
50 // execute command
51 Logger.getLogger(LoadHelper.class).debug(loadCommand);
53 IResult result = loadCommand.execute(user);
54 return result;
56 //public static IResult execute(IUser user, LoadCommand loadCommand, AXpathCommandInput cinput) {
57 public static IResult execute(IUser user, LoadCommand loadCommand, Object cinput) {
59 IResult result = loadCommand.execute(user);
60 return result;
64 public static void main(String args[]) {
66 LoadHelper.reparse("<debit xmlns='com/interrupt/bookkeeping/account' id='def' amount='1.50' />");