Search in sources :

Example 36 with RepeatConfigureException

use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.

the class DataMediaPairServiceImpl method createAndReturnId.

/**
     * 添加并返回插入的id
     */
public Long createAndReturnId(DataMediaPair dataMediaPair) {
    Assert.assertNotNull(dataMediaPair);
    try {
        DataMediaPairDO dataMediaPairDo = modelToDo(dataMediaPair);
        dataMediaPairDo.setId(0L);
        if (!dataMediaPairDao.checkUnique(dataMediaPairDo)) {
            String exceptionCause = "exist the same pair in the database.";
            logger.warn("WARN ## " + exceptionCause);
            throw new RepeatConfigureException(exceptionCause);
        }
        dataMediaPairDao.insert(dataMediaPairDo);
        return dataMediaPairDo.getId();
    } catch (RepeatConfigureException rcf) {
        throw rcf;
    } catch (Exception e) {
        logger.error("ERROR ## create dataMediaPair has an exception!", e);
        throw new ManagerException(e);
    }
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) DataMediaPairDO(com.alibaba.otter.manager.biz.config.datamediapair.dal.dataobject.DataMediaPairDO) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)

Example 37 with RepeatConfigureException

use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.

the class DataMediaPairServiceImpl method modify.

/**
     * 修改
     */
public void modify(DataMediaPair dataMediaPair) {
    Assert.assertNotNull(dataMediaPair);
    try {
        DataMediaPairDO dataMediaPairDo = modelToDo(dataMediaPair);
        if (dataMediaPairDao.checkUnique(dataMediaPairDo)) {
            dataMediaPairDao.update(dataMediaPairDo);
        } else {
            String exceptionCause = "exist the same pair in the database.";
            logger.warn("WARN ## " + exceptionCause);
            throw new RepeatConfigureException(exceptionCause);
        }
    } catch (RepeatConfigureException rce) {
        throw rce;
    } catch (Exception e) {
        logger.error("ERROR ## modify dataMediaPair has an exception!", e);
        throw new ManagerException(e);
    }
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) DataMediaPairDO(com.alibaba.otter.manager.biz.config.datamediapair.dal.dataobject.DataMediaPairDO) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)

Example 38 with RepeatConfigureException

use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.

the class DataMediaAction method doAdd.

/**
     * 添加Channel
     * 
     * @param channelInfo
     * @param channelParameterInfo
     * @throws Exception
     */
public void doAdd(@FormGroup("dataMediaInfo") Group dataMediaInfo, @FormField(name = "formDataMediaError", group = "dataMediaInfo") CustomErrors err, Navigator nav) throws Exception {
    DataMedia dataMedia = new DataMedia();
    dataMediaInfo.setProperties(dataMedia);
    DataMediaSource dataMediaSource = dataMediaSourceService.findById(dataMediaInfo.getField("sourceId").getLongValue());
    if (dataMediaSource.getType().isMysql() || dataMediaSource.getType().isOracle()) {
        dataMedia.setSource((DbMediaSource) dataMediaSource);
    } else if (dataMediaSource.getType().isNapoli() || dataMediaSource.getType().isMq()) {
        dataMedia.setSource((MqMediaSource) dataMediaSource);
    }
    try {
        dataMediaService.create(dataMedia);
    } catch (RepeatConfigureException rce) {
        err.setMessage("invalidDataMedia");
        return;
    }
    nav.redirectTo(WebConstant.DATA_MEDIA_LIST_LINK);
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) MqMediaSource(com.alibaba.otter.shared.common.model.config.data.mq.MqMediaSource) DataMediaSource(com.alibaba.otter.shared.common.model.config.data.DataMediaSource) DataMedia(com.alibaba.otter.shared.common.model.config.data.DataMedia)

Example 39 with RepeatConfigureException

use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.

the class DataMediaAction method doEdit.

public void doEdit(@FormGroup("dataMediaInfo") Group dataMediaInfo, @Param("pageIndex") int pageIndex, @Param("searchKey") String searchKey, @FormField(name = "formDataMediaError", group = "dataMediaInfo") CustomErrors err, Navigator nav) throws Exception {
    DataMedia dataMedia = new DataMedia();
    dataMediaInfo.setProperties(dataMedia);
    DataMediaSource dataMediaSource = dataMediaSourceService.findById(dataMediaInfo.getField("sourceId").getLongValue());
    if (dataMediaSource.getType().isMysql() || dataMediaSource.getType().isOracle()) {
        dataMedia.setSource((DbMediaSource) dataMediaSource);
    } else if (dataMediaSource.getType().isNapoli() || dataMediaSource.getType().isMq()) {
        dataMedia.setSource((MqMediaSource) dataMediaSource);
    }
    try {
        dataMediaService.modify(dataMedia);
    } catch (RepeatConfigureException rce) {
        err.setMessage("invalidDataMedia");
        return;
    }
    nav.redirectToLocation("dataMediaList.htm?pageIndex=" + pageIndex + "&searchKey=" + urlEncode(searchKey));
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) MqMediaSource(com.alibaba.otter.shared.common.model.config.data.mq.MqMediaSource) DataMediaSource(com.alibaba.otter.shared.common.model.config.data.DataMediaSource) DataMedia(com.alibaba.otter.shared.common.model.config.data.DataMedia)

Example 40 with RepeatConfigureException

use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.

the class DataMediaPairAction method doEdit.

public void doEdit(@Param("submitKey") String submitKey, @Param("channelId") Long channelId, @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);
    // filter解析
    ExtensionDataType filterType = ExtensionDataType.valueOf(dataMediaPairInfo.getField("filterType").getStringValue());
    ExtensionData filterData = new ExtensionData();
    filterData.setExtensionDataType(filterType);
    if (filterType.isClazz()) {
        filterData.setClazzPath(dataMediaPairInfo.getField("filterText").getStringValue());
    } else if (filterType.isSource()) {
        filterData.setSourceText(dataMediaPairInfo.getField("filterText").getStringValue());
    }
    dataMediaPair.setFilterData(filterData);
    // fileresovler解析
    ExtensionDataType resolverType = ExtensionDataType.valueOf(dataMediaPairInfo.getField("resolverType").getStringValue());
    ExtensionData resolverData = new ExtensionData();
    resolverData.setExtensionDataType(resolverType);
    if (resolverType.isClazz()) {
        resolverData.setClazzPath(dataMediaPairInfo.getField("resolverText").getStringValue());
    } else if (resolverType.isSource()) {
        resolverData.setSourceText(dataMediaPairInfo.getField("resolverText").getStringValue());
    }
    dataMediaPair.setResolverData(resolverData);
    sourceDataMedia.setId(dataMediaPairInfo.getField("sourceDataMediaId").getLongValue());
    dataMediaPair.setSource(sourceDataMedia);
    targetDataMedia.setId(dataMediaPairInfo.getField("targetDataMediaId").getLongValue());
    dataMediaPair.setTarget(targetDataMedia);
    try {
        dataMediaPairService.modify(dataMediaPair);
    } catch (RepeatConfigureException rce) {
        err.setMessage("invalidDataMediaPair");
        return;
    }
    if (submitKey.equals("保存")) {
        nav.redirectToLocation("dataMediaPairList.htm?pipelineId=" + dataMediaPair.getPipelineId());
    } else if (submitKey.equals("下一步")) {
        nav.redirectToLocation("addColumnPair.htm?pipelineId=" + dataMediaPair.getPipelineId() + "&channelId=" + channelId + "&dataMediaPairId=" + dataMediaPair.getId() + "&sourceMediaId=" + sourceDataMedia.getId() + "&targetMediaId=" + targetDataMedia.getId());
    }
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) DataMediaPair(com.alibaba.otter.shared.common.model.config.data.DataMediaPair) ExtensionDataType(com.alibaba.otter.shared.common.model.config.data.ExtensionDataType) DataMedia(com.alibaba.otter.shared.common.model.config.data.DataMedia) ExtensionData(com.alibaba.otter.shared.common.model.config.data.ExtensionData)

Aggregations

RepeatConfigureException (com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)46 ManagerException (com.alibaba.otter.manager.biz.common.exceptions.ManagerException)23 TransactionStatus (org.springframework.transaction.TransactionStatus)8 TransactionCallbackWithoutResult (org.springframework.transaction.support.TransactionCallbackWithoutResult)8 ArrayList (java.util.ArrayList)7 Node (com.alibaba.otter.shared.common.model.config.node.Node)6 DataMedia (com.alibaba.otter.shared.common.model.config.data.DataMedia)5 AutoKeeperCluster (com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster)4 DataColumnPairDO (com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairDO)3 DataMediaDO (com.alibaba.otter.manager.biz.config.datamedia.dal.dataobject.DataMediaDO)3 DataMediaPair (com.alibaba.otter.shared.common.model.config.data.DataMediaPair)3 DataMediaSource (com.alibaba.otter.shared.common.model.config.data.DataMediaSource)3 MqMediaSource (com.alibaba.otter.shared.common.model.config.data.mq.MqMediaSource)3 List (java.util.List)3 Canal (com.alibaba.otter.canal.instance.manager.model.Canal)2 CanalParameter (com.alibaba.otter.canal.instance.manager.model.CanalParameter)2 DataSourcing (com.alibaba.otter.canal.instance.manager.model.CanalParameter.DataSourcing)2 SourcingType (com.alibaba.otter.canal.instance.manager.model.CanalParameter.SourcingType)2 InvalidConfigureException (com.alibaba.otter.manager.biz.common.exceptions.InvalidConfigureException)2 CanalDO (com.alibaba.otter.manager.biz.config.canal.dal.dataobject.CanalDO)2