Search in sources :

Example 1 with RevisionNumber

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);
    }
}
Also used : RevisionNumber(edu.stanford.bmir.protege.web.shared.revision.RevisionNumber)

Example 2 with RevisionNumber

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()));
            }
        });
    });
}
Also used : java.util(java.util) DownloadFormatExtension(edu.stanford.bmir.protege.web.shared.download.DownloadFormatExtension) ProjectRevisionDownloader(edu.stanford.bmir.protege.web.client.download.ProjectRevisionDownloader) edu.stanford.bmir.protege.web.shared.change(edu.stanford.bmir.protege.web.shared.change) GWT(com.google.gwt.core.client.GWT) DispatchServiceCallback(edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceCallback) Inject(javax.inject.Inject) UserId(edu.stanford.bmir.protege.web.shared.user.UserId) ImmutableList(com.google.common.collect.ImmutableList) CANCEL(edu.stanford.bmir.protege.web.client.library.dlg.DialogButton.CANCEL) DispatchServiceManager(edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager) MessageBox(edu.stanford.bmir.protege.web.client.library.msgbox.MessageBox) VIEW_CHANGES(edu.stanford.bmir.protege.web.shared.access.BuiltInAction.VIEW_CHANGES) Nonnull(javax.annotation.Nonnull) TimeUtil(edu.stanford.bmir.protege.web.shared.TimeUtil) Page(edu.stanford.bmir.protege.web.shared.pagination.Page) DiffElement(edu.stanford.bmir.protege.web.shared.diff.DiffElement) REVERT_CHANGES(edu.stanford.bmir.protege.web.shared.access.BuiltInAction.REVERT_CHANGES) RevisionNumber(edu.stanford.bmir.protege.web.shared.revision.RevisionNumber) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) Messages(edu.stanford.bmir.protege.web.client.Messages) DialogButton(edu.stanford.bmir.protege.web.client.library.dlg.DialogButton) LoggedInUserProjectPermissionChecker(edu.stanford.bmir.protege.web.client.permissions.LoggedInUserProjectPermissionChecker) Ordering(com.google.common.collect.Ordering) DateTimeFormat(com.google.gwt.i18n.shared.DateTimeFormat) OWLEntity(org.semanticweb.owlapi.model.OWLEntity) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) HasBusy(edu.stanford.bmir.protege.web.client.progress.HasBusy) RevisionNumber(edu.stanford.bmir.protege.web.shared.revision.RevisionNumber)

Example 3 with RevisionNumber

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;
}
Also used : Stopwatch(com.google.common.base.Stopwatch) RevisionNumber(edu.stanford.bmir.protege.web.shared.revision.RevisionNumber)

Example 4 with RevisionNumber

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);
}
Also used : Path(java.nio.file.Path) RevisionNumber(edu.stanford.bmir.protege.web.shared.revision.RevisionNumber)

Example 5 with RevisionNumber

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));
}
Also used : RevisionNumber(edu.stanford.bmir.protege.web.shared.revision.RevisionNumber) Test(org.junit.Test)

Aggregations

RevisionNumber (edu.stanford.bmir.protege.web.shared.revision.RevisionNumber)12 Test (org.junit.Test)4 Stopwatch (com.google.common.base.Stopwatch)2 ImmutableList (com.google.common.collect.ImmutableList)2 ProjectRevisionDownloader (edu.stanford.bmir.protege.web.client.download.ProjectRevisionDownloader)2 ProjectId (edu.stanford.bmir.protege.web.shared.project.ProjectId)2 UserId (edu.stanford.bmir.protege.web.shared.user.UserId)2 Nonnull (javax.annotation.Nonnull)2 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 Ordering (com.google.common.collect.Ordering)1 GWT (com.google.gwt.core.client.GWT)1 DateTimeFormat (com.google.gwt.i18n.shared.DateTimeFormat)1 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1 Messages (edu.stanford.bmir.protege.web.client.Messages)1 DispatchServiceCallback (edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceCallback)1 DispatchServiceManager (edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager)1 DialogButton (edu.stanford.bmir.protege.web.client.library.dlg.DialogButton)1 CANCEL (edu.stanford.bmir.protege.web.client.library.dlg.DialogButton.CANCEL)1 MessageBox (edu.stanford.bmir.protege.web.client.library.msgbox.MessageBox)1 LoggedInUserProjectPermissionChecker (edu.stanford.bmir.protege.web.client.permissions.LoggedInUserProjectPermissionChecker)1