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.db.impl.exception;
14 import org.simantics.databoard.Bindings;
15 import org.simantics.db.Resource;
16 import org.simantics.db.exception.DatabaseException;
17 import org.simantics.db.exception.ManyObjectsForFunctionalRelationException;
18 import org.simantics.db.impl.ResourceImpl;
19 import org.simantics.db.impl.graph.ReadGraphImpl;
20 import org.simantics.db.impl.support.ResourceSupport;
21 import org.simantics.layer0.Layer0;
23 public class ManyObjectsForFunctionalRelationExceptionImpl extends ManyObjectsForFunctionalRelationException {
25 private static final long serialVersionUID = 804263533707864050L;
27 static String name(ReadGraphImpl graph, int subject) throws DatabaseException {
28 Layer0 b = Layer0.getInstance(graph);
29 ResourceSupport support = graph.getService(ResourceSupport.class);
30 Resource r = new ResourceImpl(support, subject);
31 String name = graph.getPossibleRelatedValue(r, b.HasName, Bindings.STRING);
35 public ManyObjectsForFunctionalRelationExceptionImpl(ReadGraphImpl graph, ManyObjectsForFunctionalRelationException source) throws DatabaseException {
36 super("subject='" + name(graph, source.getIndex(0)) + "'");