X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.event%2Fsrc%2Forg%2Fsimantics%2Fevent%2Futil%2FAllEventLogs.java;fp=bundles%2Forg.simantics.event%2Fsrc%2Forg%2Fsimantics%2Fevent%2Futil%2FAllEventLogs.java;h=0346036a9a2da15cec78fe88d0fbb6a1cdae124a;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.event/src/org/simantics/event/util/AllEventLogs.java b/bundles/org.simantics.event/src/org/simantics/event/util/AllEventLogs.java new file mode 100644 index 000000000..0346036a9 --- /dev/null +++ b/bundles/org.simantics.event/src/org/simantics/event/util/AllEventLogs.java @@ -0,0 +1,35 @@ +package org.simantics.event.util; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.common.request.ObjectsWithType; +import org.simantics.db.common.request.ResourceRead; +import org.simantics.db.exception.DatabaseException; +import org.simantics.event.ontology.EventResource; + +/** + * Request for getting all event logs from a model. + * + * @author Tuukka Lehtonen + */ +public class AllEventLogs extends ResourceRead> { + + public AllEventLogs(Resource model) { + super(model); + } + + @Override + public Collection perform(ReadGraph graph) throws DatabaseException { + EventResource EVENT = EventResource.getInstance(graph); + List result = new ArrayList(); + for (Resource eventLog : graph.syncRequest(new ObjectsWithType(resource, EVENT.HasEventLog, EVENT.EventLog))) { + result.add(eventLog); + } + return result; + } + +}