use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.
the class DataColumnPairGroupServiceImpl method create.
@Override
public void create(ColumnGroup entityObj) {
Assert.assertNotNull(entityObj);
try {
DataColumnPairGroupDO dataColumnPairGroupDo = modelToDo(entityObj);
dataColumnPairGroupDao.insert(dataColumnPairGroupDo);
} catch (RepeatConfigureException rcf) {
throw rcf;
} catch (Exception e) {
logger.error("ERROR ## create dataColumnPairGroup has an exception!");
throw new ManagerException(e);
}
}
use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.
the class DataColumnPairServiceImpl method createBatch.
public void createBatch(List<ColumnPair> dataColumnPairs) {
Assert.assertNotNull(dataColumnPairs);
try {
List<DataColumnPairDO> dataColumnPairDos = new ArrayList<DataColumnPairDO>();
for (ColumnPair columnPair : dataColumnPairs) {
DataColumnPairDO dataColumnPairDo = modelToDo(columnPair);
dataColumnPairDos.add(dataColumnPairDo);
}
dataColumnPairDao.insertBatch(dataColumnPairDos);
} catch (RepeatConfigureException rcf) {
throw rcf;
} catch (Exception e) {
logger.error("ERROR ## create dataColumnPair has an exception!");
throw new ManagerException(e);
}
}
use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.
the class PipelineAction method doEdit.
public void doEdit(@FormGroup("pipelineInfo") Group pipelineInfo, @FormGroup("pipelineParameterInfo") Group pipelineParameterInfo, @FormField(name = "formPipelineError", group = "pipelineInfo") CustomErrors err, HttpSession session, Navigator nav) {
Pipeline pipeline = new Pipeline();
PipelineParameter parameters = new PipelineParameter();
pipelineInfo.setProperties(pipeline);
pipelineParameterInfo.setProperties(parameters);
// if (parameters.getLoadPoolSize() < 1) {
// parameters.setLoadPoolSize(PipelineParameter.DEFAULT_LOAD_POOL_SIZE);
// }
List<Long> selectNodeIds = Arrays.asList(ArrayUtils.toObject(pipelineInfo.getField("selectNodeIds").getLongValues()));
List<Node> selectNodes = new ArrayList<Node>();
for (Long selectNodeId : selectNodeIds) {
Node node = new Node();
node.setId(selectNodeId);
selectNodes.add(node);
}
// select/extract节点普遍配置为同一个节点
List<Long> extractNodeIds = Arrays.asList(ArrayUtils.toObject(pipelineInfo.getField("selectNodeIds").getLongValues()));
// List<Long> extractNodeIds =
// Arrays.asList(ArrayUtils.toObject(pipelineInfo.getField("extractNodeIds").getLongValues()));
List<Node> extractNodes = new ArrayList<Node>();
for (Long extractNodeId : extractNodeIds) {
Node node = new Node();
node.setId(extractNodeId);
extractNodes.add(node);
}
List<Long> loadNodeIds = Arrays.asList(ArrayUtils.toObject(pipelineInfo.getField("loadNodeIds").getLongValues()));
List<Node> loadNodes = new ArrayList<Node>();
for (Long loadNodeId : loadNodeIds) {
Node node = new Node();
node.setId(loadNodeId);
loadNodes.add(node);
}
pipeline.setSelectNodes(selectNodes);
pipeline.setExtractNodes(extractNodes);
pipeline.setLoadNodes(loadNodes);
pipeline.setParameters(parameters);
List<Pipeline> values = pipelineService.listByDestinationWithoutOther(pipeline.getParameters().getDestinationName());
if (!values.isEmpty()) {
if (values.size() > 1 || !values.get(0).getId().equals(pipeline.getId())) {
err.setMessage("invalidDestinationName");
return;
}
}
try {
pipelineService.modify(pipeline);
} catch (RepeatConfigureException rce) {
err.setMessage("invalidPipelineName");
return;
}
nav.redirectToLocation("pipelineList.htm?channelId=" + pipeline.getChannelId());
}
use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.
the class CanalServiceImpl method create.
/**
* 添加
*/
public void create(final Canal canal) {
Assert.assertNotNull(canal);
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
protected void doInTransactionWithoutResult(TransactionStatus status) {
try {
CanalDO canalDO = modelToDo(canal);
canalDO.setId(0L);
if (!canalDao.checkUnique(canalDO)) {
String exceptionCause = "exist the same repeat canal in the database.";
logger.warn("WARN ## " + exceptionCause);
throw new RepeatConfigureException(exceptionCause);
}
canalDao.insert(canalDO);
canal.setId(canalDO.getId());
} 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.RepeatConfigureException in project otter by alibaba.
the class ChannelServiceImpl method modify.
/**
* 修改Channel
*/
public void modify(Channel channel) {
Assert.assertNotNull(channel);
try {
ChannelDO channelDo = modelToDo(channel);
if (channelDao.checkUnique(channelDo)) {
channelDao.update(channelDo);
} else {
String exceptionCause = "exist the same name channel in the database.";
logger.warn("WARN ## " + exceptionCause);
throw new RepeatConfigureException(exceptionCause);
}
} catch (RepeatConfigureException rce) {
throw rce;
} catch (Exception e) {
logger.error("ERROR ## modify channel has an exception ", e);
throw new ManagerException(e);
}
}
Aggregations