]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.event/src/org/simantics/event/writer/NewEvent.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.event / src / org / simantics / event / writer / NewEvent.java
index c8d5a0766d965ffd91080e9fd0a9d71e4f7acd43..cd918d908d0228ffac2daa8cc58cfbb36fef37e0 100644 (file)
@@ -1,73 +1,73 @@
-/*******************************************************************************\r
- * Copyright (c) 2012 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     Semantum Oy - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.event.writer;\r
-\r
-import org.simantics.databoard.Bindings;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteOnlyGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.event.ontology.EventResource;\r
-import org.simantics.layer0.Layer0;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class NewEvent implements EventWriteTask {\r
-\r
-    private final Resource eventInstanceOf;\r
-    private final Resource eventType;\r
-    private final int eventOrderNr;\r
-    private final String componentName;\r
-    private final double time;\r
-    private final String tag;\r
-    private final String message;\r
-    private final boolean eventReturned;\r
-\r
-    public NewEvent(Resource eventInstanceOf, Resource eventType, int eventOrderNr, String componentName, double time, String tag, String message, boolean eventReturned) {\r
-        if (eventInstanceOf == null)\r
-            throw new NullPointerException("null event instanceOf");\r
-        this.eventInstanceOf = eventInstanceOf;\r
-        this.eventType = eventType;\r
-        this.eventOrderNr = eventOrderNr;\r
-        this.componentName = componentName;\r
-        this.time = time;\r
-        this.tag = tag;\r
-        this.message = message;\r
-        this.eventReturned = eventReturned;\r
-    }\r
-\r
-    @Override\r
-    public Resource write(WriteOnlyGraph graph, Resource slice, int number) throws DatabaseException {\r
-        Layer0 L0 = graph.getService(Layer0.class);\r
-        EventResource EVENT = graph.getService(EventResource.class);\r
-\r
-        Resource event = graph.newResource();\r
-        graph.claim(event, L0.InstanceOf, null, eventInstanceOf);\r
-\r
-        graph.addLiteral(event, L0.HasName, L0.NameOf, L0.String, ""+number, Bindings.STRING);\r
-        graph.addLiteral(event, EVENT.HasTimestamp, EVENT.HasTimestamp_Inverse, EVENT.TimeStamp, time, Bindings.DOUBLE);\r
-        graph.addLiteral(event, EVENT.Event_sourceName, EVENT.Event_sourceName_Inverse, L0.String, componentName, Bindings.STRING);\r
-        if (eventType != null)\r
-            graph.claim(event, EVENT.Event_type, null, eventType);\r
-        graph.claim(slice, L0.ConsistsOf, L0.PartOf, event);\r
-\r
-        graph.addLiteral(event, EVENT.Event_index, EVENT.Event_index_Inverse, L0.Integer, eventOrderNr, Bindings.INTEGER);\r
-        graph.addLiteral(event, EVENT.Event_tag, EVENT.Event_tag_Inverse, L0.String, tag, Bindings.STRING);\r
-        graph.addLiteral(event, EVENT.Event_message, EVENT.Event_message_Inverse, L0.String, message, Bindings.STRING);\r
-\r
-        if (eventReturned)\r
-            graph.claim(event, EVENT.ReturnEvent, EVENT.ReturnEvent, event);\r
-\r
-        return event;\r
-    }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2012 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Semantum Oy - initial API and implementation
+ *******************************************************************************/
+package org.simantics.event.writer;
+
+import org.simantics.databoard.Bindings;
+import org.simantics.db.Resource;
+import org.simantics.db.WriteOnlyGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.event.ontology.EventResource;
+import org.simantics.layer0.Layer0;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class NewEvent implements EventWriteTask {
+
+    private final Resource eventInstanceOf;
+    private final Resource eventType;
+    private final int eventOrderNr;
+    private final String componentName;
+    private final double time;
+    private final String tag;
+    private final String message;
+    private final boolean eventReturned;
+
+    public NewEvent(Resource eventInstanceOf, Resource eventType, int eventOrderNr, String componentName, double time, String tag, String message, boolean eventReturned) {
+        if (eventInstanceOf == null)
+            throw new NullPointerException("null event instanceOf");
+        this.eventInstanceOf = eventInstanceOf;
+        this.eventType = eventType;
+        this.eventOrderNr = eventOrderNr;
+        this.componentName = componentName;
+        this.time = time;
+        this.tag = tag;
+        this.message = message;
+        this.eventReturned = eventReturned;
+    }
+
+    @Override
+    public Resource write(WriteOnlyGraph graph, Resource slice, int number) throws DatabaseException {
+        Layer0 L0 = graph.getService(Layer0.class);
+        EventResource EVENT = graph.getService(EventResource.class);
+
+        Resource event = graph.newResource();
+        graph.claim(event, L0.InstanceOf, null, eventInstanceOf);
+
+        graph.addLiteral(event, L0.HasName, L0.NameOf, L0.String, ""+number, Bindings.STRING);
+        graph.addLiteral(event, EVENT.HasTimestamp, EVENT.HasTimestamp_Inverse, EVENT.TimeStamp, time, Bindings.DOUBLE);
+        graph.addLiteral(event, EVENT.Event_sourceName, EVENT.Event_sourceName_Inverse, L0.String, componentName, Bindings.STRING);
+        if (eventType != null)
+            graph.claim(event, EVENT.Event_type, null, eventType);
+        graph.claim(slice, L0.ConsistsOf, L0.PartOf, event);
+
+        graph.addLiteral(event, EVENT.Event_index, EVENT.Event_index_Inverse, L0.Integer, eventOrderNr, Bindings.INTEGER);
+        graph.addLiteral(event, EVENT.Event_tag, EVENT.Event_tag_Inverse, L0.String, tag, Bindings.STRING);
+        graph.addLiteral(event, EVENT.Event_message, EVENT.Event_message_Inverse, L0.String, message, Bindings.STRING);
+
+        if (eventReturned)
+            graph.claim(event, EVENT.ReturnEvent, EVENT.ReturnEvent, event);
+
+        return event;
+    }
+
+}