Search in sources :

Example 1 with SeniorNode

use of com.alibaba.otter.manager.web.common.model.SeniorNode 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)

Aggregations

Paginator (com.alibaba.citrus.util.Paginator)1 SeniorNode (com.alibaba.otter.manager.web.common.model.SeniorNode)1 Node (com.alibaba.otter.shared.common.model.config.node.Node)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1