]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/RunRemover.java
Added new field TypeId to dependency index for exact type searching
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / adapters / RunRemover.java
1 /*******************************************************************************
2  * Copyright (c) 2012 Association for Decentralized Information Management in
3  * Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.modeling.adapters;
13
14 import org.simantics.db.Resource;
15 import org.simantics.db.WriteGraph;
16 import org.simantics.db.exception.DatabaseException;
17 import org.simantics.db.layer0.adapter.impl.AbstractRemover;
18 import org.simantics.db.layer0.adapter.impl.EntityRemover;
19
20 public class RunRemover extends AbstractRemover {
21
22     public RunRemover(Resource resource) {
23         super(resource);
24     }
25
26     @Override
27     public void remove(WriteGraph graph) throws DatabaseException {
28         System.out.println("TODO: implement run removal properly");
29         EntityRemover.remove(graph, resource);
30 //        File experimentDir = experiment.getExperimentDir();
31 //        File resultDir = new File(experimentDir, URIUtil.encodeURI(sessionName));
32 //
33 //        File resultDir = getResultDir();
34 //        try {
35 //            if (!resultDir.exists())
36 //                throw new DatabaseException("The experiment result doesn't exist. already deleted?");
37 //            FileUtils.deleteAll(resultDir);
38 //        } catch (IOException e) {
39 //            throw new DatabaseException("Cannot delete " + resultDir.getName() + " "+e.getMessage(), e);
40 //        }
41     }
42
43 //    public static final Pattern RESULT_DIR_PATTERN = Pattern.compile(".*result(\\d+)/?");
44 //
45 //    public static String fileHistoryToReadableName(String sourceUrl)
46 //    {
47 //        Matcher m = RESULT_DIR_PATTERN.matcher(sourceUrl);
48 //        if (!m.matches()) return sourceUrl;
49 //        String decoded = m.group(1);
50 //        try {
51 //            long timestamp = Long.valueOf(decoded);
52 //            Date date = new Date(timestamp);
53 //            decoded = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(date);
54 //            return decoded;
55 //        } catch (NumberFormatException e) {
56 //            return decoded;
57 //        }
58 //    }
59 //
60 //    /**
61 //     * Convert session name into readable name.
62 //     * Time stamp is convereted to Human readable date time.
63 //     *
64 //     * @param sessionName e.g. result323123
65 //     * @return 12.5.2008 16:00:20 CET
66 //     */
67 //    public static String sessionToReadableName(String sessionName)
68 //    {
69 //        Matcher m = RESULT_DIR_PATTERN.matcher(sessionName);
70 //        if (!m.matches()) return sessionName;
71 //        String decoded = m.group(1);
72 //        try {
73 //            long timestamp = Long.valueOf(decoded);
74 //            Date date = new Date(timestamp);
75 //            decoded = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(date);
76 //            return decoded;
77 //        } catch (NumberFormatException e) {
78 //            return sessionName;
79 //        }
80 //    }
81
82 }