--- /dev/null
+package org.simantics.event.util;\r
+\r
+import java.util.UUID;\r
+\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.event.ontology.EventResource;\r
+import org.simantics.layer0.Layer0;\r
+\r
+public class EventUtils {\r
+\r
+ public static final int MAX_EVENTS = 1000;\r
+ public static final int SLICE_SIZE = 64;\r
+ public static final int KEEPS_SLICES = (MAX_EVENTS / SLICE_SIZE) + 2;\r
+ public static final String MAX_SLICE_NAME = "" + (SLICE_SIZE-1);\r
+\r
+ public static Resource createLog(WriteGraph graph) throws DatabaseException {\r
+ Layer0 L0 = Layer0.getInstance(graph);\r
+ EventResource EVENT = EventResource.getInstance(graph);\r
+ Resource log = graph.newResource();\r
+ graph.claim(log, L0.InstanceOf, null, EVENT.EventLog);\r
+ graph.claimLiteral(log, L0.HasName, UUID.randomUUID().toString(), Bindings.STRING);\r
+ graph.claimLiteral(log, EVENT.HasModificationCounter, 0, Bindings.INTEGER);\r
+ return log;\r
+ }\r
+ \r
+}\r