finished basic account add
[Bookkeeping.git] / src / com / interrupt / bookkeeping / cc / executor / CreateHelper.java
blobfdfd9982849700df2d78a820899c330a17e9ac41
1 package com.interrupt.bookkeeping.cc.executor;
3 import org.apache.log4j.Logger;
5 import com.interrupt.bob.base.BobSystem;
7 import com.interrupt.bob.base.Bob;
8 import com.interrupt.bob.base.IBob;
9 import com.interrupt.bookkeeping.cc.CommandOptionVisitor;
10 import com.interrupt.bookkeeping.cc.bkell.aauth.Aauthentication;
11 import com.interrupt.bookkeeping.cc.bkell.command.CreateCommand;
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.PIlist;
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 CreateHelper {
25 private Logger logger = Logger.getLogger(CreateHelper.class);
27 public static IResult execute(IUser user, CreateCommand createCommand, PIlist cinput) {
29 String cinput_s = cinput.toString();
30 return CreateHelper.execute(user, createCommand, cinput_s);
32 public static IResult execute(IUser user, CreateCommand createCommand, AXmlCommandInput cinput) {
34 String cinput_s = cinput.toString();
35 return CreateHelper.execute(user, createCommand, cinput_s);
37 public static IResult execute(IUser user, CreateCommand createCommand, String rawXML) {
39 /** filter XML to get rid of spaces
41 String input_3 = Util.filterSpacesFromXML(rawXML);
43 // setup command
44 IBob created = Bob.loadS( input_3, BookkeepingSystemProperties.instance().getProperty("bob.def") );
46 IBob populateResult = Util.populateEmptyIDs(created);
48 createCommand.addTokenLiteral(populateResult);
50 // execute command
51 IResult result = createCommand.execute(user);
52 return result;
56 public static IResult execute(IUser user, CreateCommand createCommand, AOptsCommandInput cinput) {
58 CommandOptionVisitor covisitor = new CommandOptionVisitor();
59 covisitor.setCommand(createCommand);
61 cinput.apply(covisitor);
63 // execute command
64 IResult result = createCommand.execute(user);
65 return result;
69 public static IResult execute(IUser user, CreateCommand createCommand, Object cinput) {
71 IResult result = createCommand.execute(user);
72 return result;