X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fquery%2FFlagTables.java;h=6b458673e16caf7f283f19080db93a82ee53d44a;hp=a8597cc63bd7b2efcbd535d249acc5a138e3bf2b;hb=refs%2Fchanges%2F38%2F238%2F2;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/query/FlagTables.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/query/FlagTables.java index a8597cc63..6b458673e 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/query/FlagTables.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/query/FlagTables.java @@ -1,51 +1,51 @@ -/******************************************************************************* - * Copyright (c) 2012 Association for Decentralized Information Management in - * Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.diagram.query; - -import gnu.trove.map.hash.THashMap; - -import java.util.Map; - -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.common.request.ResourceRead; -import org.simantics.db.common.uri.UnescapedChildMapOfResource; -import org.simantics.db.exception.DatabaseException; -import org.simantics.modeling.template2d.ontology.Template2dResource; - -/** - * @author Tuukka Lehtonen - */ -public class FlagTables extends ResourceRead> { - - public FlagTables(Resource drawingTemplate) { - super(drawingTemplate); - } - - @Override - public Map perform(ReadGraph graph) throws DatabaseException { - Map childMap = graph.syncRequest(new UnescapedChildMapOfResource(resource)); - if (childMap.isEmpty()) - return childMap; - - Template2dResource TEMPLATE2D = Template2dResource.getInstance(graph); - Map flagTables = new THashMap(childMap.size()); - for (Map.Entry entry : childMap.entrySet()) { - if (graph.isInstanceOf(entry.getValue(), TEMPLATE2D.FlagTable)) { - flagTables.put(entry.getKey(), entry.getValue()); - } - } - - return flagTables; - } - -} +/******************************************************************************* + * Copyright (c) 2012 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.diagram.query; + +import gnu.trove.map.hash.THashMap; + +import java.util.Map; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.common.request.ResourceRead; +import org.simantics.db.common.uri.UnescapedChildMapOfResource; +import org.simantics.db.exception.DatabaseException; +import org.simantics.modeling.template2d.ontology.Template2dResource; + +/** + * @author Tuukka Lehtonen + */ +public class FlagTables extends ResourceRead> { + + public FlagTables(Resource drawingTemplate) { + super(drawingTemplate); + } + + @Override + public Map perform(ReadGraph graph) throws DatabaseException { + Map childMap = graph.syncRequest(new UnescapedChildMapOfResource(resource)); + if (childMap.isEmpty()) + return childMap; + + Template2dResource TEMPLATE2D = Template2dResource.getInstance(graph); + Map flagTables = new THashMap(childMap.size()); + for (Map.Entry entry : childMap.entrySet()) { + if (graph.isInstanceOf(entry.getValue(), TEMPLATE2D.FlagTable)) { + flagTables.put(entry.getKey(), entry.getValue()); + } + } + + return flagTables; + } + +}