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