1 package com
.interrupt
.bookkeeping
.cc
.executor
;
3 import java
.util
.ArrayList
;
6 import org
.apache
.log4j
.Logger
;
8 import com
.interrupt
.bob
.base
.Bob
;
9 import com
.interrupt
.bob
.base
.IBob
;
10 import com
.interrupt
.bookkeeping
.cc
.analysis
.DepthFirstAdapter
;
11 import com
.interrupt
.bookkeeping
.cc
.bkell
.Bkell
;
12 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.CreateCommand
;
13 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.IResult
;
14 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.LoadCommand
;
15 import com
.interrupt
.bookkeeping
.cc
.node
.AIlist
;
16 import com
.interrupt
.bookkeeping
.cc
.node
.AIlistpart
;
17 import com
.interrupt
.bookkeeping
.cc
.node
.AOptsCommandInput
;
18 import com
.interrupt
.bookkeeping
.cc
.node
.AXmlCommandInput
;
19 import com
.interrupt
.bookkeeping
.cc
.node
.PCommandInput
;
20 import com
.interrupt
.bookkeeping
.cc
.node
.PIlistpart
;
21 import com
.interrupt
.bookkeeping
.users
.IUser
;
23 public class VisitorApplyAdd
extends DepthFirstAdapter
{
26 private IBob addee
= null;
27 private IUser user
= null;
28 private Logger logger
= Logger
.getLogger(VisitorApplyAdd
.class);
30 public IBob
getAddee() {
33 public void setAddee(IBob addee
) {
36 public IUser
getUser() {
39 public void setUser(IUser user
) {
43 public void caseAIlist(AIlist node
) {
46 if(node
.getCommandInput() != null) {
49 node
.getCommandInput().apply(this);
52 LoadCommand loadCommand
= (com
.interrupt
.bookkeeping
.cc
.bkell
.command
.LoadCommand
)
53 Bob
.make( "com.interrupt.bookkeeping.cc.bkell.command.LoadCommand" );
55 CreateCommand createCommand
= (com
.interrupt
.bookkeeping
.cc
.bkell
.command
.CreateCommand
)
56 Bob
.make( "com.interrupt.bookkeeping.cc.bkell.command.CreateCommand" );
59 PCommandInput cinput
= node
.getCommandInput();
60 IResult result
= null;
61 IBob resultBob
= null;
62 if(cinput
instanceof AXmlCommandInput
) {
64 result
= CreateHelper
.execute(user
, createCommand
, (AXmlCommandInput
)cinput
);
65 logger
.debug("caseAIlist / create result / "+ result
.toXML());
67 resultBob
= (IBob
)result
.allChildren().get(0);
68 addee
.addChild(resultBob
);
70 else if(cinput
instanceof AOptsCommandInput
) {
72 result
= LoadHelper
.execute(user
, loadCommand
, (AOptsCommandInput
)cinput
);
73 logger
.debug("caseAIlist / load result / "+ result
.toXML());
75 resultBob
= (IBob
)result
.allChildren().get(0);
76 addee
.addChild(resultBob
);
81 List
<PIlistpart
> copy
= new ArrayList
<PIlistpart
>(node
.getIlistpart());
82 for(PIlistpart e
: copy
) {
89 public void caseAIlistpart(AIlistpart node
) {
92 if(node
.getListdelimiter() != null) {
93 node
.getListdelimiter().apply(this);
95 if(node
.getCommandInput() != null) {
97 node
.getCommandInput().apply(this);
99 LoadCommand loadCommand
= (com
.interrupt
.bookkeeping
.cc
.bkell
.command
.LoadCommand
)
100 Bob
.make( "com.interrupt.bookkeeping.cc.bkell.command.LoadCommand" );
102 CreateCommand createCommand
= (com
.interrupt
.bookkeeping
.cc
.bkell
.command
.CreateCommand
)
103 Bob
.make( "com.interrupt.bookkeeping.cc.bkell.command.CreateCommand" );
106 PCommandInput cinput
= node
.getCommandInput();
107 IResult result
= null;
108 IBob resultBob
= null;
109 if(cinput
instanceof AXmlCommandInput
) {
111 result
= CreateHelper
.execute(user
, createCommand
, (AXmlCommandInput
)cinput
);
112 logger
.debug("caseAIlistpart / load result / "+ result
.toXML());
114 resultBob
= (IBob
)result
.allChildren().get(0);
115 addee
.addChild(resultBob
);
117 else if(cinput
instanceof AOptsCommandInput
) {
119 result
= LoadHelper
.execute(user
, loadCommand
, (AOptsCommandInput
)cinput
);
120 logger
.debug("caseAIlistpart / load result / "+ result
.toXML());
122 resultBob
= (IBob
)result
.allChildren().get(0);
123 addee
.addChild(resultBob
);