use of com.alibaba.otter.manager.web.common.model.SeniorDataMedia in project otter by alibaba.
the class DataMediaList 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 ("请输入关键字(目前支持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);
List<SeniorDataMedia> seniorDataMedias = new ArrayList<SeniorDataMedia>();
for (DataMedia dataMedia : dataMedias) {
SeniorDataMedia seniorDataMedia = new SeniorDataMedia();
seniorDataMedia.setId(dataMedia.getId());
seniorDataMedia.setEncode(dataMedia.getEncode());
seniorDataMedia.setGmtCreate(dataMedia.getGmtCreate());
seniorDataMedia.setGmtModified(dataMedia.getGmtModified());
seniorDataMedia.setName(dataMedia.getName());
seniorDataMedia.setNamespace(dataMedia.getNamespace());
seniorDataMedia.setSource(dataMedia.getSource());
List<DataMediaPair> pairs = dataMediaPairService.listByDataMediaId(dataMedia.getId());
seniorDataMedia.setPairs(pairs);
if (pairs.size() < 1) {
seniorDataMedia.setUsed(false);
} else {
seniorDataMedia.setUsed(true);
}
seniorDataMedias.add(seniorDataMedia);
}
context.put("dataMedias", seniorDataMedias);
context.put("paginator", paginator);
context.put("searchKey", searchKey);
}
Aggregations