Search in sources :

Example 1 with ClusterInfoDetail

use of com.webank.wedatasphere.qualitis.metadata.response.cluster.ClusterInfoDetail in project Qualitis by WeBankFinTech.

the class MetaDataServiceImpl method getUserCluster.

@Override
public GeneralResponse<GetAllClusterResponse<ClusterInfoDetail>> getUserCluster(GetUserClusterRequest request) throws UnExpectedRequestException, MetaDataAcquireFailedException {
    // Check Arguments
    checkRequest(request);
    // Get login user
    String userName = HttpUtils.getUserName(httpServletRequest);
    GetClusterByUserRequest getClusterByUserRequest = new GetClusterByUserRequest(userName, request.getStartIndex(), request.getPageSize());
    DataInfo<ClusterInfoDetail> response = metaDataClient.getClusterByUser(getClusterByUserRequest);
    GetAllClusterResponse<ClusterInfoDetail> result = new GetAllClusterResponse<>();
    result.setOptionalClusters(ruleLimitationService.getLimitClusters());
    result.setTotal(response.getTotalCount());
    result.setData(response.getContent());
    LOGGER.info("Succeed to get cluster. response: {}", result);
    return new GeneralResponse<>("200", "{&GET_CLUSTER_SUCCESSFULLY}", result);
}
Also used : GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) ClusterInfoDetail(com.webank.wedatasphere.qualitis.metadata.response.cluster.ClusterInfoDetail) GetClusterByUserRequest(com.webank.wedatasphere.qualitis.metadata.request.GetClusterByUserRequest) GetAllClusterResponse(com.webank.wedatasphere.qualitis.response.GetAllClusterResponse)

Example 2 with ClusterInfoDetail

use of com.webank.wedatasphere.qualitis.metadata.response.cluster.ClusterInfoDetail in project Qualitis by WeBankFinTech.

the class MetaDataClientImpl method getClusterByUser.

@Override
public DataInfo<ClusterInfoDetail> getClusterByUser(GetClusterByUserRequest request) {
    Long total = clusterInfoDao.countAll();
    List<ClusterInfo> allCluster = clusterInfoDao.findAllClusterInfo(request.getStartIndex(), request.getPageSize());
    DataInfo<ClusterInfoDetail> dataInfo = new DataInfo<>(total.intValue());
    if (CollectionUtils.isEmpty(allCluster)) {
        return dataInfo;
    }
    List<ClusterInfoDetail> details = new ArrayList<>();
    for (ClusterInfo clusterInfo : allCluster) {
        ClusterInfoDetail detail = new ClusterInfoDetail(clusterInfo.getClusterName());
        details.add(detail);
    }
    dataInfo.setContent(details);
    return dataInfo;
}
Also used : DataInfo(com.webank.wedatasphere.qualitis.metadata.response.DataInfo) ClusterInfoDetail(com.webank.wedatasphere.qualitis.metadata.response.cluster.ClusterInfoDetail) ClusterInfo(com.webank.wedatasphere.qualitis.entity.ClusterInfo) ArrayList(java.util.ArrayList)

Aggregations

ClusterInfoDetail (com.webank.wedatasphere.qualitis.metadata.response.cluster.ClusterInfoDetail)2 ClusterInfo (com.webank.wedatasphere.qualitis.entity.ClusterInfo)1 GetClusterByUserRequest (com.webank.wedatasphere.qualitis.metadata.request.GetClusterByUserRequest)1 DataInfo (com.webank.wedatasphere.qualitis.metadata.response.DataInfo)1 GeneralResponse (com.webank.wedatasphere.qualitis.response.GeneralResponse)1 GetAllClusterResponse (com.webank.wedatasphere.qualitis.response.GetAllClusterResponse)1 ArrayList (java.util.ArrayList)1