]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/RunRemover.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / adapters / RunRemover.java
index 16754153649c8477b00604363a2ff34ce7f25a59..fcc35b68ee62206aa9ae0cb941ecc7ffaa8ace08 100644 (file)
@@ -1,82 +1,82 @@
-/*******************************************************************************\r
- * Copyright (c) 2012 Association for Decentralized Information Management in\r
- * 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.modeling.adapters;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.adapter.impl.AbstractRemover;\r
-import org.simantics.db.layer0.adapter.impl.EntityRemover;\r
-\r
-public class RunRemover extends AbstractRemover {\r
-\r
-    public RunRemover(Resource resource) {\r
-        super(resource);\r
-    }\r
-\r
-    @Override\r
-    public void remove(WriteGraph graph) throws DatabaseException {\r
-        System.out.println("TODO: implement run removal properly");\r
-        EntityRemover.remove(graph, resource);\r
-//        File experimentDir = experiment.getExperimentDir();\r
-//        File resultDir = new File(experimentDir, URIUtil.encodeURI(sessionName));\r
-//\r
-//        File resultDir = getResultDir();\r
-//        try {\r
-//            if (!resultDir.exists())\r
-//                throw new DatabaseException("The experiment result doesn't exist. already deleted?");\r
-//            FileUtils.deleteAll(resultDir);\r
-//        } catch (IOException e) {\r
-//            throw new DatabaseException("Cannot delete " + resultDir.getName() + " "+e.getMessage(), e);\r
-//        }\r
-    }\r
-\r
-//    public static final Pattern RESULT_DIR_PATTERN = Pattern.compile(".*result(\\d+)/?");\r
-//\r
-//    public static String fileHistoryToReadableName(String sourceUrl)\r
-//    {\r
-//        Matcher m = RESULT_DIR_PATTERN.matcher(sourceUrl);\r
-//        if (!m.matches()) return sourceUrl;\r
-//        String decoded = m.group(1);\r
-//        try {\r
-//            long timestamp = Long.valueOf(decoded);\r
-//            Date date = new Date(timestamp);\r
-//            decoded = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(date);\r
-//            return decoded;\r
-//        } catch (NumberFormatException e) {\r
-//            return decoded;\r
-//        }\r
-//    }\r
-//\r
-//    /**\r
-//     * Convert session name into readable name.\r
-//     * Time stamp is convereted to Human readable date time.\r
-//     *\r
-//     * @param sessionName e.g. result323123\r
-//     * @return 12.5.2008 16:00:20 CET\r
-//     */\r
-//    public static String sessionToReadableName(String sessionName)\r
-//    {\r
-//        Matcher m = RESULT_DIR_PATTERN.matcher(sessionName);\r
-//        if (!m.matches()) return sessionName;\r
-//        String decoded = m.group(1);\r
-//        try {\r
-//            long timestamp = Long.valueOf(decoded);\r
-//            Date date = new Date(timestamp);\r
-//            decoded = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(date);\r
-//            return decoded;\r
-//        } catch (NumberFormatException e) {\r
-//            return sessionName;\r
-//        }\r
-//    }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2012 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.modeling.adapters;
+
+import org.simantics.db.Resource;
+import org.simantics.db.WriteGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.adapter.impl.AbstractRemover;
+import org.simantics.db.layer0.adapter.impl.EntityRemover;
+
+public class RunRemover extends AbstractRemover {
+
+    public RunRemover(Resource resource) {
+        super(resource);
+    }
+
+    @Override
+    public void remove(WriteGraph graph) throws DatabaseException {
+        System.out.println("TODO: implement run removal properly");
+        EntityRemover.remove(graph, resource);
+//        File experimentDir = experiment.getExperimentDir();
+//        File resultDir = new File(experimentDir, URIUtil.encodeURI(sessionName));
+//
+//        File resultDir = getResultDir();
+//        try {
+//            if (!resultDir.exists())
+//                throw new DatabaseException("The experiment result doesn't exist. already deleted?");
+//            FileUtils.deleteAll(resultDir);
+//        } catch (IOException e) {
+//            throw new DatabaseException("Cannot delete " + resultDir.getName() + " "+e.getMessage(), e);
+//        }
+    }
+
+//    public static final Pattern RESULT_DIR_PATTERN = Pattern.compile(".*result(\\d+)/?");
+//
+//    public static String fileHistoryToReadableName(String sourceUrl)
+//    {
+//        Matcher m = RESULT_DIR_PATTERN.matcher(sourceUrl);
+//        if (!m.matches()) return sourceUrl;
+//        String decoded = m.group(1);
+//        try {
+//            long timestamp = Long.valueOf(decoded);
+//            Date date = new Date(timestamp);
+//            decoded = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(date);
+//            return decoded;
+//        } catch (NumberFormatException e) {
+//            return decoded;
+//        }
+//    }
+//
+//    /**
+//     * Convert session name into readable name.
+//     * Time stamp is convereted to Human readable date time.
+//     *
+//     * @param sessionName e.g. result323123
+//     * @return 12.5.2008 16:00:20 CET
+//     */
+//    public static String sessionToReadableName(String sessionName)
+//    {
+//        Matcher m = RESULT_DIR_PATTERN.matcher(sessionName);
+//        if (!m.matches()) return sessionName;
+//        String decoded = m.group(1);
+//        try {
+//            long timestamp = Long.valueOf(decoded);
+//            Date date = new Date(timestamp);
+//            decoded = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(date);
+//            return decoded;
+//        } catch (NumberFormatException e) {
+//            return sessionName;
+//        }
+//    }
+
+}