--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.db.impl.exception;\r
+\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.exception.ManyObjectsForFunctionalRelationException;\r
+import org.simantics.db.impl.ResourceImpl;\r
+import org.simantics.db.impl.graph.ReadGraphImpl;\r
+import org.simantics.db.impl.support.ResourceSupport;\r
+import org.simantics.layer0.Layer0;\r
+\r
+public class ManyObjectsForFunctionalRelationExceptionImpl extends ManyObjectsForFunctionalRelationException {\r
+\r
+ private static final long serialVersionUID = 804263533707864050L;\r
+ \r
+ static String name(ReadGraphImpl graph, int subject) throws DatabaseException {\r
+ Layer0 b = Layer0.getInstance(graph);\r
+ ResourceSupport support = graph.getService(ResourceSupport.class);\r
+ Resource r = new ResourceImpl(support, subject);\r
+ String name = graph.getPossibleRelatedValue(r, b.HasName, Bindings.STRING);\r
+ return name;\r
+ }\r
+ \r
+ public ManyObjectsForFunctionalRelationExceptionImpl(ReadGraphImpl graph, ManyObjectsForFunctionalRelationException source) throws DatabaseException {\r
+ super("subject='" + name(graph, source.getIndex(0)) + "'");\r
+ }\r
+\r
+}\r