use of com.alibaba.otter.manager.biz.config.pipeline.dal.dataobject.PipelineDO in project otter by alibaba.
the class PipelineServiceImpl method modelToDo.
/**
* 用于Model对象转化为DO对象
*
* @param pipeline
* @return PipelineDO
*/
private PipelineDO modelToDo(Pipeline pipeline) {
PipelineDO pipelineDO = new PipelineDO();
try {
pipelineDO.setId(pipeline.getId());
pipelineDO.setName(pipeline.getName());
pipelineDO.setParameters(pipeline.getParameters());
pipelineDO.setDescription(pipeline.getDescription());
pipelineDO.setChannelId(pipeline.getChannelId());
pipelineDO.setGmtCreate(pipeline.getGmtCreate());
pipelineDO.setGmtModified(pipeline.getGmtModified());
} catch (Exception e) {
logger.error("ERROR ## change the pipeline Model to Do has an exception");
throw new ManagerException(e);
}
return pipelineDO;
}
use of com.alibaba.otter.manager.biz.config.pipeline.dal.dataobject.PipelineDO in project otter by alibaba.
the class PipelineServiceImpl method listByChannelIdsWithoutOther.
public List<Pipeline> listByChannelIdsWithoutOther(Long... channelIds) {
Assert.assertNotNull(channelIds);
List<Pipeline> pipelines = new ArrayList<Pipeline>();
try {
List<PipelineDO> pipelineDos = pipelineDao.listByChannelIds(channelIds);
if (pipelineDos.isEmpty()) {
logger.debug("DEBUG ## query pipeline by channelId:" + channelIds + " return null.");
return pipelines;
}
pipelines = doToModelWithoutOther(pipelineDos);
} catch (Exception e) {
logger.error("ERROR ## query pipelines by channelIds:" + channelIds.toString() + " has an exception!");
throw new ManagerException(e);
}
return pipelines;
}
use of com.alibaba.otter.manager.biz.config.pipeline.dal.dataobject.PipelineDO in project otter by alibaba.
the class PipelineServiceImpl method modify.
/**
* 修改
*/
public void modify(Pipeline pipeline) {
Assert.assertNotNull(pipeline);
try {
PipelineDO pipelineDo = modelToDo(pipeline);
if (!pipelineDao.checkUnique(pipelineDo)) {
String exceptionCause = "exist the same name pipeline under the channel(" + pipelineDo.getChannelId() + ") in the database.";
logger.warn("WARN ## " + exceptionCause);
throw new RepeatConfigureException(exceptionCause);
}
pipelineNodeRelationDao.deleteByPipelineId(pipelineDo.getId());
pipelineDao.update(pipelineDo);
List<PipelineNodeRelationDO> pipelineNodeRelationDos = new ArrayList<PipelineNodeRelationDO>();
for (Node node : pipeline.getSelectNodes()) {
PipelineNodeRelationDO pipelineNodeRelationDo = new PipelineNodeRelationDO();
pipelineNodeRelationDo.setPipelineId(pipelineDo.getId());
pipelineNodeRelationDo.setNodeId(node.getId());
pipelineNodeRelationDo.setLocation(Location.SELECT);
pipelineNodeRelationDos.add(pipelineNodeRelationDo);
}
for (Node node : pipeline.getExtractNodes()) {
PipelineNodeRelationDO pipelineNodeRelationDo = new PipelineNodeRelationDO();
pipelineNodeRelationDo.setPipelineId(pipelineDo.getId());
pipelineNodeRelationDo.setNodeId(node.getId());
pipelineNodeRelationDo.setLocation(Location.EXTRACT);
pipelineNodeRelationDos.add(pipelineNodeRelationDo);
}
for (Node node : pipeline.getLoadNodes()) {
PipelineNodeRelationDO pipelineNodeRelationDo = new PipelineNodeRelationDO();
pipelineNodeRelationDo.setPipelineId(pipelineDo.getId());
pipelineNodeRelationDo.setNodeId(node.getId());
pipelineNodeRelationDo.setLocation(Location.LOAD);
pipelineNodeRelationDos.add(pipelineNodeRelationDo);
}
pipelineNodeRelationDao.insertBatch(pipelineNodeRelationDos);
} catch (Exception e) {
logger.error("ERROR ## modify the pipeline(" + pipeline.getId() + ") has an exception!");
throw new ManagerException(e);
}
}
use of com.alibaba.otter.manager.biz.config.pipeline.dal.dataobject.PipelineDO in project otter by alibaba.
the class PipelineServiceImpl method listByIds.
@Override
public List<Pipeline> listByIds(Long... identities) {
List<Pipeline> pipelines = new ArrayList<Pipeline>();
try {
List<PipelineDO> pipelineDos = new ArrayList<PipelineDO>();
if (identities.length < 1) {
pipelineDos = pipelineDao.listAll();
if (pipelineDos.isEmpty()) {
logger.debug("DEBUG ## couldn't query any pipeline, maybe hasn't create any pipeline.");
return pipelines;
}
} else {
pipelineDos = pipelineDao.listByMultiId(identities);
if (pipelineDos.isEmpty()) {
String exceptionCause = "couldn't query any pipeline by pipelineIds:" + Arrays.toString(identities);
logger.error("ERROR ## " + exceptionCause);
throw new ManagerException(exceptionCause);
}
}
pipelines = doToModel(pipelineDos);
} catch (Exception e) {
logger.error("ERROR ## query pipelines has an exception!");
throw new ManagerException(e);
}
return pipelines;
}
use of com.alibaba.otter.manager.biz.config.pipeline.dal.dataobject.PipelineDO 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