hungphan227 commented on code in PR #1643:
URL: https://github.com/apache/james-project/pull/1643#discussion_r1264808118


##########
server/data/data-jmap-cassandra/src/main/java/org/apache/james/jmap/cassandra/filtering/RuleDTO.java:
##########
@@ -215,24 +261,43 @@ public static ImmutableList<RuleDTO> from(List<Rule> 
rules) {
     public static RuleDTO from(Rule rule) {
         return new RuleDTO(rule.getId().asString(),
                 rule.getName(),
-                ConditionDTO.from(rule.getCondition()),
+                ConditionGroupDTO.from(rule.getConditionGroup()),
                 ActionDTO.from(rule.getAction()));
     }
 
     private final String id;
     private final String name;
-    private final ConditionDTO conditionDTO;
+    private final ConditionGroupDTO conditionGroupDTO;
     private final ActionDTO actionDTO;
 
+    public RuleDTO(String id,
+                   String name,
+                   ConditionGroupDTO conditionGroupDTO,
+                   ActionDTO actionDTO) {
+        Preconditions.checkNotNull(id);
+
+        this.name = name;
+        this.conditionGroupDTO = conditionGroupDTO;
+        this.actionDTO = actionDTO;
+
+        this.id = id;
+    }
+
     @JsonCreator
     public RuleDTO(@JsonProperty("id") String id,
                    @JsonProperty("name") String name,
                    @JsonProperty("condition") ConditionDTO conditionDTO,
+                   @JsonProperty("conditionGroup") Optional<ConditionGroupDTO> 
conditionGroupDTO,
                    @JsonProperty("action") ActionDTO actionDTO) {
+        Preconditions.checkNotNull(id);
+
         this.name = name;
-        this.conditionDTO = conditionDTO;
+        if (!conditionGroupDTO.isEmpty()) {
+            this.conditionGroupDTO = conditionGroupDTO.get();

Review Comment:
   .get is cheating



-- 
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]

Reply via email to