Search in sources :

Example 1 with Paginator

use of com.alibaba.citrus.util.Paginator 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 Paginator

use of com.alibaba.citrus.util.Paginator in project otter by alibaba.

the class NodeList 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 = nodeService.getCount(condition);
    Paginator paginator = new Paginator();
    paginator.setItems(count);
    paginator.setPage(pageIndex);
    condition.put("offset", paginator.getOffset());
    condition.put("length", paginator.getLength());
    List<Node> nodes = nodeService.listByCondition(condition);
    List<SeniorNode> seniorNodes = new ArrayList<SeniorNode>();
    for (Node node : nodes) {
        SeniorNode seniorNode = new SeniorNode();
        seniorNode.setId(node.getId());
        seniorNode.setIp(node.getIp());
        seniorNode.setName(node.getName());
        seniorNode.setPort(node.getPort());
        seniorNode.setDescription(node.getDescription());
        seniorNode.setStatus(node.getStatus());
        seniorNode.setParameters(node.getParameters());
        seniorNode.setGmtCreate(node.getGmtCreate());
        seniorNode.setGmtModified(node.getGmtModified());
        seniorNode.setUsed(pipelineService.hasRelation(node.getId()));
        seniorNodes.add(seniorNode);
    }
    context.put("seniorNodes", seniorNodes);
    context.put("paginator", paginator);
    context.put("searchKey", searchKey);
}
Also used : HashMap(java.util.HashMap) SeniorNode(com.alibaba.otter.manager.web.common.model.SeniorNode) SeniorNode(com.alibaba.otter.manager.web.common.model.SeniorNode) Node(com.alibaba.otter.shared.common.model.config.node.Node) ArrayList(java.util.ArrayList) Paginator(com.alibaba.citrus.util.Paginator)

Example 3 with Paginator

use of com.alibaba.citrus.util.Paginator 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)

Example 4 with Paginator

use of com.alibaba.citrus.util.Paginator in project otter by alibaba.

the class SelectDataMedia method execute.

public void execute(@Param("pageIndex") int pageIndex, @Param("searchKey") String searchKey, @Param("local") String local, Context context) throws Exception {
    @SuppressWarnings("unchecked") Map<String, Object> condition = new HashMap<String, Object>();
    if ("请输入关键字(目前支持DataMedia的ID、名字搜索)".equals(searchKey)) {
        searchKey = "";
    }
    condition.put("searchKey", searchKey);
    int count = dataMediaService.getCount(condition);
    Paginator paginator = new Paginator();
    paginator.setItems(count);
    paginator.setPage(pageIndex);
    condition.put("offset", paginator.getOffset());
    condition.put("length", paginator.getLength());
    List<DataMedia> dataMedias = dataMediaService.listByCondition(condition);
    context.put("dataMedias", dataMedias);
    context.put("paginator", paginator);
    context.put("searchKey", searchKey);
    context.put("local", local);
}
Also used : HashMap(java.util.HashMap) Paginator(com.alibaba.citrus.util.Paginator) DataMedia(com.alibaba.otter.shared.common.model.config.data.DataMedia)

Example 5 with Paginator

use of com.alibaba.citrus.util.Paginator in project otter by alibaba.

the class UserManager 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 ("支持ID、用户名、真实姓名、部门搜索".equals(searchKey)) {
        searchKey = "";
    }
    condition.put("searchKey", searchKey);
    int count = userService.getCount(condition);
    Paginator paginator = new Paginator();
    paginator.setItems(count);
    paginator.setPage(pageIndex);
    condition.put("offset", paginator.getOffset());
    condition.put("length", paginator.getLength());
    List<User> users = userService.listByCondition(condition);
    context.put("users", users);
    context.put("paginator", paginator);
    context.put("searchKey", searchKey);
}
Also used : User(com.alibaba.otter.shared.common.model.user.User) HashMap(java.util.HashMap) Paginator(com.alibaba.citrus.util.Paginator)

Aggregations

Paginator (com.alibaba.citrus.util.Paginator)14 HashMap (java.util.HashMap)14 ArrayList (java.util.ArrayList)7 DataMedia (com.alibaba.otter.shared.common.model.config.data.DataMedia)3 DataMediaSource (com.alibaba.otter.shared.common.model.config.data.DataMediaSource)3 Canal (com.alibaba.otter.canal.instance.manager.model.Canal)2 SeniorCanal (com.alibaba.otter.manager.web.common.model.SeniorCanal)2 Channel (com.alibaba.otter.shared.common.model.config.channel.Channel)2 Pipeline (com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)2 LogRecord (com.alibaba.otter.shared.common.model.config.record.LogRecord)2 SeniorChannel (com.alibaba.otter.manager.web.common.model.SeniorChannel)1 SeniorDataMatrix (com.alibaba.otter.manager.web.common.model.SeniorDataMatrix)1 SeniorDataMedia (com.alibaba.otter.manager.web.common.model.SeniorDataMedia)1 SeniorDataMediaSource (com.alibaba.otter.manager.web.common.model.SeniorDataMediaSource)1 SeniorNode (com.alibaba.otter.manager.web.common.model.SeniorNode)1 AutoKeeperCluster (com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster)1 AlarmRule (com.alibaba.otter.shared.common.model.config.alarm.AlarmRule)1 ChannelStatus (com.alibaba.otter.shared.common.model.config.channel.ChannelStatus)1 DataMatrix (com.alibaba.otter.shared.common.model.config.data.DataMatrix)1 DataMediaPair (com.alibaba.otter.shared.common.model.config.data.DataMediaPair)1