Search in sources :

Example 1 with SeniorCanal

use of com.alibaba.otter.manager.web.common.model.SeniorCanal in project otter by alibaba.

the class CanalList method execute.

public void execute(@Param("pageIndex") int pageIndex, @Param("searchKey") String searchKey, Context context) throws Exception {
    @SuppressWarnings("unchecked") Map<String, Object> condition = new HashMap<String, Object>();
    if ("请输入关键字(目前支持Node的ID、名字搜索)".equals(searchKey)) {
        searchKey = "";
    }
    condition.put("searchKey", searchKey);
    int count = canalService.getCount(condition);
    Paginator paginator = new Paginator();
    paginator.setItems(count);
    paginator.setPage(pageIndex);
    condition.put("offset", paginator.getOffset());
    condition.put("length", paginator.getLength());
    List<Canal> canals = canalService.listByCondition(condition);
    List<SeniorCanal> seniorCanals = new ArrayList<SeniorCanal>();
    for (Canal canal : canals) {
        SeniorCanal seniorCanal = new SeniorCanal();
        seniorCanal.setId(canal.getId());
        seniorCanal.setName(canal.getName());
        seniorCanal.setStatus(canal.getStatus());
        seniorCanal.setDesc(canal.getDesc());
        seniorCanal.setCanalParameter(canal.getCanalParameter());
        seniorCanal.setGmtCreate(canal.getGmtCreate());
        seniorCanal.setGmtModified(canal.getGmtModified());
        List<Pipeline> pipelines = pipelineService.listByDestinationWithoutOther(canal.getName());
        seniorCanal.setPipelines(pipelines);
        seniorCanal.setUsed(!pipelines.isEmpty());
        seniorCanals.add(seniorCanal);
    }
    context.put("seniorCanals", seniorCanals);
    context.put("paginator", paginator);
    context.put("searchKey", searchKey);
}
Also used : HashMap(java.util.HashMap) Canal(com.alibaba.otter.canal.instance.manager.model.Canal) SeniorCanal(com.alibaba.otter.manager.web.common.model.SeniorCanal) ArrayList(java.util.ArrayList) Paginator(com.alibaba.citrus.util.Paginator) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline) SeniorCanal(com.alibaba.otter.manager.web.common.model.SeniorCanal)

Example 2 with SeniorCanal

use of com.alibaba.otter.manager.web.common.model.SeniorCanal in project otter by alibaba.

the class SelectCanal method execute.

public void execute(@Param("pageIndex") int pageIndex, @Param("searchKey") String searchKey, Context context) throws Exception {
    @SuppressWarnings("unchecked") Map<String, Object> condition = new HashMap<String, Object>();
    if ("请输入关键字(目前支持Canal的名字,参数搜索)".equals(searchKey)) {
        searchKey = "";
    }
    condition.put("searchKey", searchKey);
    int count = canalService.getCount(condition);
    Paginator paginator = new Paginator();
    paginator.setItems(count);
    paginator.setPage(pageIndex);
    condition.put("offset", paginator.getOffset());
    condition.put("length", paginator.getLength());
    List<Canal> canals = canalService.listByCondition(condition);
    List<SeniorCanal> seniorCanals = new ArrayList<SeniorCanal>();
    for (Canal canal : canals) {
        SeniorCanal seniorCanal = new SeniorCanal();
        seniorCanal.setId(canal.getId());
        seniorCanal.setName(canal.getName());
        seniorCanal.setStatus(canal.getStatus());
        seniorCanal.setDesc(canal.getDesc());
        seniorCanal.setCanalParameter(canal.getCanalParameter());
        seniorCanal.setUsed(false);
        seniorCanal.setGmtCreate(canal.getGmtCreate());
        seniorCanal.setGmtModified(canal.getGmtModified());
        seniorCanals.add(seniorCanal);
    }
    context.put("seniorCanals", seniorCanals);
    context.put("paginator", paginator);
    context.put("searchKey", searchKey);
}
Also used : HashMap(java.util.HashMap) SeniorCanal(com.alibaba.otter.manager.web.common.model.SeniorCanal) Canal(com.alibaba.otter.canal.instance.manager.model.Canal) SeniorCanal(com.alibaba.otter.manager.web.common.model.SeniorCanal) ArrayList(java.util.ArrayList) Paginator(com.alibaba.citrus.util.Paginator)

Aggregations

Paginator (com.alibaba.citrus.util.Paginator)2 Canal (com.alibaba.otter.canal.instance.manager.model.Canal)2 SeniorCanal (com.alibaba.otter.manager.web.common.model.SeniorCanal)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Pipeline (com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)1