RED-9472: seperation of system rules
adding logs for bug investigation
This commit is contained in:
parent
bdb29a0e35
commit
d2994f9e14
@ -63,6 +63,7 @@ public class RuleBuilderController implements RuleBuilderResource {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
var droolsValidation = droolsValidationService.testRules(new RuleValidationModel(RuleFileType.ENTITY.name(), mergingResult.getMergedRules()));
|
var droolsValidation = droolsValidationService.testRules(new RuleValidationModel(RuleFileType.ENTITY.name(), mergingResult.getMergedRules()));
|
||||||
|
log.info("result of validation: " + droolsValidation);
|
||||||
droolsValidationResponse = DroolsValidationResponse.builder()
|
droolsValidationResponse = DroolsValidationResponse.builder()
|
||||||
.syntaxErrorMessages(droolsValidation.getSyntaxErrorMessages()
|
.syntaxErrorMessages(droolsValidation.getSyntaxErrorMessages()
|
||||||
.stream()
|
.stream()
|
||||||
@ -99,7 +100,7 @@ public class RuleBuilderController implements RuleBuilderResource {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RulesValidationException("Could not test rules: " + e.getMessage(), e);
|
throw new RulesValidationException("Could not test rules: " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
log.info("result after validation: {}",rulesUpdateRequest);
|
log.info("result after validation: {}", rulesUpdateRequest);
|
||||||
return new ResponseEntity<>(rulesUploadResponse, HttpStatus.OK);
|
return new ResponseEntity<>(rulesUploadResponse, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -69,25 +69,24 @@ public class RuleBuilderService {
|
|||||||
.map(String::trim)
|
.map(String::trim)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
ruleFileBluePrintExisting.setImports(uniqueImports.stream()
|
ruleFileBluePrintExisting.setImports(uniqueImports.stream()
|
||||||
.collect(Collectors.joining("")));
|
.collect(Collectors.joining("")));
|
||||||
Set<String> uniqueGlobals = Arrays.stream((ruleFileBluePrintExisting.getGlobals() + mergedRuleFileBlueprint.getGlobals()).replaceAll("\n", "").split("import"))
|
Set<String> uniqueGlobals = Arrays.stream((ruleFileBluePrintExisting.getGlobals() + mergedRuleFileBlueprint.getGlobals()).replaceAll("\n", "").split("import"))
|
||||||
.map(String::trim)
|
.map(String::trim)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
ruleFileBluePrintExisting.setGlobals(uniqueGlobals.stream()
|
ruleFileBluePrintExisting.setGlobals(uniqueGlobals.stream()
|
||||||
.collect(Collectors.joining("")));
|
.collect(Collectors.joining("")));
|
||||||
ruleFileBluePrintExisting.setFunctions(Stream.concat(ruleFileBluePrintExisting.getFunctions()
|
ruleFileBluePrintExisting.setFunctions(Stream.concat(ruleFileBluePrintExisting.getFunctions()
|
||||||
.stream(),
|
.stream(),
|
||||||
mergedRuleFileBlueprint.getFunctions()
|
mergedRuleFileBlueprint.getFunctions()
|
||||||
.stream())
|
.stream())
|
||||||
.distinct()
|
.distinct()
|
||||||
.toList());
|
.toList());
|
||||||
ruleFileBluePrintExisting.setDeclarations(Stream.concat(ruleFileBluePrintExisting.getDeclarations()
|
ruleFileBluePrintExisting.setDeclarations(Stream.concat(ruleFileBluePrintExisting.getDeclarations()
|
||||||
.stream(),
|
.stream(),
|
||||||
mergedRuleFileBlueprint.getDeclarations()
|
mergedRuleFileBlueprint.getDeclarations()
|
||||||
.stream())
|
.stream())
|
||||||
.distinct()
|
.distinct()
|
||||||
.toList());
|
.toList());
|
||||||
log.info("merged rules: {}", RuleFileFactory.buildRuleString(ruleFileBluePrintExisting, false, false));
|
|
||||||
return RuleMergingResult.builder()
|
return RuleMergingResult.builder()
|
||||||
.mergedRules(RuleFileFactory.buildRuleString(mergedRuleFileBlueprint, false, false))
|
.mergedRules(RuleFileFactory.buildRuleString(mergedRuleFileBlueprint, false, false))
|
||||||
.addedGlobalsOffset(mergedRuleFileBlueprint.getGlobals().length())
|
.addedGlobalsOffset(mergedRuleFileBlueprint.getGlobals().length())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user