]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.layer0.utils/src/org/simantics/layer0/utils/direct/ResourceNameUtils.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.layer0.utils / src / org / simantics / layer0 / utils / direct / ResourceNameUtils.java
index 79c9c7264a14b793eef4656896b1eff673364b48..5ff5247d05ac574a2e3ef7f3d627b40b7e638d6d 100644 (file)
@@ -1,54 +1,54 @@
-/*******************************************************************************\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.layer0.utils.direct;\r
-\r
-import org.simantics.databoard.util.URIStringUtils;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.exception.ServiceException;\r
-import org.simantics.db.exception.ValidationException;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.layer0.utils.PropertyReference;\r
-\r
-public final class ResourceNameUtils {\r
-\r
-    public static final char   NAME_PATH_DELIMITER        = '/';\r
-    public static final String NAME_PATH_DELIMITER_STRING = "" + NAME_PATH_DELIMITER;\r
-\r
-    public static String getName(ReadGraph g, Resource r) throws ValidationException, ServiceException {\r
-       Layer0 b = Layer0.getInstance(g);\r
-        String name = (String) g.getPossibleRelatedValue(r, b.HasName);\r
-        if (name == null)\r
-            return "#" + r.getResourceId();\r
-        else\r
-            return URIStringUtils.escape(name);\r
-    }\r
-\r
-    public static String getName(ReadGraph g, PropertyReference ref) throws DatabaseException {\r
-        return getName(g, ref.resources);\r
-    }\r
-\r
-    public static String getName(ReadGraph g, Resource[] ref) throws DatabaseException {\r
-        StringBuilder b = new StringBuilder();\r
-        boolean first = true;\r
-        for (Resource r : ref) {\r
-            if (first)\r
-                first = false;\r
-            else\r
-                b.append(NAME_PATH_DELIMITER);\r
-            b.append(getName(g, r));\r
-        }\r
-        return b.toString();\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.layer0.utils.direct;
+
+import org.simantics.databoard.util.URIStringUtils;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.exception.ServiceException;
+import org.simantics.db.exception.ValidationException;
+import org.simantics.layer0.Layer0;
+import org.simantics.layer0.utils.PropertyReference;
+
+public final class ResourceNameUtils {
+
+    public static final char   NAME_PATH_DELIMITER        = '/';
+    public static final String NAME_PATH_DELIMITER_STRING = "" + NAME_PATH_DELIMITER;
+
+    public static String getName(ReadGraph g, Resource r) throws ValidationException, ServiceException {
+       Layer0 b = Layer0.getInstance(g);
+        String name = (String) g.getPossibleRelatedValue(r, b.HasName);
+        if (name == null)
+            return "#" + r.getResourceId();
+        else
+            return URIStringUtils.escape(name);
+    }
+
+    public static String getName(ReadGraph g, PropertyReference ref) throws DatabaseException {
+        return getName(g, ref.resources);
+    }
+
+    public static String getName(ReadGraph g, Resource[] ref) throws DatabaseException {
+        StringBuilder b = new StringBuilder();
+        boolean first = true;
+        for (Resource r : ref) {
+            if (first)
+                first = false;
+            else
+                b.append(NAME_PATH_DELIMITER);
+            b.append(getName(g, r));
+        }
+        return b.toString();
+    }
+
 }
\ No newline at end of file