Search in sources :

Example 1 with NamespaceZkClusterMappingVo

use of com.vip.saturn.job.console.domain.NamespaceZkClusterMappingVo in project Saturn by vipshop.

the class NamespaceZkClusterMappingServiceImpl method getNamespaceZkClusterMappingList.

@Override
public List<NamespaceZkClusterMappingVo> getNamespaceZkClusterMappingList() throws SaturnJobConsoleException {
    List<NamespaceZkClusterMappingVo> result = new ArrayList<>();
    List<NamespaceZkClusterMapping> namespaceZkClusterMappingList = namespaceZkclusterMapping4SqlService.getAllMappings();
    if (namespaceZkClusterMappingList != null) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        for (NamespaceZkClusterMapping tmp : namespaceZkClusterMappingList) {
            try {
                if (tmp.getIsDeleted() == 0) {
                    NamespaceZkClusterMappingVo vo = new NamespaceZkClusterMappingVo();
                    vo.setNamespace(tmp.getNamespace());
                    vo.setZkClusterKey(tmp.getZkClusterKey());
                    vo.setCreateTime(sdf.format(tmp.getCreateTime()));
                    vo.setCreatedBy(tmp.getCreatedBy());
                    vo.setLastUpdateTime(sdf.format(tmp.getLastUpdateTime()));
                    vo.setLastUpdatedBy(tmp.getLastUpdatedBy());
                    result.add(vo);
                }
            } catch (Exception e) {
                log.error(e.getMessage(), e);
            }
        }
    }
    return result;
}
Also used : NamespaceZkClusterMapping(com.vip.saturn.job.console.mybatis.entity.NamespaceZkClusterMapping) NamespaceZkClusterMappingVo(com.vip.saturn.job.console.domain.NamespaceZkClusterMappingVo) SimpleDateFormat(java.text.SimpleDateFormat) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException)

Example 2 with NamespaceZkClusterMappingVo

use of com.vip.saturn.job.console.domain.NamespaceZkClusterMappingVo in project Saturn by vipshop.

the class NamespaceZkClusterMappingController method getNamespaceZkclusterMappingList.

@RequestMapping(value = "getNamespaceZkclusterMappingList", method = RequestMethod.GET)
public RequestResult getNamespaceZkclusterMappingList(HttpServletRequest request) {
    RequestResult requestResult = new RequestResult();
    try {
        List<NamespaceZkClusterMappingVo> namespaceZkclusterMappingList = namespaceZkClusterMappingService.getNamespaceZkClusterMappingList();
        requestResult.setObj(namespaceZkclusterMappingList);
        requestResult.setSuccess(true);
    } catch (SaturnJobConsoleException e) {
        requestResult.setSuccess(false);
        requestResult.setMessage(e.getMessage());
    } catch (Throwable t) {
        LOGGER.error(t.getMessage(), t);
        requestResult.setSuccess(false);
        requestResult.setMessage(t.toString());
    }
    return requestResult;
}
Also used : RequestResult(com.vip.saturn.job.console.domain.RequestResult) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) NamespaceZkClusterMappingVo(com.vip.saturn.job.console.domain.NamespaceZkClusterMappingVo) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

NamespaceZkClusterMappingVo (com.vip.saturn.job.console.domain.NamespaceZkClusterMappingVo)2 SaturnJobConsoleException (com.vip.saturn.job.console.exception.SaturnJobConsoleException)2 RequestResult (com.vip.saturn.job.console.domain.RequestResult)1 NamespaceZkClusterMapping (com.vip.saturn.job.console.mybatis.entity.NamespaceZkClusterMapping)1 SimpleDateFormat (java.text.SimpleDateFormat)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1