use of com.alibaba.otter.shared.common.model.config.data.ColumnGroup in project otter by alibaba.
the class AddColumnPairGroup method execute.
public void execute(@Param("dataMediaPairId") Long dataMediaPairId, @Param("pipelineId") Long pipelineId, @Param("channelId") Long channelId, @Param("sourceMediaId") Long sourceMediaId, @Param("targetMediaId") Long targetMediaId, Context context) throws Exception {
List<ColumnPair> columnPairs = dataColumnPairService.listByDataMediaPairId(dataMediaPairId);
if (CollectionUtils.isEmpty(columnPairs)) {
columnPairs.addAll(buildColumnPairFromDataMedia(dataMediaPairId, sourceMediaId, targetMediaId));
} else {
DataMediaPair dataMediaPair = dataMediaPairService.findById(dataMediaPairId);
if (dataMediaPair.getColumnPairMode().isExclude()) {
List<ColumnPair> allColumnPairs = buildColumnPairFromDataMedia(dataMediaPairId, sourceMediaId, targetMediaId);
// 如果是exclude模式,排除掉
allColumnPairs.removeAll(columnPairs);
columnPairs = allColumnPairs;
}
}
List<ColumnGroup> columnGroups = dataColumnPairGroupService.listByDataMediaPairId(dataMediaPairId);
List<ColumnPair> columnPairGroup = new ArrayList<ColumnPair>();
if (CollectionUtils.isNotEmpty(columnGroups)) {
for (ColumnGroup columnGroup : columnGroups) {
List<ColumnPair> columnPairTemp = new ArrayList<ColumnPair>();
columnPairGroup = columnGroup.getColumnPairs();
for (ColumnPair columnPair : columnPairGroup) {
for (ColumnPair subColumnPair : columnPairs) {
if (columnPair.equals(subColumnPair)) {
columnPairTemp.add(subColumnPair);
}
}
}
// 如果是多个Group,需要深度复制columnPair,每个Group需要复制一个
columnPairs.removeAll(columnPairTemp);
}
}
// 未加入group的columnPair定义
context.put("preColumnPairs", columnPairs);
// 当前group的columnPair定义
context.put("columnPairs", columnPairGroup);
context.put("dataMediaPairId", dataMediaPairId);
context.put("channelId", channelId);
context.put("pipelineId", pipelineId);
}
use of com.alibaba.otter.shared.common.model.config.data.ColumnGroup in project otter by alibaba.
the class DataMediaPairInfo method execute.
public void execute(@Param("dataMediaPairId") Long dataMediaPairId, Context context) throws Exception {
DataMediaPair dataMediaPair = dataMediaPairService.findById(dataMediaPairId);
Channel channel = channelService.findByPipelineId(dataMediaPair.getPipelineId());
List<ColumnPair> columnPairs = dataMediaPair.getColumnPairs();
List<ColumnGroup> columnGroups = dataMediaPair.getColumnGroups();
// 暂时策略,只拿出list的第一个Group
ColumnGroup columnGroup = new ColumnGroup();
if (!CollectionUtils.isEmpty(columnGroups)) {
columnGroup = columnGroups.get(0);
}
context.put("dataMediaPair", dataMediaPair);
context.put("columnGroup", columnGroup);
context.put("columnPairs", columnPairs);
context.put("channelId", channel.getId());
}
Aggregations