Search in sources :

Example 1 with WorkGroup

use of org.orcid.pojo.WorkGroup in project ORCID-Source by ORCID.

the class WorksPaginator method refreshWorks.

public WorksPage refreshWorks(String orcid, int limit, String sort, boolean sortAsc) {
    Works works = worksCacheManager.getGroupedWorks(orcid);
    List<org.orcid.jaxb.model.v3.dev1.record.summary.WorkGroup> sortedGroups = sort(works.getWorkGroup(), sort, sortAsc);
    WorksPage worksPage = new WorksPage();
    worksPage.setTotalGroups(sortedGroups.size());
    List<WorkGroup> workGroups = new ArrayList<>();
    for (int i = 0; i < limit && i < sortedGroups.size(); i++) {
        org.orcid.jaxb.model.v3.dev1.record.summary.WorkGroup group = sortedGroups.get(i);
        workGroups.add(WorkGroup.valueOf(group, i, orcid));
    }
    worksPage.setWorkGroups(workGroups);
    worksPage.setNextOffset(limit);
    return worksPage;
}
Also used : ArrayList(java.util.ArrayList) WorkGroup(org.orcid.pojo.WorkGroup) Works(org.orcid.jaxb.model.v3.dev1.record.summary.Works)

Example 2 with WorkGroup

use of org.orcid.pojo.WorkGroup in project ORCID-Source by ORCID.

the class WorksPaginator method getWorksPage.

public WorksPage getWorksPage(String orcid, int offset, boolean justPublic, String sort, boolean sortAsc) {
    Works works = worksCacheManager.getGroupedWorks(orcid);
    List<org.orcid.jaxb.model.v3.dev1.record.summary.WorkGroup> filteredGroups = filter(works, justPublic);
    filteredGroups = sort(filteredGroups, sort, sortAsc);
    WorksPage worksPage = new WorksPage();
    worksPage.setTotalGroups(filteredGroups.size());
    List<WorkGroup> workGroups = new ArrayList<>();
    for (int i = offset; i < Math.min(offset + PAGE_SIZE, filteredGroups.size()); i++) {
        org.orcid.jaxb.model.v3.dev1.record.summary.WorkGroup group = filteredGroups.get(i);
        workGroups.add(WorkGroup.valueOf(group, i, orcid));
    }
    worksPage.setWorkGroups(workGroups);
    worksPage.setNextOffset(offset + PAGE_SIZE);
    return worksPage;
}
Also used : ArrayList(java.util.ArrayList) WorkGroup(org.orcid.pojo.WorkGroup) Works(org.orcid.jaxb.model.v3.dev1.record.summary.Works)

Example 3 with WorkGroup

use of org.orcid.pojo.WorkGroup in project ORCID-Source by ORCID.

the class WorksPaginator method getAllWorks.

public WorksPage getAllWorks(String orcid, String sort, boolean sortAsc) {
    Works works = worksCacheManager.getGroupedWorks(orcid);
    List<org.orcid.jaxb.model.v3.dev1.record.summary.WorkGroup> sortedGroups = sort(works.getWorkGroup(), sort, sortAsc);
    WorksPage worksPage = new WorksPage();
    worksPage.setTotalGroups(sortedGroups.size());
    List<WorkGroup> workGroups = new ArrayList<>();
    for (int i = 0; i < sortedGroups.size(); i++) {
        org.orcid.jaxb.model.v3.dev1.record.summary.WorkGroup group = sortedGroups.get(i);
        workGroups.add(WorkGroup.valueOf(group, i, orcid));
    }
    worksPage.setWorkGroups(workGroups);
    worksPage.setNextOffset(sortedGroups.size());
    return worksPage;
}
Also used : ArrayList(java.util.ArrayList) WorkGroup(org.orcid.pojo.WorkGroup) Works(org.orcid.jaxb.model.v3.dev1.record.summary.Works)

Aggregations

ArrayList (java.util.ArrayList)3 Works (org.orcid.jaxb.model.v3.dev1.record.summary.Works)3 WorkGroup (org.orcid.pojo.WorkGroup)3