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;
}
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;
}
Aggregations