use of edu.stanford.bmir.protege.web.shared.entity.ChangeEntityIRIResult in project webprotege by protegeproject.
the class ChangeEntityIRIActionHandler method execute.
@Nonnull
@Override
public ChangeEntityIRIResult execute(@Nonnull ChangeEntityIRIAction action, @Nonnull ExecutionContext executionContext) {
OWLEntityRenamer renamer = new OWLEntityRenamer(rootOntology.getOWLOntologyManager(), rootOntology.getImportsClosure());
List<OWLOntologyChange> changeList = renamer.changeIRI(action.getEntity(), action.getTheNewIri());
OWLEntityData oldRendering = renderer.getRendering(action.getEntity());
applyChanges.applyChanges(executionContext.getUserId(), new FixedChangeListGenerator<>(changeList, action.getEntity(), String.format("Changed %s IRI from %s to %s", action.getEntity().getEntityType().getPrintName(), action.getEntity().getIRI(), action.getTheNewIri())));
OWLEntity theNewEntity = dataFactory.getOWLEntity(action.getEntity().getEntityType(), action.getTheNewIri());
discussionThreadRepository.replaceEntity(projectId, action.getEntity(), theNewEntity);
OWLEntityData newRendering = renderer.getRendering(theNewEntity);
return new ChangeEntityIRIResult(projectId, oldRendering, newRendering);
}
Aggregations