import org.simantics.db.exception.DatabaseException;
import org.simantics.diagram.stubs.DiagramResource;
import org.simantics.layer0.Layer0;
-import org.simantics.scenegraph.profile.request.ProfileActiveEntryResources;
+import org.simantics.simulation.ontology.SimulationResource;
public class ProfileUtils {
if(profile.equals(ref)) return state;
}
return null;
-
+
}
-
+
public static Resource claimProfileActivationState(WriteGraph graph, Resource runtimeDiagram, Resource runtimeProfile, Resource entry) throws DatabaseException {
Layer0 L0 = Layer0.getInstance(graph);
DiagramResource DIA = DiagramResource.getInstance(graph);
graph.claim(indexRoot, L0.ConsistsOf, state);
return state;
}
-
-
+
+ public static boolean isActive(ReadGraph graph, Resource runtimeDiagram, Resource profile, Resource entry) throws DatabaseException {
+ DiagramResource DIA = DiagramResource.getInstance(graph);
+ SimulationResource SIMU = SimulationResource.getInstance(graph);
+ if(graph.isInstanceOf(entry, DIA.ProfileEntry)) {
+ if(graph.isImmutable(profile)) {
+ Resource state = getPossibleProfileActivationState(graph, runtimeDiagram, profile);
+ if(state != null && graph.hasStatement(state, SIMU.IsActive, entry)) return true;
+ } else {
+ if(graph.hasStatement(profile, SIMU.IsActive, entry)) return true;
+ }
+ }
+ return false;
+ }
+
}