/*-------------------------------------------------------------*/
private DataMediaPair doToModel(DataMediaPairDO dataMediaPairDo, List<ColumnPair> columnPairs,
List<ColumnGroup> columnGroups) {
DataMediaPair dataMediaPair = new DataMediaPair();
try {
dataMediaPair.setId(dataMediaPairDo.getId());
dataMediaPair.setPipelineId(dataMediaPairDo.getPipelineId());
dataMediaPair.setPullWeight(dataMediaPairDo.getPullWeight());
dataMediaPair.setPushWeight(dataMediaPairDo.getPushWeight());
if (StringUtils.isNotBlank(dataMediaPairDo.getFilter())) {
dataMediaPair.setFilterData(JsonUtils.unmarshalFromString(dataMediaPairDo.getFilter(),
ExtensionData.class));
}
if (StringUtils.isNotBlank(dataMediaPairDo.getResolver())) {
dataMediaPair.setResolverData(JsonUtils.unmarshalFromString(dataMediaPairDo.getResolver(),
ExtensionData.class));
}
dataMediaPair.setColumnPairs(columnPairs);
dataMediaPair.setColumnGroups(columnGroups);
dataMediaPair.setColumnPairMode(dataMediaPairDo.getColumnPairMode());
dataMediaPair.setGmtCreate(dataMediaPairDo.getGmtCreate());
dataMediaPair.setGmtModified(dataMediaPairDo.getGmtModified());
// 组装DataMedia
List<DataMedia> dataMedias = dataMediaService.listByIds(dataMediaPairDo.getSourceDataMediaId(),
dataMediaPairDo.getTargetDataMediaId());
if (null == dataMedias || dataMedias.size() != 2) {
// 抛出异常
return dataMediaPair;
}
for (DataMedia dataMedia : dataMedias) {
if (dataMedia.getId().equals(dataMediaPairDo.getSourceDataMediaId())) {
dataMediaPair.setSource(dataMedia);
} else if (dataMedia.getId().equals(dataMediaPairDo.getTargetDataMediaId())) {
dataMediaPair.setTarget(dataMedia);
}
}
} catch (Exception e) {
logger.error("ERROR ## change the dataMediaPair Do to Model has an exception", e);
throw new ManagerException(e);