]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.event/scl/Simantics/Event.scl
Merge "Fixed record constructor resolving from namespaces"
[simantics/platform.git] / bundles / org.simantics.event / scl / Simantics / Event.scl
1 import "Simantics/DB"
2 import "Simantics/Ontologies"
3
4 importJava "org.simantics.event.view.EventView" where
5     getEventLogs :: () -> <ReadGraph> [Resource]
6
7 findEvents :: <ReadGraph, Proc> [Resource]
8 findEvents = do
9     logs = getEventLogs ()
10     slices = map findEventSlices logs
11     slices = join slices
12     events = map findEventsFromSlice slices
13     join events
14
15 @private
16 findEventSlices :: Resource -> <ReadGraph, Proc> [Resource]
17 findEventSlices log = do
18     collectionToList $ objects_ log L0.ConsistsOf
19
20 @private
21 findEventsFromSlice :: Resource -> <ReadGraph, Proc> [Resource]
22 findEventsFromSlice slice = do
23     collectionToList (objects_ slice L0.ConsistsOf)
24
25 importJava "org.simantics.event.util.EventExporter" where
26     """
27         exportCurrentEvents "\t" "X:/events.txt"
28     
29     exports the currently visible events into the specified
30     text file using the specified column separator string.
31     This function should be used when invoking outside of
32     a database transaction.
33     """
34     exportCurrentEvents :: String -> String -> ()
35
36     """
37         exportCurrentEventsG "\t" "X:/events.txt"
38     
39     exports the currently visible events into the specified
40     text file using the specified column separator string.
41     This variant must be used when invoking the method with
42     DB transaction.
43     """
44     exportCurrentEventsG :: String -> String -> <ReadGraph> ()