use of org.eclipse.vorto.repository.core.ModelReferentialIntegrityException in project vorto by eclipse.
the class JcrModelRepository method removeModel.
@Override
public void removeModel(ModelId modelId) {
try {
ModelInfo modelResource = this.getById(modelId);
if (!modelResource.getReferencedBy().isEmpty()) {
throw new ModelReferentialIntegrityException("Cannot remove model because it is referenced by other model(s)", modelResource.getReferencedBy());
}
ModelIdHelper modelIdHelper = new ModelIdHelper(modelId);
Item item = session.getItem(modelIdHelper.getFullPath());
item.remove();
session.save();
} catch (RepositoryException e) {
throw new FatalModelRepositoryException("Problem occured removing the model", e);
}
}
Aggregations