use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.
the class DataMediaPairAction method doNextToView.
/**
* 选择视图同步
*
* @param channelInfo
* @param channelParameterInfo
* @throws Exception
*/
public void doNextToView(@FormGroup("dataMediaPairInfo") Group dataMediaPairInfo, @FormField(name = "formDataMediaPairError", group = "dataMediaPairInfo") CustomErrors err, Navigator nav) throws Exception {
DataMediaPair dataMediaPair = new DataMediaPair();
DataMedia sourceDataMedia = new DataMedia();
DataMedia targetDataMedia = new DataMedia();
dataMediaPairInfo.setProperties(dataMediaPair);
sourceDataMedia.setId(dataMediaPairInfo.getField("sourceDataMediaId").getLongValue());
dataMediaPair.setSource(sourceDataMedia);
targetDataMedia.setId(dataMediaPairInfo.getField("targetDataMediaId").getLongValue());
dataMediaPair.setTarget(targetDataMedia);
try {
dataMediaPairService.create(dataMediaPair);
} catch (RepeatConfigureException rce) {
err.setMessage("invalidDataMediaPair");
return;
}
nav.redirectToLocation("dataMediaPairList.htm?pipelineId=" + dataMediaPair.getPipelineId());
}
use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.
the class DataMediaSourceAction method doAdd.
/**
* 添加Channel
*
* @param channelInfo
* @param channelParameterInfo
* @throws Exception
*/
public void doAdd(@FormGroup("dataMediaSourceInfo") Group dataMediaSourceInfo, @FormField(name = "formDataMediaSourceError", group = "dataMediaSourceInfo") CustomErrors err, Navigator nav) throws Exception {
DataMediaSource dataMediaSource = new DataMediaSource();
dataMediaSourceInfo.setProperties(dataMediaSource);
if (dataMediaSource.getType().isMysql() || dataMediaSource.getType().isOracle()) {
DbMediaSource dbMediaSource = new DbMediaSource();
dataMediaSourceInfo.setProperties(dbMediaSource);
if (dataMediaSource.getType().isMysql()) {
dbMediaSource.setDriver("com.mysql.jdbc.Driver");
} else if (dataMediaSource.getType().isOracle()) {
dbMediaSource.setDriver("oracle.jdbc.driver.OracleDriver");
}
try {
dataMediaSourceService.create(dbMediaSource);
} catch (RepeatConfigureException rce) {
err.setMessage("invalidDataMediaSource");
return;
}
} else if (dataMediaSource.getType().isNapoli() || dataMediaSource.getType().isMq()) {
MqMediaSource mqMediaSource = new MqMediaSource();
dataMediaSourceInfo.setProperties(mqMediaSource);
try {
dataMediaSourceService.create(mqMediaSource);
} catch (RepeatConfigureException rce) {
err.setMessage("invalidDataMediaSource");
return;
}
}
nav.redirectTo(WebConstant.DATA_MEDIA_SOURCE_LIST_LINK);
}
use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.
the class DataMediaSourceAction method doEdit.
public void doEdit(@FormGroup("dataMediaSourceInfo") Group dataMediaSourceInfo, @Param("pageIndex") int pageIndex, @Param("searchKey") String searchKey, @FormField(name = "formDataMediaSourceError", group = "dataMediaSourceInfo") CustomErrors err, Navigator nav) throws Exception {
DbMediaSource dbMediaSource = new DbMediaSource();
dataMediaSourceInfo.setProperties(dbMediaSource);
if (dbMediaSource.getType().isMysql()) {
dbMediaSource.setDriver("com.mysql.jdbc.Driver");
} else if (dbMediaSource.getType().isOracle()) {
dbMediaSource.setDriver("oracle.jdbc.driver.OracleDriver");
}
try {
dataMediaSourceService.modify(dbMediaSource);
} catch (RepeatConfigureException rce) {
err.setMessage("invalidDataMediaSource");
return;
}
nav.redirectToLocation("dataSourceList.htm?pageIndex=" + pageIndex + "&searchKey=" + urlEncode(searchKey));
}
use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.
the class DataMediaServiceImpl method createReturnId.
/**
* 添加
*/
@Override
public Long createReturnId(DataMedia dataMedia) {
Assert.assertNotNull(dataMedia);
try {
DataMediaDO dataMediaDo = modelToDo(dataMedia);
dataMediaDo.setId(0L);
DataMediaDO dataMediaDoInDb = dataMediaDao.checkUniqueAndReturnExist(dataMediaDo);
if (dataMediaDoInDb == null) {
dataMediaDo = dataMediaDao.insert(dataMediaDo);
} else {
dataMediaDo = dataMediaDoInDb;
}
return dataMediaDo.getId();
} catch (RepeatConfigureException rce) {
throw rce;
} catch (Exception e) {
logger.error("ERROR ## create dataMedia has an exception!");
throw new ManagerException(e);
}
}
use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.
the class DataMediaSourceServiceImpl method create.
/**
* 添加
*/
public void create(DataMediaSource dataMediaSource) {
Assert.assertNotNull(dataMediaSource);
try {
DataMediaSourceDO dataMediaSourceDo = modelToDo(dataMediaSource);
dataMediaSourceDo.setId(0L);
if (!dataMediaSourceDao.checkUnique(dataMediaSourceDo)) {
String exceptionCause = "exist the same name source in the database.";
logger.warn("WARN ## " + exceptionCause);
throw new RepeatConfigureException(exceptionCause);
}
dataMediaSourceDao.insert(dataMediaSourceDo);
} catch (RepeatConfigureException rce) {
throw rce;
} catch (Exception e) {
logger.error("ERROR ## create dataMediaSource has an exception!");
throw new ManagerException(e);
}
}
Aggregations