use of com.webank.wedatasphere.qualitis.project.response.ProjectEventResponse in project Qualitis by WeBankFinTech.
the class ProjectServiceImpl method getProjectEvents.
@Override
public GeneralResponse<GetAllResponse<ProjectEventResponse>> getProjectEvents(Long projectId, Integer typeId, PageRequest pageRequest) throws UnExpectedRequestException, PermissionDeniedRequestException {
PageRequest.checkRequest(pageRequest);
String loginUser = HttpUtils.getUserName(httpServletRequest);
// Check project existence.
Project projectInDb = checkProjectExistence(projectId, loginUser);
List<Integer> permissions = new ArrayList<>();
permissions.add(ProjectUserPermissionEnum.BUSSMAN.getCode());
checkProjectPermission(projectInDb, loginUser, permissions);
List<ProjectEvent> projectEvents = projectEventDao.find(pageRequest.getPage(), pageRequest.getSize(), projectInDb, typeId);
long total = projectEventDao.count(projectInDb, typeId);
List<ProjectEventResponse> projectEventResponses = new ArrayList<>(projectEvents.size());
for (ProjectEvent projectEvent : projectEvents) {
ProjectEventResponse projectEventResponse = new ProjectEventResponse(projectEvent);
projectEventResponses.add(projectEventResponse);
}
GetAllResponse<ProjectEventResponse> response = new GetAllResponse<>(total, projectEventResponses);
return new GeneralResponse<>("200", "{&SUCCESS_TO_GET_PROJECT_EVENT}", response);
}
Aggregations