1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package eu.ehri.project.models.base;
21
22 import com.tinkerpop.blueprints.Vertex;
23 import com.tinkerpop.frames.modules.javahandler.JavaHandler;
24 import com.tinkerpop.frames.modules.javahandler.JavaHandlerContext;
25 import eu.ehri.project.definitions.Ontology;
26 import eu.ehri.project.models.events.SystemEvent;
27 import eu.ehri.project.models.utils.JavaHandlerUtils;
28
29
30
31
32
33
34 public interface Actioner extends Named {
35
36
37
38
39
40 @JavaHandler
41 Iterable<SystemEvent> getActions();
42
43 @JavaHandler
44 Iterable<SystemEvent> getLatestAction();
45
46
47
48
49 abstract class Impl implements JavaHandlerContext<Vertex>, Actioner {
50 public Iterable<SystemEvent> getLatestAction() {
51 return frameVertices(gremlin()
52 .out(Ontology.ACTIONER_HAS_LIFECYCLE_ACTION)
53 .out(Ontology.ACTION_HAS_EVENT));
54 }
55
56 public Iterable<SystemEvent> getActions() {
57 return frameVertices(gremlin().as("n").out(Ontology.ACTIONER_HAS_LIFECYCLE_ACTION)
58 .loop("n", JavaHandlerUtils.noopLoopFunc, JavaHandlerUtils.noopLoopFunc)
59 .out(Ontology.ACTION_HAS_EVENT));
60 }
61 }
62 }