]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.event/src/org/simantics/event/util/AllEventLogs.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.event / src / org / simantics / event / util / AllEventLogs.java
1 package org.simantics.event.util;
2
3 import java.util.ArrayList;
4 import java.util.Collection;
5 import java.util.List;
6
7 import org.simantics.db.ReadGraph;
8 import org.simantics.db.Resource;
9 import org.simantics.db.common.request.ObjectsWithType;
10 import org.simantics.db.common.request.ResourceRead;
11 import org.simantics.db.exception.DatabaseException;
12 import org.simantics.event.ontology.EventResource;
13
14 /**
15  * Request for getting all event logs from a model.
16  * 
17  * @author Tuukka Lehtonen
18  */
19 public class AllEventLogs extends ResourceRead<Collection<Resource>> {
20
21     public AllEventLogs(Resource model) {
22         super(model);
23     }
24
25     @Override
26     public Collection<Resource> perform(ReadGraph graph) throws DatabaseException {
27         EventResource EVENT = EventResource.getInstance(graph);
28         List<Resource> result = new ArrayList<Resource>();
29         for (Resource eventLog : graph.syncRequest(new ObjectsWithType(resource, EVENT.HasEventLog, EVENT.EventLog))) {
30             result.add(eventLog);
31         }
32         return result;
33     }
34
35 }