1 /*******************************************************************************
2 * Copyright (c) 2012 Association for Decentralized Information Management in
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.modeling.adapters;
14 import org.simantics.db.AsyncReadGraph;
15 import org.simantics.db.Resource;
16 import org.simantics.db.Statement;
17 import org.simantics.db.layer0.adapter.impl.TypeSubgraphExtent;
18 import org.simantics.db.procedure.AsyncProcedure;
19 import org.simantics.diagram.stubs.DiagramResource;
21 public class DiagramSubgraphExtent extends TypeSubgraphExtent {
23 final private Classifier classifier = new Classifier() {
26 public void classify(AsyncReadGraph graph, Statement statement, ExtentStatus objectExtent,
29 if(!ExtentStatus.INTERNAL.equals(objectExtent)) return;
31 Resource predicate = statement.getPredicate();
33 DiagramResource dr = graph.getService(DiagramResource.class);
34 if(dr.JoinsFlag.equalsResource(predicate)) callback.statement(statement, true);
35 else if(dr.FlagIsJoinedBy.equalsResource(predicate)) callback.statement(statement, true);
42 public void accept(AsyncReadGraph graph, Resource resource,
43 AsyncProcedure<Classifier> procedure, Callback callback) {
44 procedure.execute(graph, classifier);