You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by "vttranlina (via GitHub)" <gi...@apache.org> on 2023/07/14 08:52:39 UTC
[GitHub] [james-project] vttranlina commented on a diff in pull request #1643: DRAFT JAMES-4811 implement JMAP filtering: combine rule conditions
vttranlina commented on code in PR #1643:
URL: https://github.com/apache/james-project/pull/1643#discussion_r1263479647
##########
server/data/data-jmap-cassandra/src/main/java/org/apache/james/jmap/cassandra/filtering/RuleDTO.java:
##########
@@ -34,6 +34,43 @@
public class RuleDTO {
+ public static class ConditionGroupDTO {
+
+ private Rule.ConditionCombiner conditionCombiner;
+ private List<ConditionDTO> conditionDTOs;
+
+ public ConditionGroupDTO(@JsonProperty("conditionCombiner") Rule.ConditionCombiner conditionCombiner,
+ @JsonProperty("conditions") List<ConditionDTO> conditionDTOs) {
+ this.conditionCombiner = conditionCombiner;
+ this.conditionDTOs = conditionDTOs;
+ }
+
+ public Rule.ConditionCombiner getConditionCombiner() {
+ return conditionCombiner;
+ }
+
+ public Rule.ConditionGroup toConditionGroup() {
+ return Rule.ConditionGroup.of(conditionCombiner, conditionDTOs.stream().map(ConditionDTO::toCondition).collect(Collectors.toList()));
+ }
+
+ public static ConditionGroupDTO from(Rule.ConditionGroup conditionGroup) {
+ return new ConditionGroupDTO(conditionGroup.getConditionCombiner(), conditionGroup.getConditions().stream().map(ConditionDTO::from).collect(Collectors.toList()));
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ ConditionGroupDTO that = (ConditionGroupDTO) o;
+ return conditionCombiner == that.conditionCombiner && Objects.equals(conditionDTOs, that.conditionDTOs);
+ }
Review Comment:
> "Use equalsVerfier". I do not understand what you mean
nl.jqno.equalsverifier.EqualsVerifier
ex
```
EqualsVerifier.forClass(MDN.class)
.verify();
```
--
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: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org