Search in sources :

Example 1 with DataColumnPairGroupDO

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

the class DataColumnPairGroupServiceImpl method listByDataMediaPairIds.

@Override
public Map<Long, List<ColumnGroup>> listByDataMediaPairIds(Long... dataMediaPairIds) {
    Assert.assertNotNull(dataMediaPairIds);
    Map<Long, List<ColumnGroup>> dataColumnGroups = new HashMap<Long, List<ColumnGroup>>();
    try {
        List<DataColumnPairGroupDO> dataColumnPairGroupDos = dataColumnPairGroupDao.ListByDataMediaPairIds(dataMediaPairIds);
        if (CollectionUtils.isEmpty(dataColumnPairGroupDos)) {
            logger.debug("DEBUG ## couldn't query any dataColumnPairGroup, maybe hasn't create any dataColumnPairGroup.");
            return dataColumnGroups;
        }
        for (DataColumnPairGroupDO dataColumnPairGroupDo : dataColumnPairGroupDos) {
            List<ColumnGroup> columnGroups = dataColumnGroups.get(dataColumnPairGroupDo.getDataMediaPairId());
            if (columnGroups != null) {
                if (!columnGroups.contains(doToModel(dataColumnPairGroupDo))) {
                    columnGroups.add(doToModel(dataColumnPairGroupDo));
                }
            } else {
                columnGroups = new ArrayList<ColumnGroup>();
                columnGroups.add(doToModel(dataColumnPairGroupDo));
                dataColumnGroups.put(dataColumnPairGroupDo.getDataMediaPairId(), columnGroups);
            }
        }
    } catch (Exception e) {
        logger.error("ERROR ## query dataColumnPairGroup by dataMediaId:" + dataMediaPairIds + " has an exception!");
        throw new ManagerException(e);
    }
    return dataColumnGroups;
}
Also used : HashMap(java.util.HashMap) DataColumnPairGroupDO(com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairGroupDO) ArrayList(java.util.ArrayList) List(java.util.List) ColumnGroup(com.alibaba.otter.shared.common.model.config.data.ColumnGroup) 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 2 with DataColumnPairGroupDO

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

the class DataColumnPairGroupServiceImpl method create.

@Override
public void create(ColumnGroup entityObj) {
    Assert.assertNotNull(entityObj);
    try {
        DataColumnPairGroupDO dataColumnPairGroupDo = modelToDo(entityObj);
        dataColumnPairGroupDao.insert(dataColumnPairGroupDo);
    } catch (RepeatConfigureException rcf) {
        throw rcf;
    } catch (Exception e) {
        logger.error("ERROR ## create dataColumnPairGroup has an exception!");
        throw new ManagerException(e);
    }
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) DataColumnPairGroupDO(com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairGroupDO) 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 3 with DataColumnPairGroupDO

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

the class DataColumnPairGroupServiceImpl method modelToDo.

/**
 * 用于Model对象转化为DO对象
 *
 * @param dataColumnPair
 * @return DataMediaPairDO
 */
private DataColumnPairGroupDO modelToDo(ColumnGroup columnGroup) {
    DataColumnPairGroupDO dataColumnPairGroupDo = new DataColumnPairGroupDO();
    dataColumnPairGroupDo.setId(columnGroup.getId());
    dataColumnPairGroupDo.setColumnPairContent(JsonUtils.marshalToString(columnGroup.getColumnPairs()));
    dataColumnPairGroupDo.setDataMediaPairId(columnGroup.getDataMediaPairId());
    dataColumnPairGroupDo.setGmtCreate(columnGroup.getGmtCreate());
    dataColumnPairGroupDo.setGmtModified(columnGroup.getGmtModified());
    return dataColumnPairGroupDo;
}
Also used : DataColumnPairGroupDO(com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairGroupDO)

Aggregations

DataColumnPairGroupDO (com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairGroupDO)3 ManagerException (com.alibaba.otter.manager.biz.common.exceptions.ManagerException)2 RepeatConfigureException (com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)2 ColumnGroup (com.alibaba.otter.shared.common.model.config.data.ColumnGroup)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1