Search in sources :

Example 1 with ProjectEventResponse

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);
}
Also used : GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) Project(com.webank.wedatasphere.qualitis.project.entity.Project) GetAllResponse(com.webank.wedatasphere.qualitis.response.GetAllResponse) ProjectEventResponse(com.webank.wedatasphere.qualitis.project.response.ProjectEventResponse) ProjectEvent(com.webank.wedatasphere.qualitis.project.entity.ProjectEvent)

Aggregations

Project (com.webank.wedatasphere.qualitis.project.entity.Project)1 ProjectEvent (com.webank.wedatasphere.qualitis.project.entity.ProjectEvent)1 ProjectEventResponse (com.webank.wedatasphere.qualitis.project.response.ProjectEventResponse)1 GeneralResponse (com.webank.wedatasphere.qualitis.response.GeneralResponse)1 GetAllResponse (com.webank.wedatasphere.qualitis.response.GetAllResponse)1