Search in sources :

Example 6 with DataMediaPairDO

use of com.alibaba.otter.manager.biz.config.datamediapair.dal.dataobject.DataMediaPairDO 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 7 with DataMediaPairDO

use of com.alibaba.otter.manager.biz.config.datamediapair.dal.dataobject.DataMediaPairDO in project otter by alibaba.

the class DataMediaPairServiceImpl method doToModel.

private List<DataMediaPair> doToModel(List<DataMediaPairDO> dataMediaPairDos) {
    List<Long> dataMediaPairIds = new ArrayList<Long>();
    for (DataMediaPairDO dataMediaPairDo : dataMediaPairDos) {
        dataMediaPairIds.add(dataMediaPairDo.getId());
    }
    Map<Long, List<ColumnPair>> columnPairMap = dataColumnPairService.listByDataMediaPairIds(dataMediaPairIds.toArray(new Long[dataMediaPairIds.size()]));
    Map<Long, List<ColumnGroup>> columnPairGroupMap = dataColumnPairGroupService.listByDataMediaPairIds(dataMediaPairIds.toArray(new Long[dataMediaPairIds.size()]));
    List<DataMediaPair> dataMediaPairs = new ArrayList<DataMediaPair>();
    for (DataMediaPairDO dataMediaPairDo : dataMediaPairDos) {
        List<ColumnPair> columnPairs = columnPairMap.get(dataMediaPairDo.getId()) == null ? new ArrayList<ColumnPair>() : columnPairMap.get(dataMediaPairDo.getId());
        List<ColumnGroup> columnGroups = columnPairGroupMap.get(dataMediaPairDo.getId()) == null ? new ArrayList<ColumnGroup>() : columnPairGroupMap.get(dataMediaPairDo.getId());
        dataMediaPairs.add(doToModel(dataMediaPairDo, columnPairs, columnGroups));
    }
    return dataMediaPairs;
}
Also used : ColumnPair(com.alibaba.otter.shared.common.model.config.data.ColumnPair) DataMediaPair(com.alibaba.otter.shared.common.model.config.data.DataMediaPair) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) ColumnGroup(com.alibaba.otter.shared.common.model.config.data.ColumnGroup) DataMediaPairDO(com.alibaba.otter.manager.biz.config.datamediapair.dal.dataobject.DataMediaPairDO)

Example 8 with DataMediaPairDO

use of com.alibaba.otter.manager.biz.config.datamediapair.dal.dataobject.DataMediaPairDO 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 9 with DataMediaPairDO

use of com.alibaba.otter.manager.biz.config.datamediapair.dal.dataobject.DataMediaPairDO 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)

Example 10 with DataMediaPairDO

use of com.alibaba.otter.manager.biz.config.datamediapair.dal.dataobject.DataMediaPairDO 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)

Aggregations

DataMediaPairDO (com.alibaba.otter.manager.biz.config.datamediapair.dal.dataobject.DataMediaPairDO)10 ManagerException (com.alibaba.otter.manager.biz.common.exceptions.ManagerException)9 RepeatConfigureException (com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)9 DataMediaPair (com.alibaba.otter.shared.common.model.config.data.DataMediaPair)6 ArrayList (java.util.ArrayList)6 ColumnGroup (com.alibaba.otter.shared.common.model.config.data.ColumnGroup)1 ColumnPair (com.alibaba.otter.shared.common.model.config.data.ColumnPair)1 List (java.util.List)1