]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/FailingRemover.java
Prevent paste to resources that are `L0.Entity_published`
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / adapter / impl / FailingRemover.java
1 /*******************************************************************************
2  * Copyright (c) 2013 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  *     Semantum Oy - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.db.layer0.adapter.impl;
13
14 import org.simantics.db.ReadGraph;
15 import org.simantics.db.WriteGraph;
16 import org.simantics.db.exception.DatabaseException;
17 import org.simantics.db.layer0.adapter.Remover;
18
19 /**
20  * A {@link Remover} implementation that never allows removal. It uses the
21  * provided String as a reason for not allowing removal in
22  * {@link #canRemove(ReadGraph, java.util.Map)}
23  * 
24  * @author Tuukka Lehtonen
25  */
26 public class FailingRemover implements Remover {
27
28         String reason;
29
30         public FailingRemover(String reason) throws DatabaseException {
31                 this.reason = reason;
32         }
33
34         public String canRemove(ReadGraph graph, java.util.Map<Object,Object> aux) {
35                 return reason;
36         };
37
38         @Override
39         public void remove(WriteGraph graph) throws DatabaseException {
40         }
41
42 }