1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
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.structural2.internal.queries;
14 import java.util.Collection;
15 import java.util.Collections;
18 import org.simantics.db.ReadGraph;
19 import org.simantics.db.Resource;
20 import org.simantics.db.common.request.BinaryRead;
21 import org.simantics.db.exception.DatabaseException;
22 import org.simantics.structural2.queries.ConnectionSet;
25 * Returns all connections that are reachable from the given ConnectionJoin
26 * excluding the provided excluded connections
28 * @author Hannu Niemistö
30 public class RelatedConnectionsOfConnectionJoin extends BinaryRead<Resource, Collection<Resource>, Set<Resource>>{
32 public RelatedConnectionsOfConnectionJoin(Resource join) {
33 super(join, Collections.<Resource>emptySet());
36 public RelatedConnectionsOfConnectionJoin(Resource join, Collection<Resource> excludedConnections) {
37 super(join, excludedConnections);
41 public Set<Resource> perform(ReadGraph g) throws DatabaseException {
42 ConnectionSet connectionSet = new ConnectionSet(g);
43 connectionSet.excludeConnections(parameter2);
44 connectionSet.addJoin(g, parameter);
45 return connectionSet.getConnections();