-/*******************************************************************************\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.common.request;\r
-\r
-import java.util.Set;\r
-\r
-import org.simantics.databoard.Bindings;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.utils.Logger;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
-\r
-public class SuperTypeString extends BinaryRead<Resource, String, String> {\r
-\r
- public SuperTypeString(Resource type) {\r
- super(type, " ");\r
- }\r
-\r
- public SuperTypeString(Resource type, String separator) {\r
- super(type, separator);\r
- if (separator == null)\r
- throw new NullPointerException("null separator");\r
- }\r
-\r
- @Override\r
- public String perform(ReadGraph graph) throws DatabaseException {\r
- \r
- Layer0 L0 = Layer0.getInstance(graph);\r
- Set<Resource> supers = graph.getSupertypes(parameter);\r
- final StringBuilder b = new StringBuilder();\r
- String name = graph.getPossibleRelatedValue(parameter, L0.HasName, Bindings.STRING);\r
- if(name != null) {\r
- b.append(name);\r
- for (Resource r : supers) {\r
- name = graph.getPossibleRelatedValue(r, L0.HasName, Bindings.STRING);\r
- if(name != null) {\r
- b.append(parameter2);\r
- b.append(name);\r
- } else {\r
- Logger.defaultLogError(new DatabaseException("No name for type " + r));\r
- }\r
- }\r
- } else {\r
- Logger.defaultLogError(new DatabaseException("No name for type " + parameter));\r
- }\r
- \r
- return b.toString();\r
-\r
- }\r
-\r
+/*******************************************************************************
+ * 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.db.common.request;
+
+import java.util.Set;
+
+import org.simantics.databoard.Bindings;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.utils.Logger;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.layer0.Layer0;
+
+public class SuperTypeString extends BinaryRead<Resource, String, String> {
+
+ public SuperTypeString(Resource type) {
+ super(type, " ");
+ }
+
+ public SuperTypeString(Resource type, String separator) {
+ super(type, separator);
+ if (separator == null)
+ throw new NullPointerException("null separator");
+ }
+
+ @Override
+ public String perform(ReadGraph graph) throws DatabaseException {
+
+ Layer0 L0 = Layer0.getInstance(graph);
+ Set<Resource> supers = graph.getSupertypes(parameter);
+ final StringBuilder b = new StringBuilder();
+ String name = graph.getPossibleRelatedValue(parameter, L0.HasName, Bindings.STRING);
+ if(name != null) {
+ b.append(name);
+ for (Resource r : supers) {
+ name = graph.getPossibleRelatedValue(r, L0.HasName, Bindings.STRING);
+ if(name != null) {
+ b.append(parameter2);
+ b.append(name);
+ } else {
+ Logger.defaultLogError(new DatabaseException("No name for type " + r));
+ }
+ }
+ } else {
+ Logger.defaultLogError(new DatabaseException("No name for type " + parameter));
+ }
+
+ return b.toString();
+
+ }
+
}
\ No newline at end of file