1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.issues.common;
14 import java.util.List;
17 import org.simantics.db.ReadGraph;
18 import org.simantics.db.Resource;
19 import org.simantics.db.common.request.BinaryRead;
20 import org.simantics.db.common.request.ObjectsWithType;
21 import org.simantics.db.exception.DatabaseException;
22 import org.simantics.db.layer0.variable.Variable;
23 import org.simantics.operation.Layer0X;
24 import org.simantics.scl.db.SCLFunctions;
25 import org.simantics.scl.runtime.tuple.Tuple0;
26 import org.simantics.simulation.ontology.SimulationResource;
28 import gnu.trove.set.hash.THashSet;
31 * @author Tuukka Lehtonen
33 public class AllVisibleIssues extends BinaryRead<Resource, Boolean, Set<Variable>> {
35 public AllVisibleIssues(Resource project) {
36 super(project, Boolean.FALSE);
39 public AllVisibleIssues(Resource project, boolean onlyUnresolved) {
40 super(project, onlyUnresolved);
44 public Set<Variable> perform(ReadGraph graph) throws DatabaseException {
46 Layer0X L0X = Layer0X.getInstance(graph);
47 SimulationResource SIMU = SimulationResource.getInstance(graph);
48 Set<Variable> result = new THashSet<Variable>();
50 for (Resource model : graph.syncRequest(new ObjectsWithType(parameter, L0X.Activates, SIMU.Model))) {
51 result.addAll(graph.syncRequest(new ModelVisibleIssues(model, false)));
54 List<Resource> libraries = SCLFunctions.evaluateGraph("Simantics/SharedOntologies", "getSharedOntologies", graph, Tuple0.INSTANCE);
55 for (Resource library : libraries) {
56 result.addAll(graph.syncRequest(new ModelVisibleIssues(library, false)));