]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/FailingRemover.java
Sync git svn branch with SVN repository r33389.
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / adapter / impl / FailingRemover.java
1 /*******************************************************************************\r
2  * Copyright (c) 2013 Association for Decentralized Information Management in\r
3  * Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     Semantum Oy - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.db.layer0.adapter.impl;\r
13 \r
14 import org.simantics.db.ReadGraph;\r
15 import org.simantics.db.WriteGraph;\r
16 import org.simantics.db.exception.DatabaseException;\r
17 import org.simantics.db.layer0.adapter.Remover;\r
18 \r
19 /**\r
20  * A {@link Remover} implementation that never allows removal. It uses the\r
21  * provided String as a reason for not allowing removal in\r
22  * {@link #canRemove(ReadGraph, java.util.Map)}\r
23  * \r
24  * @author Tuukka Lehtonen\r
25  */\r
26 public class FailingRemover implements Remover {\r
27 \r
28         String reason;\r
29 \r
30         public FailingRemover(String reason) throws DatabaseException {\r
31                 this.reason = reason;\r
32         }\r
33 \r
34         public String canRemove(ReadGraph graph, java.util.Map<Object,Object> aux) {\r
35                 return reason;\r
36         };\r
37 \r
38         @Override\r
39         public void remove(WriteGraph graph) throws DatabaseException {\r
40         }\r
41 \r
42 }\r