fix getting active activities
This commit is contained in:
parent
f0f4a2f19c
commit
a1d268a8c2
@ -92,6 +92,11 @@ public abstract class ActivityService<L extends ActivityListDto, T extends Abstr
|
|||||||
return convertPageable(findAll(offset, count), entity -> getActivityListDto(entity));
|
return convertPageable(findAll(offset, count), entity -> getActivityListDto(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public abstract PageableItems findAllActiveDto(int offset, int count);
|
||||||
|
|
||||||
|
public abstract PageableItems<T> findAllActive(int offset, int count);
|
||||||
|
|
||||||
protected abstract T copyFromDto(T t, D d) throws IOException;
|
protected abstract T copyFromDto(T t, D d) throws IOException;
|
||||||
|
|
||||||
protected abstract L getActivityListDto(T entity);
|
protected abstract L getActivityListDto(T entity);
|
||||||
|
@ -112,7 +112,8 @@ public class ConferenceService extends ActivityService<ConferenceListDto, Confer
|
|||||||
return convertPageable(findAllActive(offset, count), ConferenceDashboardDto::new);
|
return convertPageable(findAllActive(offset, count), ConferenceDashboardDto::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PageableItems<Conference> findAllActive(int offset, int count) {
|
@Override
|
||||||
|
public PageableItems<Conference> findAllActive(int offset, int count) {
|
||||||
Page<Conference> activeConferencePage = conferenceRepository
|
Page<Conference> activeConferencePage = conferenceRepository
|
||||||
.findAllActive(new OffsetablePageRequest(offset, count), new Date());
|
.findAllActive(new OffsetablePageRequest(offset, count), new Date());
|
||||||
return new PageableItems<>(activeConferencePage.getTotalElements(), activeConferencePage.getContent());
|
return new PageableItems<>(activeConferencePage.getTotalElements(), activeConferencePage.getContent());
|
||||||
|
@ -92,6 +92,7 @@ public class GrantService extends ActivityService<GrantListDto, Grant, GrantDto>
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Grant copyFromDto(Grant grant, GrantDto grantDto) throws IOException {
|
protected Grant copyFromDto(Grant grant, GrantDto grantDto) throws IOException {
|
||||||
|
grant.setId(grantDto.getId());
|
||||||
grant.setComment(grantDto.getComment());
|
grant.setComment(grantDto.getComment());
|
||||||
grant.setStatus(grantDto.getStatus() == null ? APPLICATION : grantDto.getStatus());
|
grant.setStatus(grantDto.getStatus() == null ? APPLICATION : grantDto.getStatus());
|
||||||
grant.setTitle(grantDto.getTitle());
|
grant.setTitle(grantDto.getTitle());
|
||||||
@ -157,10 +158,12 @@ public class GrantService extends ActivityService<GrantListDto, Grant, GrantDto>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PageableItems<GrantDashboardDto> findAllActiveDto(int offset, int count) {
|
public PageableItems<GrantDashboardDto> findAllActiveDto(int offset, int count) {
|
||||||
return convertPageable(findAllActive(offset, count), GrantDashboardDto::new);
|
return convertPageable(findAllActive(offset, count), GrantDashboardDto::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PageableItems<Grant> findAllActive(int offset, int count) {
|
public PageableItems<Grant> findAllActive(int offset, int count) {
|
||||||
Page<Grant> activeGrantsPage = grantRepository.findAllActive(new OffsetablePageRequest(offset, count));
|
Page<Grant> activeGrantsPage = grantRepository.findAllActive(new OffsetablePageRequest(offset, count));
|
||||||
return new PageableItems<>(activeGrantsPage.getTotalElements(), activeGrantsPage.getContent());
|
return new PageableItems<>(activeGrantsPage.getTotalElements(), activeGrantsPage.getContent());
|
||||||
|
@ -97,7 +97,8 @@ public class PaperService extends ActivityService<PaperListDto, Paper, PaperDto>
|
|||||||
return new PaperDto(entity);
|
return new PaperDto(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PageableItems<Paper> findAllActive(int offset, int count) {
|
@Override
|
||||||
|
public PageableItems<Paper> findAllActive(int offset, int count) {
|
||||||
Page<Paper> activePapersPage = paperRepository.findAllWithoutStatuses(new OffsetablePageRequest(offset, count), COMPLETED, FAILED);
|
Page<Paper> activePapersPage = paperRepository.findAllWithoutStatuses(new OffsetablePageRequest(offset, count), COMPLETED, FAILED);
|
||||||
return new PageableItems<>(activePapersPage.getTotalElements(), sortPapers(activePapersPage.getContent()));
|
return new PageableItems<>(activePapersPage.getTotalElements(), sortPapers(activePapersPage.getContent()));
|
||||||
}
|
}
|
||||||
|
@ -45,11 +45,13 @@ public class ProjectService extends ActivityService<ProjectListDto, Project, Pro
|
|||||||
this.eventService = eventService;
|
this.eventService = eventService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PageableItems<ProjectDashboardDto> findAllActiveDto(int offset, int count) {
|
public PageableItems<ProjectDashboardDto> findAllActiveDto(int offset, int count) {
|
||||||
return convertPageable(findAllActive(offset, count), ProjectDashboardDto::new);
|
return convertPageable(findAllActive(offset, count), ProjectDashboardDto::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PageableItems<Project> findAllActive(int offset, int count) {
|
@Override
|
||||||
|
public PageableItems<Project> findAllActive(int offset, int count) {
|
||||||
Page<Project> activeProjectPage = projectRepository.findAllWithoutStatuses(new OffsetablePageRequest(offset, count), CLOSED, FAILED);
|
Page<Project> activeProjectPage = projectRepository.findAllWithoutStatuses(new OffsetablePageRequest(offset, count), CLOSED, FAILED);
|
||||||
return new PageableItems<>(activeProjectPage.getTotalElements(), activeProjectPage.getContent());
|
return new PageableItems<>(activeProjectPage.getTotalElements(), activeProjectPage.getContent());
|
||||||
}
|
}
|
||||||
|
@ -243,11 +243,13 @@ public class TaskService extends ActivityService<TaskListDto, Task, TaskDto> {
|
|||||||
return newTask;
|
return newTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PageableItems<TaskDashboardDto> findAllActiveDto(int offset, int count) {
|
public PageableItems<TaskDashboardDto> findAllActiveDto(int offset, int count) {
|
||||||
return convertPageable(findAllActive(offset, count), TaskDashboardDto::new);
|
return convertPageable(findAllActive(offset, count), TaskDashboardDto::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PageableItems<Task> findAllActive(int offset, int count) {
|
@Override
|
||||||
|
public PageableItems<Task> findAllActive(int offset, int count) {
|
||||||
return findAll(offset, count);
|
return findAll(offset, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user