Search in sources :

Example 1 with ProjectRevisionDownloader

use of edu.stanford.bmir.protege.web.client.download.ProjectRevisionDownloader in project webprotege by protegeproject.

the class DownloadProjectRequestHandlerImpl method doDownload.

private void doDownload(ProjectId projectId, DownloadFormatExtension extension) {
    RevisionNumber head = RevisionNumber.getHeadRevisionNumber();
    ProjectRevisionDownloader downloader = new ProjectRevisionDownloader(projectId, head, extension);
    downloader.download();
}
Also used : ProjectRevisionDownloader(edu.stanford.bmir.protege.web.client.download.ProjectRevisionDownloader) RevisionNumber(edu.stanford.bmir.protege.web.shared.revision.RevisionNumber)

Example 2 with ProjectRevisionDownloader

use of edu.stanford.bmir.protege.web.client.download.ProjectRevisionDownloader in project webprotege by protegeproject.

the class ChangeListViewPresenter method insertChangesIntoView.

private void insertChangesIntoView(ImmutableList<ProjectChange> changes, SubjectDisplay subjectDisplay, boolean revertChangesVisible, boolean downloadVisible) {
    List<ProjectChange> projectChanges = new ArrayList<>(changes);
    Collections.sort(projectChanges, Ordering.compound(Collections.singletonList(Ordering.from(new ProjectChangeTimestampComparator()).reverse())));
    long previousTimeStamp = 0;
    for (final ProjectChange projectChange : projectChanges) {
        long changeTimeStamp = projectChange.getTimestamp();
        if (!TimeUtil.isSameCalendarDay(previousTimeStamp, changeTimeStamp)) {
            previousTimeStamp = changeTimeStamp;
            Date date = new Date(changeTimeStamp);
            view.addSeparator("\u25C9   " + messages.change_changesOn() + " " + DateTimeFormat.getFormat("EEE, d MMM yyyy").format(date));
        }
        ChangeDetailsView view = new ChangeDetailsViewImpl();
        if (subjectDisplay == SubjectDisplay.DISPLAY_SUBJECT) {
        // List<OWLEntityData> subjects = new ArrayList<>(projectChange.getSubjects());
        // Collections.sort(subjects, OWLEntityData::compareToIgnoreCase);
        // view.setSubjects(subjects);
        }
        view.setRevision(projectChange.getRevisionNumber());
        view.setAuthor(projectChange.getAuthor());
        view.setHighLevelDescription(projectChange.getSummary());
        view.setRevertRevisionVisible(false);
        if (revertChangesVisible) {
            permissionChecker.hasPermission(REVERT_CHANGES, view::setRevertRevisionVisible);
        }
        view.setRevertRevisionHandler(revisionNumber -> ChangeListViewPresenter.this.handleRevertRevision(projectChange));
        view.setDownloadRevisionHandler(revisionNumber -> {
            ProjectRevisionDownloader downloader = new ProjectRevisionDownloader(projectId.get(), revisionNumber, DownloadFormatExtension.owl);
            downloader.download();
        });
        view.setDownloadRevisionVisible(downloadVisible);
        Page<DiffElement<String, SafeHtml>> page = projectChange.getDiff();
        List<DiffElement<String, SafeHtml>> pageElements = page.getPageElements();
        view.setDiff(pageElements, (int) page.getTotalElements());
        view.setChangeCount(projectChange.getChangeCount());
        view.setTimestamp(changeTimeStamp);
        this.view.addChangeDetailsView(view);
    }
}
Also used : DiffElement(edu.stanford.bmir.protege.web.shared.diff.DiffElement) ProjectRevisionDownloader(edu.stanford.bmir.protege.web.client.download.ProjectRevisionDownloader)

Aggregations

ProjectRevisionDownloader (edu.stanford.bmir.protege.web.client.download.ProjectRevisionDownloader)2 DiffElement (edu.stanford.bmir.protege.web.shared.diff.DiffElement)1 RevisionNumber (edu.stanford.bmir.protege.web.shared.revision.RevisionNumber)1