use of com.alibaba.otter.manager.biz.common.exceptions.ManagerException in project otter by alibaba.
the class ChannelServiceImpl method listByPipelineIds.
/**
* <pre>
* 根据PipelineID找到对应的Channel
* 优化设想:
* 应该通过变长参数达到后期扩展的方便性
* </pre>
*/
public List<Channel> listByPipelineIds(Long... pipelineIds) {
List<Channel> channels = new ArrayList<Channel>();
try {
List<Pipeline> pipelines = pipelineService.listByIds(pipelineIds);
List<Long> channelIds = new ArrayList<Long>();
for (Pipeline pipeline : pipelines) {
if (!channelIds.contains(pipeline.getChannelId())) {
channelIds.add(pipeline.getChannelId());
}
}
channels = listByIds(channelIds.toArray(new Long[channelIds.size()]));
} catch (Exception e) {
logger.error("ERROR ## list query channel by pipelineIds:" + pipelineIds.toString() + " has an exception!");
throw new ManagerException(e);
}
return channels;
}
use of com.alibaba.otter.manager.biz.common.exceptions.ManagerException in project otter by alibaba.
the class DataColumnPairServiceImpl method modify.
public void modify(ColumnPair entityObj) {
Assert.assertNotNull(entityObj);
try {
DataColumnPairDO dataColumnPairDo = modelToDo(entityObj);
dataColumnPairDao.update(dataColumnPairDo);
} catch (RepeatConfigureException rce) {
throw rce;
} catch (Exception e) {
logger.error("ERROR ## modify dataColumnPair has an exception!");
throw new ManagerException(e);
}
}
use of com.alibaba.otter.manager.biz.common.exceptions.ManagerException in project otter by alibaba.
the class DataMatrixServiceImpl method create.
/**
* 添加
*/
public void create(final DataMatrix matrix) {
Assert.assertNotNull(matrix);
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
protected void doInTransactionWithoutResult(TransactionStatus status) {
try {
DataMatrixDO matrixlDO = modelToDo(matrix);
matrixlDO.setId(0L);
if (!dataMatrixDao.checkUnique(matrixlDO)) {
String exceptionCause = "exist the same repeat canal in the database.";
logger.warn("WARN ## " + exceptionCause);
throw new RepeatConfigureException(exceptionCause);
}
dataMatrixDao.insert(matrixlDO);
} catch (RepeatConfigureException rce) {
throw rce;
} catch (Exception e) {
logger.error("ERROR ## create canal has an exception!");
throw new ManagerException(e);
}
}
});
}
use of com.alibaba.otter.manager.biz.common.exceptions.ManagerException in project otter by alibaba.
the class DataMediaServiceImpl method doToModel.
/**
* 用于DO对象转化为Model对象
*
* @param dataMediaDo
* @return DataMedia
*/
private DataMedia doToModel(DataMediaDO dataMediaDo) {
DataMedia dataMedia = null;
try {
DataMediaSource dataMediaSource = dataMediaSourceService.findById(dataMediaDo.getDataMediaSourceId());
if (dataMediaSource.getType().isMysql() || dataMediaSource.getType().isOracle()) {
dataMedia = JsonUtils.unmarshalFromString(dataMediaDo.getProperties(), DbDataMedia.class);
dataMedia.setSource(dataMediaSource);
} else if (dataMediaSource.getType().isNapoli() || dataMediaSource.getType().isMq()) {
dataMedia = JsonUtils.unmarshalFromString(dataMediaDo.getProperties(), MqDataMedia.class);
dataMedia.setSource(dataMediaSource);
}
dataMedia.setId(dataMediaDo.getId());
dataMedia.setGmtCreate(dataMediaDo.getGmtCreate());
dataMedia.setGmtModified(dataMediaDo.getGmtModified());
} catch (Exception e) {
logger.error("ERROR ## change the dataMedia Do to Model has an exception");
throw new ManagerException(e);
}
return dataMedia;
}
use of com.alibaba.otter.manager.biz.common.exceptions.ManagerException in project otter by alibaba.
the class DataMediaServiceImpl method modify.
/**
* 修改
*/
@Override
public void modify(DataMedia dataMedia) {
Assert.assertNotNull(dataMedia);
try {
DataMediaDO dataMediaDo = modelToDo(dataMedia);
if (dataMediaDao.checkUnique(dataMediaDo)) {
dataMediaDao.update(dataMediaDo);
} else {
String exceptionCause = "exist the same name dataMedia in the database.";
logger.warn("WARN ## " + exceptionCause);
throw new RepeatConfigureException(exceptionCause);
}
} catch (RepeatConfigureException rce) {
throw rce;
} catch (Exception e) {
logger.error("ERROR ## modify dataMedia has an exception!");
throw new ManagerException(e);
}
}
Aggregations