use of com.alibaba.otter.manager.biz.config.pipeline.dal.dataobject.PipelineNodeRelationDO in project otter by alibaba.
the class PipelineServiceImpl method listByNodeId.
public List<Pipeline> listByNodeId(Long nodeId) {
Assert.assertNotNull(nodeId);
List<Pipeline> pipelines = new ArrayList<Pipeline>();
try {
List<PipelineNodeRelationDO> relations = pipelineNodeRelationDao.listByNodeId(nodeId);
if (relations.isEmpty()) {
logger.debug("DEBUG ## query the relation by nodeId:" + nodeId + " return null,maybe hasn't create any relations.");
return pipelines;
}
List<Long> piplineIds = new ArrayList<Long>();
for (PipelineNodeRelationDO relation : relations) {
piplineIds.add(relation.getPipelineId());
}
List<PipelineDO> pipelineDos = pipelineDao.listByMultiId(piplineIds.toArray(new Long[piplineIds.size()]));
if (pipelineDos.isEmpty()) {
String exceptionCause = "query the pipelines by pipelineIds:" + piplineIds.toString() + " return null!";
logger.error("ERROR ## " + exceptionCause);
throw new ManagerException(exceptionCause);
}
pipelines = doToModel(pipelineDos);
} catch (Exception e) {
logger.error("ERROR ## query the pipelines by nodeId:" + nodeId + " has an exception!");
throw new ManagerException(e);
}
return pipelines;
}
Aggregations