use of edu.stanford.bmir.protege.web.shared.revision.RevisionNumber in project webprotege by protegeproject.
the class ChangeDetailsViewImpl method updateRevisionButtonState.
private void updateRevisionButtonState() {
String suffix;
if (revertRevisionVisible || downloadRevisionVisible) {
suffix = " \u25be";
revisionField.getElement().getStyle().setCursor(Style.Cursor.POINTER);
} else {
suffix = "";
revisionField.getElement().getStyle().setCursor(Style.Cursor.DEFAULT);
}
if (revision.isPresent()) {
revisionField.setVisible(true);
RevisionNumber num = revision.get();
revisionField.setText("R " + Integer.toString(num.getValueAsInt()) + suffix);
}
}
use of edu.stanford.bmir.protege.web.shared.revision.RevisionNumber in project webprotege by protegeproject.
the class ChangeListViewPresenter method revertChanges.
private void revertChanges(ProjectChange projectChange) {
GWT.log("Reverting revision " + projectChange.getRevisionNumber().getValue());
projectId.ifPresent(theProjectId -> {
final RevisionNumber revisionNumber = projectChange.getRevisionNumber();
dispatchServiceManager.execute(new RevertRevisionAction(theProjectId, revisionNumber), new DispatchServiceCallback<RevertRevisionResult>() {
@Override
public void handleSuccess(RevertRevisionResult revertRevisionResult) {
MessageBox.showMessage("Changes in revision " + revisionNumber.getValue() + " have been reverted");
lastAction.ifPresent(action -> setChangesForProject(action.getProjectId()));
}
});
});
}
use of edu.stanford.bmir.protege.web.shared.revision.RevisionNumber in project webprotege by protegeproject.
the class ProjectDownloadService method getHeadRevisionNumber.
private RevisionNumber getHeadRevisionNumber(@Nonnull ProjectId projectId, @Nonnull UserId userId) throws IOException {
Stopwatch stopwatch = Stopwatch.createStarted();
RevisionNumber headRevisionNumber = headRevisionNumberFinder.getHeadRevisionNumber(projectId);
logger.info("{} {} Computed head revision number ({}) in {} ms", projectId, userId, headRevisionNumber, stopwatch.elapsed(MILLISECONDS));
return headRevisionNumber;
}
use of edu.stanford.bmir.protege.web.shared.revision.RevisionNumber in project webprotege by protegeproject.
the class ProjectDownloadService method downloadProject.
public void downloadProject(@Nonnull UserId requester, @Nonnull ProjectId projectId, @Nonnull RevisionNumber revisionNumber, @Nonnull DownloadFormat downloadFormat, @Nonnull HttpServletResponse response) throws IOException {
RevisionNumber realRevisionNumber;
if (revisionNumber.isHead()) {
realRevisionNumber = getHeadRevisionNumber(projectId, requester);
} else {
realRevisionNumber = revisionNumber;
}
Path downloadPath = projectDownloadCache.getCachedDownloadPath(projectId, realRevisionNumber, downloadFormat);
createDownloadIfNecessary(requester, projectId, revisionNumber, downloadFormat, downloadPath);
transferFileToClient(projectId, requester, revisionNumber, downloadFormat, downloadPath, response);
}
use of edu.stanford.bmir.protege.web.shared.revision.RevisionNumber in project webprotege by protegeproject.
the class FileDownloadParametersTestCase method shouldParseLongMaxIntoHeadRevision.
@Test
public void shouldParseLongMaxIntoHeadRevision() {
String rev = Long.toString(Long.MAX_VALUE);
when(servletRequest.getParameter(ProjectDownloadConstants.REVISION)).thenReturn(rev);
RevisionNumber revisionNumber = parameters.getRequestedRevision();
assertThat(revisionNumber.isHead(), is(true));
}
Aggregations