X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scenegraph.profile%2Fsrc%2Forg%2Fsimantics%2Fscenegraph%2Fprofile%2Frequest%2FProfileEntryResources.java;fp=bundles%2Forg.simantics.scenegraph.profile%2Fsrc%2Forg%2Fsimantics%2Fscenegraph%2Fprofile%2Frequest%2FProfileEntryResources.java;h=1183496f309823e83a17283706f85169ba6a48f2;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=7ccfea6a50ee5c0afae16e561fa9a198139e298d;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/request/ProfileEntryResources.java b/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/request/ProfileEntryResources.java index 7ccfea6a5..1183496f3 100644 --- a/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/request/ProfileEntryResources.java +++ b/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/request/ProfileEntryResources.java @@ -1,66 +1,66 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 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.scenegraph.profile.request; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; - -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.common.request.ResourceRead2; -import org.simantics.db.exception.DatabaseException; -import org.simantics.diagram.stubs.DiagramResource; -import org.simantics.scenegraph.profile.ProfileUtils; - -/** - * @author Tuukka Lehtonen - */ -public class ProfileEntryResources extends ResourceRead2> { - - protected DiagramResource DIA; - - public ProfileEntryResources(Resource profile, Resource entry) { - super(profile, entry); - } - - protected boolean test(ReadGraph graph, Resource activeProfile, Resource entry) throws DatabaseException { - return true; - } - - public List process(ReadGraph graph, Resource activeProfile, Resource item, List result, HashSet visited) throws DatabaseException { - List entries = ProfileUtils.getProfileChildrenFromEntries(graph, item); - for (Resource entry : entries) { - Resource children = graph.getPossibleObject(entry, DIA.HasEntries); - if (children != null) { - process(graph, activeProfile, children, result, visited); - } else { - if (test(graph, activeProfile, entry)) { - if (!visited.contains(entry)) { - result.add(entry); - visited.add(entry); - } - } - } - } - - return result; - } - - @Override - public Collection perform(ReadGraph graph) throws DatabaseException { - this.DIA = DiagramResource.getInstance(graph); - return process(graph, resource, resource2, new ArrayList(), new HashSet()); - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 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.scenegraph.profile.request; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.common.request.ResourceRead2; +import org.simantics.db.exception.DatabaseException; +import org.simantics.diagram.stubs.DiagramResource; +import org.simantics.scenegraph.profile.ProfileUtils; + +/** + * @author Tuukka Lehtonen + */ +public class ProfileEntryResources extends ResourceRead2> { + + protected DiagramResource DIA; + + public ProfileEntryResources(Resource profile, Resource entry) { + super(profile, entry); + } + + protected boolean test(ReadGraph graph, Resource activeProfile, Resource entry) throws DatabaseException { + return true; + } + + public List process(ReadGraph graph, Resource activeProfile, Resource item, List result, HashSet visited) throws DatabaseException { + List entries = ProfileUtils.getProfileChildrenFromEntries(graph, item); + for (Resource entry : entries) { + Resource children = graph.getPossibleObject(entry, DIA.HasEntries); + if (children != null) { + process(graph, activeProfile, children, result, visited); + } else { + if (test(graph, activeProfile, entry)) { + if (!visited.contains(entry)) { + result.add(entry); + visited.add(entry); + } + } + } + } + + return result; + } + + @Override + public Collection perform(ReadGraph graph) throws DatabaseException { + this.DIA = DiagramResource.getInstance(graph); + return process(graph, resource, resource2, new ArrayList(), new HashSet()); + } + +}