Arsnael commented on code in PR #1643:
URL: https://github.com/apache/james-project/pull/1643#discussion_r1260543792
##########
server/data/data-jmap-cassandra/src/main/java/org/apache/james/jmap/cassandra/filtering/RuleDTO.java:
##########
@@ -254,13 +279,21 @@ public ActionDTO getAction() {
}
public Rule toRule() {
- return Rule.builder()
+ Rule.Builder ruleBuilder = Rule.builder()
.id(Rule.Id.of(id))
.name(name)
- .condition(conditionDTO.toCondition())
- .name(name)
- .action(actionDTO.toAction())
- .build();
+ .action(actionDTO.toAction());
+
+ if (conditionDTO != null) {
+ ruleBuilder.conditions(Arrays.asList(conditionDTO.toCondition()));
+ } else {
+
ruleBuilder.conditions(conditionDTOs.stream().map(ConditionDTO::toCondition).collect(Collectors.toList()));
+ }
+
+ if (conditionCombiner != null)
ruleBuilder.conditionCombiner(conditionCombiner);
+ else ruleBuilder.conditionCombiner(Rule.ConditionCombiner.AND);
Review Comment:
I think we could have kept the initial layout? Could extract the if else
conditions to functions
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]