1 package org.simantics.modeling.adapters;
\r
3 import org.simantics.db.Resource;
\r
4 import org.simantics.db.WriteGraph;
\r
5 import org.simantics.db.common.request.IsParent;
\r
6 import org.simantics.db.exception.DatabaseException;
\r
9 * @author Tuukka Lehtonen
\r
11 public class TypicalMasterRemover extends ExistingInstancesRemover {
\r
13 public TypicalMasterRemover(Resource resource, String typeDescription) {
\r
14 super(resource, typeDescription);
\r
18 public void remove(WriteGraph graph) throws DatabaseException {
\r
19 // In typical masters the actual typical type is defined as a part of
\r
20 // the master instance itself. Therefore we need to customize this code
\r
21 // to look for the correct type.
\r
22 for (Resource type : graph.getPrincipalTypes(resource)) {
\r
23 if (graph.syncRequest(new IsParent(resource, type))) {
\r
24 remove(graph, resource, type, resource);
\r
29 // Typical type not found. Just remove, no questions asked.
\r