X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fquery%2FAnnotationTypeProperties.java;h=2cdb19b6f973540a0f54efbdee663df083d78789;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=940dec9df34223e248e9339a7dc4a23b39ec169c;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/query/AnnotationTypeProperties.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/query/AnnotationTypeProperties.java index 940dec9df..2cdb19b6f 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/query/AnnotationTypeProperties.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/query/AnnotationTypeProperties.java @@ -1,50 +1,50 @@ -/******************************************************************************* - * 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.Collection; -import java.util.Map; - -import org.simantics.databoard.Bindings; -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.common.request.ResourceRead; -import org.simantics.db.exception.DatabaseException; -import org.simantics.layer0.Layer0; - -/** - * @author Tuukka Lehtonen - */ -public class AnnotationTypeProperties extends ResourceRead> { - - public AnnotationTypeProperties(Resource annotationType) { - super(annotationType); - } - - @Override - public Map perform(ReadGraph graph) throws DatabaseException { - Layer0 L0 = Layer0.getInstance(graph); - Collection children = graph.getObjects(resource, L0.ConsistsOf); - Map properties = new THashMap(children.size()); - for (Resource child : children) { - if (graph.isSubrelationOf(child, L0.HasProperty)) { - String name = graph.getPossibleRelatedValue2(child, L0.HasName, Bindings.STRING); - if (name != null) - properties.put(name, child); - } - } - return properties; - } - -} +/******************************************************************************* + * 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.Collection; +import java.util.Map; + +import org.simantics.databoard.Bindings; +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.common.request.ResourceRead; +import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; + +/** + * @author Tuukka Lehtonen + */ +public class AnnotationTypeProperties extends ResourceRead> { + + public AnnotationTypeProperties(Resource annotationType) { + super(annotationType); + } + + @Override + public Map perform(ReadGraph graph) throws DatabaseException { + Layer0 L0 = Layer0.getInstance(graph); + Collection children = graph.getObjects(resource, L0.ConsistsOf); + Map properties = new THashMap(children.size()); + for (Resource child : children) { + if (graph.isSubrelationOf(child, L0.HasProperty)) { + String name = graph.getPossibleRelatedValue2(child, L0.HasName, Bindings.STRING); + if (name != null) + properties.put(name, child); + } + } + return properties; + } + +}