use of com.webank.wedatasphere.qualitis.response.GetAllResponse in project Qualitis by WeBankFinTech.
the class UserRoleServiceImpl method findAllUserRole.
@Override
public GeneralResponse<GetAllResponse<UserRoleResponse>> findAllUserRole(PageRequest request) throws UnExpectedRequestException {
// Check Arguments
PageRequest.checkRequest(request);
int page = request.getPage();
int size = request.getSize();
List<UserRole> userRoles = userRoleDao.findAllUserRole(page, size);
long total = userRoleDao.countAll();
List<UserRoleResponse> userRoleResponses = new ArrayList<>();
for (UserRole userRole : userRoles) {
UserRoleResponse response = new UserRoleResponse(userRole);
userRoleResponses.add(response);
}
GetAllResponse<UserRoleResponse> responses = new GetAllResponse<>();
responses.setTotal(total);
responses.setData(userRoleResponses);
LOGGER.info("Succeed to find all user_roles, response: {}, current_user: {}", responses, HttpUtils.getUserName(httpServletRequest));
return new GeneralResponse<>("200", "{&FIND_ALL_USER_ROLES_SUCCESSFULLY}", responses);
}
use of com.webank.wedatasphere.qualitis.response.GetAllResponse in project Qualitis by WeBankFinTech.
the class UserSpecPermissionServiceImpl method findAllUserSpecPermission.
@Override
public GeneralResponse<GetAllResponse<UserSpecPermissionResponse>> findAllUserSpecPermission(PageRequest request) throws UnExpectedRequestException {
// Check Arguments
PageRequest.checkRequest(request);
int page = request.getPage();
int size = request.getSize();
List<UserSpecPermission> userSpecPermissions = userSpecPermissionDao.findAllUserSpecPermission(page, size);
long total = userSpecPermissionDao.countAll();
List<UserSpecPermissionResponse> userSpecPermissionResponses = new ArrayList<>();
for (UserSpecPermission userSpecPermission : userSpecPermissions) {
UserSpecPermissionResponse tmp = new UserSpecPermissionResponse(userSpecPermission);
userSpecPermissionResponses.add(tmp);
}
GetAllResponse<UserSpecPermissionResponse> responses = new GetAllResponse<>();
responses.setTotal(total);
responses.setData(userSpecPermissionResponses);
LOGGER.info("Succeed to find user_permission. page: {}, size: {}, response: {}, current_user: {}", page, size, responses, HttpUtils.getUserName(httpServletRequest));
return new GeneralResponse<>("200", "{&FIND_USER_SPEC_PERMISSION_SUCCESSFULLY}", responses);
}
use of com.webank.wedatasphere.qualitis.response.GetAllResponse in project Qualitis by WeBankFinTech.
the class PermissionServiceImpl method getAllPermission.
@Override
public GeneralResponse<GetAllResponse<PermissionResponse>> getAllPermission(PageRequest request) throws UnExpectedRequestException {
// Check Arguments
PageRequest.checkRequest(request);
int page = request.getPage();
int size = request.getSize();
List<Permission> permissions = permissionDao.findAllPermission(page, size);
long total = permissionDao.countAll();
GetAllResponse<PermissionResponse> getAllPermissionResponse = new GetAllResponse<>();
getAllPermissionResponse.setTotal(total);
getAllPermissionResponse.setData(permissions.stream().map(p -> new PermissionResponse(p)).collect(Collectors.toList()));
LOGGER.info("Succeed to get all permission, page: {}, size: {}, permissions: {}, current_user: {}", page, size, getAllPermissionResponse, HttpUtils.getUserName(httpServletRequest));
return new GeneralResponse<>("200", "{&FIND_ALL_PERMISSIONS_SUCCESSFULLY}", getAllPermissionResponse);
}
use of com.webank.wedatasphere.qualitis.response.GetAllResponse in project Qualitis by WeBankFinTech.
the class RoleServiceImpl method getAllRole.
@Override
public GeneralResponse<GetAllResponse<RoleResponse>> getAllRole(PageRequest request) throws UnExpectedRequestException {
// Check Arguments
PageRequest.checkRequest(request);
int page = request.getPage();
int size = request.getSize();
List<Role> roles = roleDao.findAllRole(page, size);
long total = roleDao.countAll();
List<RoleResponse> roleResponses = new ArrayList<>();
for (Role role : roles) {
RoleResponse tmp = new RoleResponse(role);
roleResponses.add(tmp);
}
GetAllResponse<RoleResponse> responses = new GetAllResponse<>();
responses.setData(roleResponses);
responses.setTotal(total);
LOGGER.info("Succeed to find all roles, page: {}, size: {}, role: {}, current_user: {}", page, size, responses, HttpUtils.getUserName(httpServletRequest));
return new GeneralResponse<>("200", "{&FIND_ALL_ROLES_SUCCESSFULLY}", responses);
}
use of com.webank.wedatasphere.qualitis.response.GetAllResponse 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