+package org.simantics.event.util;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+import java.util.List;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.common.request.ObjectsWithType;\r
+import org.simantics.db.common.request.ResourceRead;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.event.ontology.EventResource;\r
+\r
+/**\r
+ * Request for getting all event logs from a model.\r
+ * \r
+ * @author Tuukka Lehtonen\r
+ */\r
+public class AllEventLogs extends ResourceRead<Collection<Resource>> {\r
+\r
+ public AllEventLogs(Resource model) {\r
+ super(model);\r
+ }\r
+\r
+ @Override\r
+ public Collection<Resource> perform(ReadGraph graph) throws DatabaseException {\r
+ EventResource EVENT = EventResource.getInstance(graph);\r
+ List<Resource> result = new ArrayList<Resource>();\r
+ for (Resource eventLog : graph.syncRequest(new ObjectsWithType(resource, EVENT.HasEventLog, EVENT.EventLog))) {\r
+ result.add(eventLog);\r
+ }\r
+ return result;\r
+ }\r
+\r
+}\r