public final class ActionManager extends Object
Events are captured as a linked list with new events placed
at the head. The head event is connected to a node called the
SystemEventQueue
. Events
can have subjects (the thing the event is happening to) and
actioners (the person initiating the event.) A subject's events
and an actioner's actions likewise for a linked list so it is
possible to fetch new events easily and prevent having to sort
by timestamp, etc. Schematically, the graph thus formed looks
something like:
Actioner SystemEventQueue Subject
\/ \/ \/
[lifecycleAction] [lifecycleActionStream] [lifecycleEvent]
| | |
e3--[actionHasEvent]->-- Event 3 ---[hasEvent]--<--e3
\/ \/ \/
[lifecycleAction] [lifecycleAction] [lifecycleEvent]
| | |
e2--[actionHasEvent]->-- Event 2 ---[hasEvent]--<--e2
\/ \/ \/
[lifecycleAction] [lifecycleAction] [lifecycleEvent]
| | |
e1--[actionHasEvent]->-- Event 1 ---[hasEvent]--<--e1
Modifier and Type | Class and Description |
---|---|
class |
ActionManager.EventContext
EventContext is a handle to a particular action to which additional
subjects can be added.
|
Modifier and Type | Field and Description |
---|---|
static String |
DEBUG_TYPE |
static String |
EVENT_LINK |
static String |
GLOBAL_EVENT_ROOT |
static String |
LINK_TYPE |
Constructor and Description |
---|
ActionManager(com.tinkerpop.frames.FramedGraph<?> graph)
Constructor.
|
ActionManager(com.tinkerpop.frames.FramedGraph<?> graph,
Entity scope)
Constructor with scope.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
canAggregate(SystemEvent event1,
SystemEvent event2,
int timeDiffInSeconds)
Determine if two events are the same according to the following
definition:
|
SystemEventQueue |
getEventRoot() |
SystemEvent |
getLatestGlobalEvent()
Get the latest global event.
|
Iterable<SystemEvent> |
getLatestGlobalEvents()
Get an iterable of global events in most-recent-first order.
|
static String |
getTimestamp()
Get the current time as a timestamp.
|
ActionManager.EventContext |
newEventContext(Accessible subject,
Actioner user,
EventTypes type)
Create an action for the given subject, user, and type.
|
ActionManager.EventContext |
newEventContext(Accessible subject,
Actioner user,
EventTypes type,
Optional<String> logMessage)
Create an action node that describes what user U has done with subject S
via logMessage log.
|
ActionManager.EventContext |
newEventContext(Actioner user,
EventTypes type)
Create an action node describing something that user U has done.
|
ActionManager.EventContext |
newEventContext(Actioner user,
EventTypes type,
Optional<String> logMessage)
Create an action node describing something that user U has done.
|
static boolean |
sameAs(SystemEvent event1,
SystemEvent event2) |
static boolean |
sequentialWithSameAccessor(SystemEvent first,
SystemEvent second)
Test if two events are sequential with the same actioner.
|
ActionManager |
setScope(Entity frame)
Set the scope of this action.
|
public static final String GLOBAL_EVENT_ROOT
public static final String DEBUG_TYPE
public static final String EVENT_LINK
public static final String LINK_TYPE
public ActionManager(com.tinkerpop.frames.FramedGraph<?> graph, Entity scope)
graph
- The framed graphpublic ActionManager(com.tinkerpop.frames.FramedGraph<?> graph)
graph
- The framed graphpublic SystemEventQueue getEventRoot()
public SystemEvent getLatestGlobalEvent()
public Iterable<SystemEvent> getLatestGlobalEvents()
public ActionManager.EventContext newEventContext(Actioner user, EventTypes type, Optional<String> logMessage)
user
- The actionertype
- The event typelogMessage
- An optional log messagepublic ActionManager.EventContext newEventContext(Actioner user, EventTypes type)
user
- The actionertype
- The event typepublic ActionManager.EventContext newEventContext(Accessible subject, Actioner user, EventTypes type)
subject
- The subject nodeuser
- The actionertype
- The event typepublic ActionManager.EventContext newEventContext(Accessible subject, Actioner user, EventTypes type, Optional<String> logMessage)
subject
- The subjject nodeuser
- The actionerlogMessage
- A log messagepublic ActionManager setScope(Entity frame)
frame
- The current permission scopepublic static boolean canAggregate(SystemEvent event1, SystemEvent event2, int timeDiffInSeconds)
This function allows filtering an event stream for duplicates, like someone repeatedly updating the same item.
event1
- the first eventevent2
- the second eventtimeDiffInSeconds
- the elapsed time between the eventspublic static boolean sequentialWithSameAccessor(SystemEvent first, SystemEvent second)
first
- the first temporal eventsecond
- the second temporal eventpublic static boolean sameAs(SystemEvent event1, SystemEvent event2)
public static String getTimestamp()
Copyright © 2018 The European Holocaust Research Infrastructure (EHRI). All rights reserved.