use of com.webank.wedatasphere.qualitis.rule.request.multi.ModifyMultiSourceRequest in project Qualitis by WeBankFinTech.
the class RuleBatchServiceImpl method addMultiTemplateRule.
private void addMultiTemplateRule(Map<String, List<ExcelMultiTemplateRuleByProject>> multiRulePartitionedByRuleName, Project project, String userName, boolean aomp) throws UnExpectedRequestException, ClusterInfoNotConfigException, TaskNotExistException, PermissionDeniedRequestException {
Map<String, List<ExcelMultiTemplateRuleByProject>> modifyRulePartitionedByRuleName = new HashMap<>(1);
Map<String, List<ExcelMultiTemplateRuleByProject>> addRulePartitionedByRuleName = new HashMap<>(1);
String localeStr = httpServletRequest.getHeader("Content-Language");
for (Iterator<String> iterator = multiRulePartitionedByRuleName.keySet().iterator(); iterator.hasNext(); ) {
String currentRuleName = iterator.next();
Rule currentRule = ruleDao.findByProjectAndRuleName(project, currentRuleName);
if (currentRule != null) {
modifyRulePartitionedByRuleName.put(currentRuleName, multiRulePartitionedByRuleName.get(currentRuleName));
List<AddMultiSourceRuleRequest> addRuleRequestList = constructAddMultiSourceRuleRequest(modifyRulePartitionedByRuleName, project, localeStr);
ModifyMultiSourceRequest modifyRuleRequest = new ModifyMultiSourceRequest();
modifyRuleRequest.setRuleId(currentRule.getId());
AddMultiSourceRuleRequest addRuleRequest = addRuleRequestList.iterator().next();
BeanUtils.copyProperties(addRuleRequest, modifyRuleRequest);
LOGGER.info("Start to modify multi rule. request: {}", modifyRuleRequest);
if (aomp) {
multiSourceRuleService.modifyRuleDetailForOuter(modifyRuleRequest, userName);
} else {
multiSourceRuleService.modifyMultiSourceRule(modifyRuleRequest);
}
LOGGER.info("Success to modify multi rule.");
modifyRulePartitionedByRuleName.clear();
} else {
addRulePartitionedByRuleName.put(currentRuleName, multiRulePartitionedByRuleName.get(currentRuleName));
List<AddMultiSourceRuleRequest> addRuleRequestList = constructAddMultiSourceRuleRequest(addRulePartitionedByRuleName, project, localeStr);
AddMultiSourceRuleRequest currentAddMultiSourceRuleRequest = addRuleRequestList.iterator().next();
LOGGER.info("Start to add multi rule. request: {}", currentAddMultiSourceRuleRequest);
if (aomp) {
currentAddMultiSourceRuleRequest.setLoginUser(userName);
multiSourceRuleService.addRuleForOuter(currentAddMultiSourceRuleRequest, true);
} else {
multiSourceRuleService.addMultiSourceRuleForUpload(currentAddMultiSourceRuleRequest, true);
}
LOGGER.info("Success to add multi rule.");
addRulePartitionedByRuleName.clear();
}
}
}
Aggregations