1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
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
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db.layer0.adapter.impl;
16 import org.simantics.db.ReadGraph;
17 import org.simantics.db.Resource;
18 import org.simantics.db.WriteGraph;
19 import org.simantics.db.exception.DatabaseException;
20 import org.simantics.db.layer0.adapter.Remover;
23 * @author Tuukka Lehtonen
25 public abstract class AbstractRemover implements Remover {
27 protected final Resource resource;
29 public AbstractRemover(Resource resource) {
30 this.resource = resource;
33 protected String consultPossibleCanRemove(ReadGraph graph, Resource r, Map<Object, Object> aux) throws DatabaseException {
34 Remover remover = graph.getPossibleAdapter(r, Remover.class);
35 if (remover != null) {
36 return remover.canRemove(graph, aux);
41 protected boolean consultPossibleRemover(WriteGraph graph, Resource r) throws DatabaseException {
42 Remover remover = graph.getPossibleAdapter(r, Remover.class);
43 if (remover != null) {
44 remover.remove(graph);
51 public String canRemove(ReadGraph graph, Map<Object, Object> aux) throws DatabaseException {