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