Search in sources :

Example 76 with ManagerException

use of com.alibaba.otter.manager.biz.common.exceptions.ManagerException 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 77 with ManagerException

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

the class DataMediaPairServiceImpl method createIfNotExist.

/**
     * 添加并返回插入的id
     */
public boolean createIfNotExist(DataMediaPair dataMediaPair) {
    Assert.assertNotNull(dataMediaPair);
    try {
        DataMediaPairDO dataMediaPairDo = modelToDo(dataMediaPair);
        dataMediaPairDo.setId(0L);
        if (!dataMediaPairDao.checkUnique(dataMediaPairDo)) {
            return false;
        }
        dataMediaPairDao.insert(dataMediaPairDo);
        return true;
    } catch (Exception e) {
        logger.error("ERROR ## create dataMediaPair has an exception!", e);
        throw new ManagerException(e);
    }
}
Also used : 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 78 with ManagerException

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

the class DataMediaPairServiceImpl method listByDataMediaId.

@Override
public List<DataMediaPair> listByDataMediaId(Long dataMediaId) {
    Assert.assertNotNull(dataMediaId);
    List<DataMediaPair> dataMediaPairs = new ArrayList<DataMediaPair>();
    try {
        List<DataMediaPairDO> dataMediaPairDos = dataMediaPairDao.listByDataMediaId(dataMediaId);
        if (dataMediaPairDos.isEmpty()) {
            logger.debug("DEBUG ## couldn't query any dataMediaPair, maybe hasn't create any dataMediaPair.");
            return dataMediaPairs;
        }
        dataMediaPairs = doToModel(dataMediaPairDos);
    } catch (Exception e) {
        logger.error("ERROR ## query dataMediaPairs by dataMediaId:" + dataMediaId + " has an exception!", e);
        throw new ManagerException(e);
    }
    return dataMediaPairs;
}
Also used : DataMediaPair(com.alibaba.otter.shared.common.model.config.data.DataMediaPair) ArrayList(java.util.ArrayList) 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 79 with ManagerException

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

the class DataMediaPairServiceImpl method listByPipelineId.

/**
     * 根据PipelineId找到该枝干下的所有DataMediaPairs
     */
public List<DataMediaPair> listByPipelineId(Long pipelineId) {
    Assert.assertNotNull(pipelineId);
    List<DataMediaPair> dataMediaPairs = new ArrayList<DataMediaPair>();
    try {
        List<DataMediaPairDO> dataMediaPairDos = dataMediaPairDao.listByPipelineId(pipelineId);
        if (dataMediaPairDos.isEmpty()) {
            logger.debug("DEBUG ## couldn't query any dataMediaPair, maybe hasn't create any dataMediaPair.");
            return dataMediaPairs;
        }
        dataMediaPairs = doToModel(dataMediaPairDos);
    } catch (Exception e) {
        logger.error("ERROR ## query dataMediaPairs by pipelineId:" + pipelineId + " has an exception!", e);
        throw new ManagerException(e);
    }
    return dataMediaPairs;
}
Also used : DataMediaPair(com.alibaba.otter.shared.common.model.config.data.DataMediaPair) ArrayList(java.util.ArrayList) 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 80 with ManagerException

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

the class DataMediaPairServiceImpl method listByPipelineIdWithoutColumn.

@Override
public List<DataMediaPair> listByPipelineIdWithoutColumn(Long pipelineId) {
    Assert.assertNotNull(pipelineId);
    List<DataMediaPair> dataMediaPairs = new ArrayList<DataMediaPair>();
    try {
        List<DataMediaPairDO> dataMediaPairDos = dataMediaPairDao.listByPipelineId(pipelineId);
        if (dataMediaPairDos.isEmpty()) {
            logger.debug("DEBUG ## couldn't query any dataMediaPair, maybe hasn't create any dataMediaPair.");
            return dataMediaPairs;
        }
        dataMediaPairs = doToModelWithoutOther(dataMediaPairDos);
    } catch (Exception e) {
        logger.error("ERROR ## query dataMediaPairs by pipelineId:" + pipelineId + " has an exception!", e);
        throw new ManagerException(e);
    }
    return dataMediaPairs;
}
Also used : DataMediaPair(com.alibaba.otter.shared.common.model.config.data.DataMediaPair) ArrayList(java.util.ArrayList) 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)

Aggregations

ManagerException (com.alibaba.otter.manager.biz.common.exceptions.ManagerException)85 RepeatConfigureException (com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)76 ArrayList (java.util.ArrayList)35 Pipeline (com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)17 TransactionStatus (org.springframework.transaction.TransactionStatus)13 TransactionCallbackWithoutResult (org.springframework.transaction.support.TransactionCallbackWithoutResult)13 InvalidConfigureException (com.alibaba.otter.manager.biz.common.exceptions.InvalidConfigureException)12 PipelineDO (com.alibaba.otter.manager.biz.config.pipeline.dal.dataobject.PipelineDO)10 Channel (com.alibaba.otter.shared.common.model.config.channel.Channel)10 DataMediaPairDO (com.alibaba.otter.manager.biz.config.datamediapair.dal.dataobject.DataMediaPairDO)9 DataMediaPair (com.alibaba.otter.shared.common.model.config.data.DataMediaPair)9 ChannelDO (com.alibaba.otter.manager.biz.config.channel.dal.dataobject.ChannelDO)8 DataMediaDO (com.alibaba.otter.manager.biz.config.datamedia.dal.dataobject.DataMediaDO)7 Node (com.alibaba.otter.shared.common.model.config.node.Node)7 CanalDO (com.alibaba.otter.manager.biz.config.canal.dal.dataobject.CanalDO)5 DataColumnPairDO (com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairDO)5 DataMatrixDO (com.alibaba.otter.manager.biz.config.datamatrix.dal.dataobject.DataMatrixDO)5 PipelineNodeRelationDO (com.alibaba.otter.manager.biz.config.pipeline.dal.dataobject.PipelineNodeRelationDO)5 DataMedia (com.alibaba.otter.shared.common.model.config.data.DataMedia)5 DataMediaSourceDO (com.alibaba.otter.manager.biz.config.datamediasource.dal.dataobject.DataMediaSourceDO)4