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;
}
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);
}
}
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;
}
Aggregations