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