sync
[Bookkeeping.git] / src / com / interrupt / bookkeeping / cc / executor / CreateExecutor.java
blob3c10cb3c87bd792cf2c65640dfe018ab0e25a13a
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.node.ACreateCommand3;
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.cc.node.Node;
18 import com.interrupt.bookkeeping.cc.node.PCommandInput;
19 import com.interrupt.bookkeeping.users.IUser;
20 import com.interrupt.bookkeeping.util.Util;
22 public class CreateExecutor extends Executor {
25 private Logger logger = Logger.getLogger(CreateExecutor.class);
26 private IBob parentToInject = null;
27 public IBob getParentToInject() {
28 return parentToInject;
30 public void setParentToInject(IBob parentToInject) {
31 this.parentToInject = parentToInject;
35 public IResult execute(IUser user, Node node) {
38 ACreateCommand3 nodeCasted = (ACreateCommand3)node;
40 /** I'm interested in the command input
41 */
42 PCommandInput cinput = nodeCasted.getCommandInput();
43 String cinput_s = cinput.toString();
45 CreateCommand createCommand = (com.interrupt.bookkeeping.cc.bkell.command.CreateCommand)
46 Bob.make( "com.interrupt.bookkeeping.cc.bkell.command.CreateCommand" );
47 createCommand.setParent(parentToInject); //** TODO - kludge kludge kludge
48 createCommand.setAauthentication(this.getAauthenticationToInject());
50 IResult result = null;
51 if(cinput instanceof AXmlCommandInput) {
53 result = CreateHelper.execute(user, createCommand, (AXmlCommandInput)cinput);
55 else if(cinput instanceof AOptsCommandInput) {
57 result = CreateHelper.execute(user, createCommand, (AOptsCommandInput)cinput);
59 else if(cinput instanceof AXpathCommandInput) {
61 result = CreateHelper.execute(user, createCommand, (AXpathCommandInput)cinput);
64 return result;