Search in sources :

Example 1 with DataColumnPairDO

use of com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairDO in project otter by alibaba.

the class DataColumnPairServiceImpl method listByDataMediaPairId.

public List<ColumnPair> listByDataMediaPairId(Long dataMediaPairId) {
    Assert.assertNotNull(dataMediaPairId);
    List<ColumnPair> dataColumnPairs = new ArrayList<ColumnPair>();
    try {
        List<DataColumnPairDO> dataColumnPairDos = dataColumnPairDao.listByDataMediaPairId(dataMediaPairId);
        if (dataColumnPairDos.isEmpty()) {
            logger.debug("DEBUG ## couldn't query any dataColumnPair, maybe hasn't create any dataColumnPair.");
            return dataColumnPairs;
        }
        dataColumnPairs = doToModel(dataColumnPairDos);
    } catch (Exception e) {
        logger.error("ERROR ## query dataColumnPair by dataMediaId:" + dataMediaPairId + " has an exception!");
        throw new ManagerException(e);
    }
    return dataColumnPairs;
}
Also used : ColumnPair(com.alibaba.otter.shared.common.model.config.data.ColumnPair) ArrayList(java.util.ArrayList) 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) DataColumnPairDO(com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairDO)

Example 2 with DataColumnPairDO

use of com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairDO in project otter by alibaba.

the class DataColumnPairServiceImpl method modelToDo.

/**
     * 用于Model对象转化为DO对象
     * 
     * @param dataColumnPair
     * @return DataMediaPairDO
     */
private DataColumnPairDO modelToDo(ColumnPair dataColumnPair) {
    DataColumnPairDO dataColumnPairDo = new DataColumnPairDO();
    dataColumnPairDo.setId(dataColumnPair.getId());
    dataColumnPairDo.setSourceColumnName(dataColumnPair.getSourceColumn() == null ? null : dataColumnPair.getSourceColumn().getName());
    dataColumnPairDo.setTargetColumnName(dataColumnPair.getTargetColumn() == null ? null : dataColumnPair.getTargetColumn().getName());
    dataColumnPairDo.setDataMediaPairId(dataColumnPair.getDataMediaPairId());
    dataColumnPairDo.setGmtCreate(dataColumnPair.getGmtCreate());
    dataColumnPairDo.setGmtModified(dataColumnPair.getGmtModified());
    return dataColumnPairDo;
}
Also used : DataColumnPairDO(com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairDO)

Example 3 with DataColumnPairDO

use of com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairDO in project otter by alibaba.

the class DataColumnPairServiceImpl method create.

public void create(ColumnPair entityObj) {
    Assert.assertNotNull(entityObj);
    try {
        DataColumnPairDO dataColumnPairDo = modelToDo(entityObj);
        dataColumnPairDao.insert(dataColumnPairDo);
    } catch (RepeatConfigureException rcf) {
        throw rcf;
    } catch (Exception e) {
        logger.error("ERROR ## create dataColumnPair has an exception!");
        throw new ManagerException(e);
    }
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) 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) DataColumnPairDO(com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairDO)

Example 4 with DataColumnPairDO

use of com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairDO in project otter by alibaba.

the class IbatisDataColumnPairDAO method insertBatch.

public void insertBatch(List<DataColumnPairDO> dataColumnPairDos) {
    try {
        getSqlMapClientTemplate().getSqlMapClient().startBatch();
        Iterator it = dataColumnPairDos.iterator();
        while (it.hasNext()) {
            DataColumnPairDO dataColumnPairDo = (DataColumnPairDO) it.next();
            getSqlMapClientTemplate().getSqlMapClient().insert("insertDataColumnPair", dataColumnPairDo);
        }
        getSqlMapClientTemplate().getSqlMapClient().executeBatch();
    } catch (SQLException ex1) {
        ex1.printStackTrace();
    }
}
Also used : SQLException(java.sql.SQLException) Iterator(java.util.Iterator) DataColumnPairDO(com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairDO)

Example 5 with DataColumnPairDO

use of com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairDO 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);
    }
}
Also used : ColumnPair(com.alibaba.otter.shared.common.model.config.data.ColumnPair) RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) ArrayList(java.util.ArrayList) 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) DataColumnPairDO(com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairDO)

Aggregations

DataColumnPairDO (com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairDO)8 ManagerException (com.alibaba.otter.manager.biz.common.exceptions.ManagerException)5 RepeatConfigureException (com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)5 ColumnPair (com.alibaba.otter.shared.common.model.config.data.ColumnPair)3 ArrayList (java.util.ArrayList)3 SQLException (java.sql.SQLException)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1