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;
}
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;
}
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;
}