34
|
1 package alice.jungle.codesegment;
|
|
2
|
40
|
3 import java.io.IOException;
|
|
4
|
|
5 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTree;
|
|
6 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTreeEditor;
|
|
7 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.DefaultTreeOperationLog;
|
|
8 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either;
|
|
9 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error;
|
|
10 import jungle.test.bbs.JungleManager;
|
34
|
11 import alice.codesegment.CodeSegment;
|
|
12 import alice.datasegment.CommandType;
|
|
13 import alice.datasegment.Receiver;
|
40
|
14 import alice.jungle.datasegment.store.operations.DefaultTreeOperationLogContainer;
|
34
|
15
|
|
16 public class LogUpdateCodeSegment extends CodeSegment {
|
|
17
|
39
|
18 public Receiver arg1 = ids.create(CommandType.TAKE);
|
|
19
|
|
20 public LogUpdateCodeSegment() {
|
|
21
|
|
22 }
|
|
23
|
34
|
24 public void run() {
|
40
|
25 DefaultTreeOperationLogContainer container = arg1.asClass(DefaultTreeOperationLogContainer.class);
|
|
26 DefaultTreeOperationLog log = null;
|
|
27 try {
|
|
28 log = container.convert();
|
|
29 } catch (IOException e) {
|
|
30 e.printStackTrace();
|
|
31 }
|
34
|
32
|
40
|
33 JungleManager jm = new JungleManager();
|
|
34 JungleTree tree = jm.getJungle().getTreeByName("boards");
|
|
35 JungleTreeEditor editor = tree.getTreeEditor();
|
|
36 Either<Error, JungleTreeEditor> either = jm.edit(editor, log);
|
|
37 if(either.isA()) {
|
|
38 throw new IllegalStateException();
|
|
39 }
|
|
40 editor = either.b();
|
|
41 editor.success();
|
34
|
42 }
|
|
43 }
|