use of edu.stanford.bmir.protege.web.server.revision.Revision in project webprotege by protegeproject.
the class RevisionManagerImpl_TestCase method should_addRevision.
@Test
public void should_addRevision() {
UserId userId = mock(UserId.class);
List<OWLOntologyChangeRecord> changes = Arrays.asList(new OWLOntologyChangeRecord(new OWLOntologyID(), new AddAxiomData(mock(OWLAxiom.class))));
manager.addRevision(userId, changes, HIGHLEVEL_DESC);
ArgumentCaptor<Revision> revisionCaptor = ArgumentCaptor.forClass(Revision.class);
verify(revisionStore, times(1)).addRevision(revisionCaptor.capture());
Revision addedRevision = revisionCaptor.getValue();
assertThat(addedRevision.getUserId(), is(userId));
assertThat(addedRevision.getHighLevelDescription(), is(HIGHLEVEL_DESC));
assertThat(addedRevision.getRevisionNumber(), is(nextRevisionNumber));
}
use of edu.stanford.bmir.protege.web.server.revision.Revision in project webprotege by protegeproject.
the class RevisionReverterChangeListGenerator method generateChanges.
@Override
public OntologyChangeList<Boolean> generateChanges(ChangeGenerationContext context) {
Optional<Revision> revision = revisionManager.getRevision(revisionNumber);
if (!revision.isPresent()) {
return OntologyChangeList.<Boolean>builder().build(false);
}
List<OWLOntologyChange> changes = new ArrayList<>();
for (OWLOntologyChangeRecord record : revision.get()) {
OWLOntologyChangeData revertingChangeData = changeDataReverter.getRevertingChange(record);
OWLOntologyChangeRecord revertingRecord = new OWLOntologyChangeRecord(record.getOntologyID(), revertingChangeData);
OWLOntologyManager manager = rootOntology.getOWLOntologyManager();
OWLOntologyChange change = revertingRecord.createOntologyChange(manager);
changes.add(0, change);
}
return OntologyChangeList.<Boolean>builder().addAll(changes).build(true);
}
Aggregations