diff --git a/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/MessageCriteria.java b/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/MessageCriteria.java index 26ec283e9..a6959944a 100644 --- a/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/MessageCriteria.java +++ b/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/MessageCriteria.java @@ -16,14 +16,19 @@ package org.citrusframework.simulator.service.criteria; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; import org.citrusframework.simulator.service.filter.InstantFilter; import org.citrusframework.simulator.service.filter.IntegerFilter; import org.citrusframework.simulator.service.filter.LongFilter; import org.citrusframework.simulator.service.filter.StringFilter; import org.springdoc.core.annotations.ParameterObject; +import java.io.Serial; import java.io.Serializable; -import java.util.Objects; /** * Criteria class for the {@link org.citrusframework.simulator.model.Message} entity. This class is used @@ -37,10 +42,13 @@ * specific {@link org.citrusframework.simulator.service.filter.Filter} class are used, we need to use fix type specific * filters. */ +@Getter +@Setter +@ToString @ParameterObject -@SuppressWarnings("common-java:DuplicatedBlocks") public class MessageCriteria implements Serializable, Criteria { + @Serial private static final long serialVersionUID = 1L; private LongFilter messageId; @@ -81,10 +89,6 @@ public MessageCriteria copy() { return new MessageCriteria(this); } - public LongFilter getMessageId() { - return messageId; - } - public LongFilter messageId() { if (messageId == null) { messageId = new LongFilter(); @@ -92,14 +96,6 @@ public LongFilter messageId() { return messageId; } - public void setMessageId(LongFilter messageId) { - this.messageId = messageId; - } - - public IntegerFilter getDirection() { - return direction; - } - public IntegerFilter direction() { if (direction == null) { direction = new IntegerFilter(); @@ -107,14 +103,6 @@ public IntegerFilter direction() { return direction; } - public void setDirection(IntegerFilter direction) { - this.direction = direction; - } - - public StringFilter getPayload() { - return payload; - } - public StringFilter payload() { if (payload == null) { payload = new StringFilter(); @@ -122,14 +110,6 @@ public StringFilter payload() { return payload; } - public void setPayload(StringFilter payload) { - this.payload = payload; - } - - public StringFilter getCitrusMessageId() { - return citrusMessageId; - } - public StringFilter citrusMessageId() { if (citrusMessageId == null) { citrusMessageId = new StringFilter(); @@ -137,14 +117,6 @@ public StringFilter citrusMessageId() { return citrusMessageId; } - public void setCitrusMessageId(StringFilter citrusMessageId) { - this.citrusMessageId = citrusMessageId; - } - - public LongFilter getHeadersId() { - return headersId; - } - public LongFilter headersId() { if (headersId == null) { headersId = new LongFilter(); @@ -152,14 +124,6 @@ public LongFilter headersId() { return headersId; } - public void setHeadersId(LongFilter headersId) { - this.headersId = headersId; - } - - public LongFilter getScenarioExecutionId() { - return scenarioExecutionId; - } - public LongFilter scenarioExecutionId() { if (scenarioExecutionId == null) { scenarioExecutionId = new LongFilter(); @@ -167,14 +131,6 @@ public LongFilter scenarioExecutionId() { return scenarioExecutionId; } - public void setScenarioExecutionId(LongFilter scenarioExecutionId) { - this.scenarioExecutionId = scenarioExecutionId; - } - - public InstantFilter getCreatedDate() { - return createdDate; - } - public InstantFilter createdDate() { if (createdDate == null) { createdDate = new InstantFilter(); @@ -182,14 +138,6 @@ public InstantFilter createdDate() { return createdDate; } - public void setCreatedDate(InstantFilter createdDate) { - this.createdDate = createdDate; - } - - public InstantFilter getLastModifiedDate() { - return lastModifiedDate; - } - public InstantFilter lastModifiedDate() { if (lastModifiedDate == null) { lastModifiedDate = new InstantFilter(); @@ -197,58 +145,37 @@ public InstantFilter lastModifiedDate() { return lastModifiedDate; } - public void setLastModifiedDate(InstantFilter lastModifiedDate) { - this.lastModifiedDate = lastModifiedDate; - } - - public Boolean getDistinct() { - return distinct; - } - - public void setDistinct(Boolean distinct) { - this.distinct = distinct; - } - @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { + if (!(o instanceof MessageCriteria messageCriteria)) { return false; } - final MessageCriteria that = (MessageCriteria) o; - return ( - Objects.equals(messageId, that.messageId) && - Objects.equals(direction, that.direction) && - Objects.equals(payload, that.payload) && - Objects.equals(citrusMessageId, that.citrusMessageId) && - Objects.equals(headersId, that.headersId) && - Objects.equals(scenarioExecutionId, that.scenarioExecutionId) && - Objects.equals(createdDate, that.createdDate) && - Objects.equals(lastModifiedDate, that.lastModifiedDate) && - Objects.equals(distinct, that.distinct) - ); - } - @Override - public int hashCode() { - return Objects.hash(messageId, direction, payload, citrusMessageId, headersId, scenarioExecutionId, createdDate, lastModifiedDate, distinct); + return new EqualsBuilder() + .append(messageId, messageCriteria.messageId) + .append(direction, messageCriteria.messageId) + .append(payload, messageCriteria.payload) + .append(citrusMessageId, messageCriteria.citrusMessageId) + .append(headersId, messageCriteria.headersId) + .append(scenarioExecutionId, messageCriteria.scenarioExecutionId) + .append(createdDate, messageCriteria.createdDate) + .append(lastModifiedDate, messageCriteria.lastModifiedDate) + .append(distinct, messageCriteria.distinct) + .isEquals(); } - // prettier-ignore @Override - public String toString() { - return "MessageCriteria{" + - (messageId != null ? "messageId=" + messageId + ", " : "") + - (direction != null ? "direction=" + direction + ", " : "") + - (payload != null ? "payload=" + payload + ", " : "") + - (citrusMessageId != null ? "citrusMessageId=" + citrusMessageId + ", " : "") + - (headersId != null ? "headersId=" + headersId + ", " : "") + - (scenarioExecutionId != null ? "scenarioExecutionId=" + scenarioExecutionId + ", " : "") + - (createdDate != null ? "createdDate=" + createdDate + ", " : "") + - (lastModifiedDate != null ? "lastModifiedDate=" + lastModifiedDate + ", " : "") + - (distinct != null ? "distinct=" + distinct + ", " : "") + - "}"; + public int hashCode() { + return new HashCodeBuilder() + .append(messageId) + .append(direction) + .append(payload) + .append(citrusMessageId) + .append(headersId) + .append(scenarioExecutionId) + .append(createdDate) + .append(lastModifiedDate) + .append(distinct) + .toHashCode(); } } diff --git a/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/MessageHeaderCriteria.java b/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/MessageHeaderCriteria.java index e7cf49760..c8a9d1fee 100644 --- a/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/MessageHeaderCriteria.java +++ b/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/MessageHeaderCriteria.java @@ -16,13 +16,18 @@ package org.citrusframework.simulator.service.criteria; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; import org.citrusframework.simulator.service.filter.InstantFilter; import org.citrusframework.simulator.service.filter.LongFilter; import org.citrusframework.simulator.service.filter.StringFilter; import org.springdoc.core.annotations.ParameterObject; +import java.io.Serial; import java.io.Serializable; -import java.util.Objects; /** * Criteria class for the {@link org.citrusframework.simulator.model.MessageHeader} entity. This class is used @@ -36,10 +41,13 @@ * specific {@link org.citrusframework.simulator.service.filter.Filter} class are used, we need to use fix type specific * filters. */ +@Getter +@Setter +@ToString @ParameterObject -@SuppressWarnings("common-java:DuplicatedBlocks") public class MessageHeaderCriteria implements Serializable, Criteria { + @Serial private static final long serialVersionUID = 1L; private LongFilter headerId; @@ -56,7 +64,8 @@ public class MessageHeaderCriteria implements Serializable, Criteria { private Boolean distinct; - public MessageHeaderCriteria() {} + public MessageHeaderCriteria() { + } public MessageHeaderCriteria(MessageHeaderCriteria other) { this.headerId = other.headerId == null ? null : other.headerId.copy(); @@ -73,10 +82,6 @@ public MessageHeaderCriteria copy() { return new MessageHeaderCriteria(this); } - public LongFilter getHeaderId() { - return headerId; - } - public LongFilter headerId() { if (headerId == null) { headerId = new LongFilter(); @@ -84,14 +89,6 @@ public LongFilter headerId() { return headerId; } - public void setHeaderId(LongFilter headerId) { - this.headerId = headerId; - } - - public StringFilter getName() { - return name; - } - public StringFilter name() { if (name == null) { name = new StringFilter(); @@ -99,14 +96,6 @@ public StringFilter name() { return name; } - public void setName(StringFilter name) { - this.name = name; - } - - public StringFilter getValue() { - return value; - } - public StringFilter value() { if (value == null) { value = new StringFilter(); @@ -114,14 +103,6 @@ public StringFilter value() { return value; } - public void setValue(StringFilter value) { - this.value = value; - } - - public InstantFilter getCreatedDate() { - return createdDate; - } - public InstantFilter createdDate() { if (createdDate == null) { createdDate = new InstantFilter(); @@ -129,14 +110,6 @@ public InstantFilter createdDate() { return createdDate; } - public void setCreatedDate(InstantFilter createdDate) { - this.createdDate = createdDate; - } - - public InstantFilter getLastModifiedDate() { - return lastModifiedDate; - } - public InstantFilter lastModifiedDate() { if (lastModifiedDate == null) { lastModifiedDate = new InstantFilter(); @@ -144,14 +117,6 @@ public InstantFilter lastModifiedDate() { return lastModifiedDate; } - public void setLastModifiedDate(InstantFilter lastModifiedDate) { - this.lastModifiedDate = lastModifiedDate; - } - - public LongFilter getMessageId() { - return messageId; - } - public LongFilter messageId() { if (messageId == null) { messageId = new LongFilter(); @@ -159,54 +124,33 @@ public LongFilter messageId() { return messageId; } - public void setMessageId(LongFilter messageId) { - this.messageId = messageId; - } - - public Boolean getDistinct() { - return distinct; - } - - public void setDistinct(Boolean distinct) { - this.distinct = distinct; - } - @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { + if (!(o instanceof MessageHeaderCriteria messageHeaderCriteria)) { return false; } - final MessageHeaderCriteria that = (MessageHeaderCriteria) o; - return ( - Objects.equals(headerId, that.headerId) && - Objects.equals(name, that.name) && - Objects.equals(value, that.value) && - Objects.equals(createdDate, that.createdDate) && - Objects.equals(lastModifiedDate, that.lastModifiedDate) && - Objects.equals(messageId, that.messageId) && - Objects.equals(distinct, that.distinct) - ); - } - @Override - public int hashCode() { - return Objects.hash(headerId, name, value, createdDate, lastModifiedDate, messageId, distinct); + return new EqualsBuilder() + .append(headerId, messageHeaderCriteria.headerId) + .append(name, messageHeaderCriteria.name) + .append(value, messageHeaderCriteria.value) + .append(createdDate, messageHeaderCriteria.createdDate) + .append(lastModifiedDate, messageHeaderCriteria.lastModifiedDate) + .append(messageId, messageHeaderCriteria.messageId) + .append(distinct, messageHeaderCriteria.distinct) + .isEquals(); } - // prettier-ignore @Override - public String toString() { - return "MessageHeaderCriteria{" + - (headerId != null ? "headerId=" + headerId + ", " : "") + - (name != null ? "name=" + name + ", " : "") + - (value != null ? "value=" + value + ", " : "") + - (createdDate != null ? "createdDate=" + createdDate + ", " : "") + - (lastModifiedDate != null ? "lastModifiedDate=" + lastModifiedDate + ", " : "") + - (messageId != null ? "messageId=" + messageId + ", " : "") + - (distinct != null ? "distinct=" + distinct + ", " : "") + - "}"; + public int hashCode() { + return new HashCodeBuilder() + .append(headerId) + .append(name) + .append(value) + .append(createdDate) + .append(lastModifiedDate) + .append(messageId) + .append(distinct) + .toHashCode(); } } diff --git a/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/ScenarioActionCriteria.java b/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/ScenarioActionCriteria.java index b7e48910e..26920b6e0 100644 --- a/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/ScenarioActionCriteria.java +++ b/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/ScenarioActionCriteria.java @@ -16,13 +16,18 @@ package org.citrusframework.simulator.service.criteria; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; import org.citrusframework.simulator.service.filter.InstantFilter; import org.citrusframework.simulator.service.filter.LongFilter; import org.citrusframework.simulator.service.filter.StringFilter; import org.springdoc.core.annotations.ParameterObject; +import java.io.Serial; import java.io.Serializable; -import java.util.Objects; /** * Criteria class for the {@link org.citrusframework.simulator.model.ScenarioAction} entity. This class is used @@ -36,10 +41,13 @@ * specific {@link org.citrusframework.simulator.service.filter.Filter} class are used, we need to use fix type specific * filters. */ +@Getter +@Setter +@ToString @ParameterObject -@SuppressWarnings("common-java:DuplicatedBlocks") public class ScenarioActionCriteria implements Serializable, Criteria { + @Serial private static final long serialVersionUID = 1L; private LongFilter actionId; @@ -54,7 +62,8 @@ public class ScenarioActionCriteria implements Serializable, Criteria { private Boolean distinct; - public ScenarioActionCriteria() {} + public ScenarioActionCriteria() { + } public ScenarioActionCriteria(ScenarioActionCriteria other) { this.actionId = other.actionId == null ? null : other.actionId.copy(); @@ -70,10 +79,6 @@ public ScenarioActionCriteria copy() { return new ScenarioActionCriteria(this); } - public LongFilter getActionId() { - return actionId; - } - public LongFilter id() { if (actionId == null) { actionId = new LongFilter(); @@ -81,14 +86,6 @@ public LongFilter id() { return actionId; } - public void setActionId(LongFilter actionId) { - this.actionId = actionId; - } - - public StringFilter getName() { - return name; - } - public StringFilter name() { if (name == null) { name = new StringFilter(); @@ -96,14 +93,6 @@ public StringFilter name() { return name; } - public void setName(StringFilter name) { - this.name = name; - } - - public InstantFilter getStartDate() { - return startDate; - } - public InstantFilter startDate() { if (startDate == null) { startDate = new InstantFilter(); @@ -111,14 +100,6 @@ public InstantFilter startDate() { return startDate; } - public void setStartDate(InstantFilter startDate) { - this.startDate = startDate; - } - - public InstantFilter getEndDate() { - return endDate; - } - public InstantFilter endDate() { if (endDate == null) { endDate = new InstantFilter(); @@ -126,14 +107,6 @@ public InstantFilter endDate() { return endDate; } - public void setEndDate(InstantFilter endDate) { - this.endDate = endDate; - } - - public LongFilter getScenarioExecutionId() { - return scenarioExecutionId; - } - public LongFilter scenarioExecutionId() { if (scenarioExecutionId == null) { scenarioExecutionId = new LongFilter(); @@ -141,52 +114,31 @@ public LongFilter scenarioExecutionId() { return scenarioExecutionId; } - public void setScenarioExecutionId(LongFilter scenarioExecutionId) { - this.scenarioExecutionId = scenarioExecutionId; - } - - public Boolean getDistinct() { - return distinct; - } - - public void setDistinct(Boolean distinct) { - this.distinct = distinct; - } - @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { + if (!(o instanceof ScenarioActionCriteria scenarioActionCriteria)) { return false; } - final ScenarioActionCriteria that = (ScenarioActionCriteria) o; - return ( - Objects.equals(actionId, that.actionId) && - Objects.equals(name, that.name) && - Objects.equals(startDate, that.startDate) && - Objects.equals(endDate, that.endDate) && - Objects.equals(scenarioExecutionId, that.scenarioExecutionId) && - Objects.equals(distinct, that.distinct) - ); - } - @Override - public int hashCode() { - return Objects.hash(actionId, name, startDate, endDate, scenarioExecutionId, distinct); + return new EqualsBuilder() + .append(actionId, scenarioActionCriteria.actionId) + .append(name, scenarioActionCriteria.name) + .append(startDate, scenarioActionCriteria.startDate) + .append(endDate, scenarioActionCriteria.endDate) + .append(scenarioExecutionId, scenarioActionCriteria.scenarioExecutionId) + .append(distinct, scenarioActionCriteria.distinct) + .isEquals(); } - // prettier-ignore @Override - public String toString() { - return "ScenarioActionCriteria{" + - (actionId != null ? "actionId=" + actionId + ", " : "") + - (name != null ? "name=" + name + ", " : "") + - (startDate != null ? "startDate=" + startDate + ", " : "") + - (endDate != null ? "endDate=" + endDate + ", " : "") + - (scenarioExecutionId != null ? "scenarioExecutionId=" + scenarioExecutionId + ", " : "") + - (distinct != null ? "distinct=" + distinct + ", " : "") + - "}"; + public int hashCode() { + return new HashCodeBuilder() + .append(actionId) + .append(name) + .append(startDate) + .append(endDate) + .append(scenarioExecutionId) + .append(distinct) + .toHashCode(); } } diff --git a/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/ScenarioExecutionCriteria.java b/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/ScenarioExecutionCriteria.java index 676b3f407..007ea4ea4 100644 --- a/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/ScenarioExecutionCriteria.java +++ b/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/ScenarioExecutionCriteria.java @@ -18,14 +18,17 @@ import lombok.Getter; import lombok.Setter; +import lombok.ToString; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; import org.citrusframework.simulator.service.filter.InstantFilter; import org.citrusframework.simulator.service.filter.IntegerFilter; import org.citrusframework.simulator.service.filter.LongFilter; import org.citrusframework.simulator.service.filter.StringFilter; import org.springdoc.core.annotations.ParameterObject; +import java.io.Serial; import java.io.Serializable; -import java.util.Objects; /** * Criteria class for the {@link org.citrusframework.simulator.model.ScenarioExecution} entity. This class is used @@ -41,10 +44,11 @@ */ @Getter @Setter +@ToString @ParameterObject -@SuppressWarnings("common-java:DuplicatedBlocks") public class ScenarioExecutionCriteria implements Serializable, Criteria { + @Serial private static final long serialVersionUID = 1L; private LongFilter executionId; @@ -156,48 +160,37 @@ public LongFilter scenarioParametersId() { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { + if (!(o instanceof ScenarioExecutionCriteria scenarioExecutionCriteria)) { return false; } - final ScenarioExecutionCriteria that = (ScenarioExecutionCriteria) o; - return ( - Objects.equals(executionId, that.executionId) && - Objects.equals(startDate, that.startDate) && - Objects.equals(endDate, that.endDate) && - Objects.equals(scenarioName, that.scenarioName) && - Objects.equals(status, that.status) && - Objects.equals(errorMessage, that.errorMessage) && - Objects.equals(scenarioActionsId, that.scenarioActionsId) && - Objects.equals(scenarioMessagesId, that.scenarioMessagesId) && - Objects.equals(scenarioParametersId, that.scenarioParametersId) && - Objects.equals(headers, that.headers) && - Objects.equals(distinct, that.distinct) - ); - } - @Override - public int hashCode() { - return Objects.hash(executionId, startDate, endDate, scenarioName, status, errorMessage, scenarioActionsId, scenarioMessagesId, scenarioParametersId, headers, distinct); + return new EqualsBuilder() + .append(executionId, scenarioExecutionCriteria.executionId) + .append(startDate, scenarioExecutionCriteria.startDate) + .append(endDate, scenarioExecutionCriteria.endDate) + .append(scenarioName, scenarioExecutionCriteria.scenarioName) + .append(status, scenarioExecutionCriteria.status) + .append(errorMessage, scenarioExecutionCriteria.errorMessage) + .append(scenarioActionsId, scenarioExecutionCriteria.scenarioActionsId) + .append(scenarioMessagesId, scenarioExecutionCriteria.scenarioMessagesId) + .append(scenarioParametersId, scenarioExecutionCriteria.scenarioParametersId) + .append(distinct, scenarioExecutionCriteria.distinct) + .isEquals(); } - // prettier-ignore @Override - public String toString() { - return "ScenarioExecutionCriteria{" + - (executionId != null ? "executionId=" + executionId + ", " : "") + - (startDate != null ? "startDate=" + startDate + ", " : "") + - (endDate != null ? "endDate=" + endDate + ", " : "") + - (scenarioName != null ? "scenarioName=" + scenarioName + ", " : "") + - (status != null ? "status=" + status + ", " : "") + - (errorMessage != null ? "errorMessage=" + errorMessage + ", " : "") + - (scenarioActionsId != null ? "scenarioActionsId=" + scenarioActionsId + ", " : "") + - (scenarioMessagesId != null ? "scenarioMessagesId=" + scenarioMessagesId + ", " : "") + - (scenarioMessagesId != null ? "scenarioParametersId=" + scenarioParametersId + ", " : "") + - (headers != null ? "headers=" + headers + ", " : "") + - (distinct != null ? "distinct=" + distinct + ", " : "") + - "}"; + public int hashCode() { + return new HashCodeBuilder() + .append(executionId) + .append(startDate) + .append(endDate) + .append(scenarioName) + .append(status) + .append(errorMessage) + .append(scenarioActionsId) + .append(scenarioMessagesId) + .append(scenarioParametersId) + .append(distinct) + .toHashCode(); } } diff --git a/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/ScenarioParameterCriteria.java b/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/ScenarioParameterCriteria.java index 142f0e066..15d6411a3 100644 --- a/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/ScenarioParameterCriteria.java +++ b/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/ScenarioParameterCriteria.java @@ -16,14 +16,19 @@ package org.citrusframework.simulator.service.criteria; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; import org.citrusframework.simulator.service.filter.InstantFilter; import org.citrusframework.simulator.service.filter.IntegerFilter; import org.citrusframework.simulator.service.filter.LongFilter; import org.citrusframework.simulator.service.filter.StringFilter; import org.springdoc.core.annotations.ParameterObject; +import java.io.Serial; import java.io.Serializable; -import java.util.Objects; /** * Criteria class for the {@link org.citrusframework.simulator.model.ScenarioParameter} entity. This class is used @@ -37,10 +42,13 @@ * specific {@link org.citrusframework.simulator.service.filter.Filter} class are used, we need to use fix type * specific filters. */ +@Getter +@Setter +@ToString @ParameterObject -@SuppressWarnings("common-java:DuplicatedBlocks") public class ScenarioParameterCriteria implements Serializable, Criteria { + @Serial private static final long serialVersionUID = 1L; private LongFilter parameterId; @@ -78,10 +86,6 @@ public ScenarioParameterCriteria copy() { return new ScenarioParameterCriteria(this); } - public LongFilter getParameterId() { - return parameterId; - } - public LongFilter id() { if (parameterId == null) { parameterId = new LongFilter(); @@ -89,14 +93,6 @@ public LongFilter id() { return parameterId; } - public void setParameterId(LongFilter parameterId) { - this.parameterId = parameterId; - } - - public StringFilter getName() { - return name; - } - public StringFilter name() { if (name == null) { name = new StringFilter(); @@ -104,14 +100,6 @@ public StringFilter name() { return name; } - public void setName(StringFilter name) { - this.name = name; - } - - public IntegerFilter getControlType() { - return controlType; - } - public IntegerFilter controlType() { if (controlType == null) { controlType = new IntegerFilter(); @@ -119,14 +107,6 @@ public IntegerFilter controlType() { return controlType; } - public void setControlType(IntegerFilter controlType) { - this.controlType = controlType; - } - - public StringFilter getValue() { - return value; - } - public StringFilter value() { if (value == null) { value = new StringFilter(); @@ -134,14 +114,6 @@ public StringFilter value() { return value; } - public void setValue(StringFilter value) { - this.value = value; - } - - public InstantFilter getCreatedDate() { - return createdDate; - } - public InstantFilter createdDate() { if (createdDate == null) { createdDate = new InstantFilter(); @@ -149,14 +121,6 @@ public InstantFilter createdDate() { return createdDate; } - public void setCreatedDate(InstantFilter createdDate) { - this.createdDate = createdDate; - } - - public InstantFilter getLastModifiedDate() { - return lastModifiedDate; - } - public InstantFilter lastModifiedDate() { if (lastModifiedDate == null) { lastModifiedDate = new InstantFilter(); @@ -164,14 +128,6 @@ public InstantFilter lastModifiedDate() { return lastModifiedDate; } - public void setLastModifiedDate(InstantFilter lastModifiedDate) { - this.lastModifiedDate = lastModifiedDate; - } - - public LongFilter getScenarioExecutionId() { - return scenarioExecutionId; - } - public LongFilter scenarioExecutionId() { if (scenarioExecutionId == null) { scenarioExecutionId = new LongFilter(); @@ -179,56 +135,35 @@ public LongFilter scenarioExecutionId() { return scenarioExecutionId; } - public void setScenarioExecutionId(LongFilter scenarioExecutionId) { - this.scenarioExecutionId = scenarioExecutionId; - } - - public Boolean getDistinct() { - return distinct; - } - - public void setDistinct(Boolean distinct) { - this.distinct = distinct; - } - @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { + if (!(o instanceof ScenarioParameterCriteria scenarioParameterCriteria)) { return false; } - final ScenarioParameterCriteria that = (ScenarioParameterCriteria) o; - return ( - Objects.equals(parameterId, that.parameterId) && - Objects.equals(name, that.name) && - Objects.equals(controlType, that.controlType) && - Objects.equals(value, that.value) && - Objects.equals(createdDate, that.createdDate) && - Objects.equals(lastModifiedDate, that.lastModifiedDate) && - Objects.equals(scenarioExecutionId, that.scenarioExecutionId) && - Objects.equals(distinct, that.distinct) - ); - } - @Override - public int hashCode() { - return Objects.hash(parameterId, name, controlType, value, createdDate, lastModifiedDate, scenarioExecutionId, distinct); + return new EqualsBuilder() + .append(parameterId, scenarioParameterCriteria.parameterId) + .append(name, scenarioParameterCriteria.name) + .append(controlType, scenarioParameterCriteria.controlType) + .append(value, scenarioParameterCriteria.value) + .append(createdDate, scenarioParameterCriteria.createdDate) + .append(lastModifiedDate, scenarioParameterCriteria.lastModifiedDate) + .append(scenarioExecutionId, scenarioParameterCriteria.scenarioExecutionId) + .append(distinct, scenarioParameterCriteria.distinct) + .isEquals(); } - // prettier-ignore @Override - public String toString() { - return "ScenarioParameterCriteria{" + - (parameterId != null ? "parameterId=" + parameterId + ", " : "") + - (name != null ? "name=" + name + ", " : "") + - (controlType != null ? "controlType=" + controlType + ", " : "") + - (value != null ? "value=" + value + ", " : "") + - (createdDate != null ? "createdDate=" + createdDate + ", " : "") + - (lastModifiedDate != null ? "lastModifiedDate=" + lastModifiedDate + ", " : "") + - (scenarioExecutionId != null ? "scenarioExecutionId=" + scenarioExecutionId + ", " : "") + - (distinct != null ? "distinct=" + distinct + ", " : "") + - "}"; + public int hashCode() { + return new HashCodeBuilder() + .append(parameterId) + .append(name) + .append(controlType) + .append(value) + .append(createdDate) + .append(lastModifiedDate) + .append(scenarioExecutionId) + .append(distinct) + .toHashCode(); } } diff --git a/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/TestParameterCriteria.java b/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/TestParameterCriteria.java index 74a6e878a..d3bb07188 100644 --- a/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/TestParameterCriteria.java +++ b/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/TestParameterCriteria.java @@ -16,13 +16,18 @@ package org.citrusframework.simulator.service.criteria; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; import org.citrusframework.simulator.service.filter.InstantFilter; import org.citrusframework.simulator.service.filter.LongFilter; import org.citrusframework.simulator.service.filter.StringFilter; import org.springdoc.core.annotations.ParameterObject; +import java.io.Serial; import java.io.Serializable; -import java.util.Objects; /** * Criteria class for the {@link org.citrusframework.simulator.model.TestParameter} entity. This class is used @@ -36,10 +41,13 @@ * specific {@link org.citrusframework.simulator.service.filter.Filter} class are used, we need to use fix type specific * filters. */ +@Getter +@Setter +@ToString @ParameterObject -@SuppressWarnings("common-java:DuplicatedBlocks") public class TestParameterCriteria implements Serializable, Criteria { + @Serial private static final long serialVersionUID = 1L; private StringFilter key; @@ -54,7 +62,8 @@ public class TestParameterCriteria implements Serializable, Criteria { private Boolean distinct; - public TestParameterCriteria() {} + public TestParameterCriteria() { + } public TestParameterCriteria(TestParameterCriteria other) { this.key = other.key == null ? null : other.key.copy(); @@ -70,10 +79,6 @@ public TestParameterCriteria copy() { return new TestParameterCriteria(this); } - public StringFilter getKey() { - return key; - } - public StringFilter key() { if (key == null) { key = new StringFilter(); @@ -81,14 +86,6 @@ public StringFilter key() { return key; } - public void setKey(StringFilter key) { - this.key = key; - } - - public StringFilter getValue() { - return value; - } - public StringFilter value() { if (value == null) { value = new StringFilter(); @@ -96,14 +93,6 @@ public StringFilter value() { return value; } - public void setValue(StringFilter value) { - this.value = value; - } - - public InstantFilter getCreatedDate() { - return createdDate; - } - public InstantFilter createdDate() { if (createdDate == null) { createdDate = new InstantFilter(); @@ -111,14 +100,6 @@ public InstantFilter createdDate() { return createdDate; } - public void setCreatedDate(InstantFilter createdDate) { - this.createdDate = createdDate; - } - - public InstantFilter getLastModifiedDate() { - return lastModifiedDate; - } - public InstantFilter lastModifiedDate() { if (lastModifiedDate == null) { lastModifiedDate = new InstantFilter(); @@ -126,14 +107,6 @@ public InstantFilter lastModifiedDate() { return lastModifiedDate; } - public void setLastModifiedDate(InstantFilter lastModifiedDate) { - this.lastModifiedDate = lastModifiedDate; - } - - public LongFilter getTestResultId() { - return testResultId; - } - public LongFilter testResultId() { if (testResultId == null) { testResultId = new LongFilter(); @@ -141,52 +114,31 @@ public LongFilter testResultId() { return testResultId; } - public void setTestResultId(LongFilter testResultId) { - this.testResultId = testResultId; - } - - public Boolean getDistinct() { - return distinct; - } - - public void setDistinct(Boolean distinct) { - this.distinct = distinct; - } - @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { + if (!(o instanceof TestParameterCriteria testParameterCriteria)) { return false; } - final TestParameterCriteria that = (TestParameterCriteria) o; - return ( - Objects.equals(key, that.key) && - Objects.equals(value, that.value) && - Objects.equals(createdDate, that.createdDate) && - Objects.equals(lastModifiedDate, that.lastModifiedDate) && - Objects.equals(testResultId, that.testResultId) && - Objects.equals(distinct, that.distinct) - ); - } - @Override - public int hashCode() { - return Objects.hash(key, value, createdDate, lastModifiedDate, testResultId, distinct); + return new EqualsBuilder() + .append(key, testParameterCriteria.key) + .append(value, testParameterCriteria.value) + .append(createdDate, testParameterCriteria.createdDate) + .append(lastModifiedDate, testParameterCriteria.lastModifiedDate) + .append(testResultId, testParameterCriteria.testResultId) + .append(distinct, testParameterCriteria.distinct) + .isEquals(); } - // prettier-ignore @Override - public String toString() { - return "TestParameterCriteria{" + - (key != null ? "key=" + key + ", " : "") + - (value != null ? "value=" + value + ", " : "") + - (createdDate != null ? "createdDate=" + createdDate + ", " : "") + - (lastModifiedDate != null ? "lastModifiedDate=" + lastModifiedDate + ", " : "") + - (testResultId != null ? "testResultId=" + testResultId + ", " : "") + - (distinct != null ? "distinct=" + distinct + ", " : "") + - "}"; + public int hashCode() { + return new HashCodeBuilder() + .append(key) + .append(value) + .append(createdDate) + .append(lastModifiedDate) + .append(testResultId) + .append(distinct) + .toHashCode(); } } diff --git a/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/TestResultCriteria.java b/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/TestResultCriteria.java index fcfc69541..d60da85bf 100644 --- a/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/TestResultCriteria.java +++ b/simulator-spring-boot/src/main/java/org/citrusframework/simulator/service/criteria/TestResultCriteria.java @@ -16,14 +16,19 @@ package org.citrusframework.simulator.service.criteria; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; import org.citrusframework.simulator.service.filter.InstantFilter; import org.citrusframework.simulator.service.filter.IntegerFilter; import org.citrusframework.simulator.service.filter.LongFilter; import org.citrusframework.simulator.service.filter.StringFilter; import org.springdoc.core.annotations.ParameterObject; +import java.io.Serial; import java.io.Serializable; -import java.util.Objects; /** * Criteria class for the {@link org.citrusframework.simulator.model.TestResult} entity. This class is used @@ -37,10 +42,13 @@ * specific {@link org.citrusframework.simulator.service.filter.Filter} class are used, we need to use fix type specific * filters. */ +@Getter +@Setter +@ToString @ParameterObject -@SuppressWarnings("common-java:DuplicatedBlocks") public class TestResultCriteria implements Serializable, Criteria { + @Serial private static final long serialVersionUID = 1L; private LongFilter id; @@ -65,7 +73,8 @@ public class TestResultCriteria implements Serializable, Criteria { private Boolean distinct; - public TestResultCriteria() {} + public TestResultCriteria() { + } public TestResultCriteria(TestResultCriteria other) { this.id = other.id == null ? null : other.id.copy(); @@ -86,10 +95,6 @@ public TestResultCriteria copy() { return new TestResultCriteria(this); } - public LongFilter getId() { - return id; - } - public LongFilter id() { if (id == null) { id = new LongFilter(); @@ -97,14 +102,6 @@ public LongFilter id() { return id; } - public void setId(LongFilter id) { - this.id = id; - } - - public IntegerFilter getStatus() { - return status; - } - public IntegerFilter status() { if (status == null) { status = new IntegerFilter(); @@ -112,14 +109,6 @@ public IntegerFilter status() { return status; } - public void setStatus(IntegerFilter status) { - this.status = status; - } - - public StringFilter getTestName() { - return testName; - } - public StringFilter testName() { if (testName == null) { testName = new StringFilter(); @@ -127,14 +116,6 @@ public StringFilter testName() { return testName; } - public void setTestName(StringFilter testName) { - this.testName = testName; - } - - public StringFilter getClassName() { - return className; - } - public StringFilter className() { if (className == null) { className = new StringFilter(); @@ -142,14 +123,6 @@ public StringFilter className() { return className; } - public void setClassName(StringFilter className) { - this.className = className; - } - - public StringFilter getErrorMessage() { - return errorMessage; - } - public StringFilter errorMessage() { if (errorMessage == null) { errorMessage = new StringFilter(); @@ -157,14 +130,6 @@ public StringFilter errorMessage() { return errorMessage; } - public void setErrorMessage(StringFilter errorMessage) { - this.errorMessage = errorMessage; - } - - public StringFilter getFailureStack() { - return failureStack; - } - public StringFilter failureStack() { if (failureStack == null) { failureStack = new StringFilter(); @@ -172,14 +137,6 @@ public StringFilter failureStack() { return failureStack; } - public void setFailureStack(StringFilter failureStack) { - this.failureStack = failureStack; - } - - public StringFilter getFailureType() { - return failureType; - } - public StringFilter failureType() { if (failureType == null) { failureType = new StringFilter(); @@ -187,14 +144,6 @@ public StringFilter failureType() { return failureType; } - public void setFailureType(StringFilter failureType) { - this.failureType = failureType; - } - - public InstantFilter getCreatedDate() { - return createdDate; - } - public InstantFilter createdDate() { if (createdDate == null) { createdDate = new InstantFilter(); @@ -202,14 +151,6 @@ public InstantFilter createdDate() { return createdDate; } - public void setCreatedDate(InstantFilter createdDate) { - this.createdDate = createdDate; - } - - public InstantFilter getLastModifiedDate() { - return lastModifiedDate; - } - public InstantFilter lastModifiedDate() { if (lastModifiedDate == null) { lastModifiedDate = new InstantFilter(); @@ -217,14 +158,6 @@ public InstantFilter lastModifiedDate() { return lastModifiedDate; } - public void setLastModifiedDate(InstantFilter lastModifiedDate) { - this.lastModifiedDate = lastModifiedDate; - } - - public StringFilter getTestParameterKey() { - return testParameterKey; - } - public StringFilter testParameterId() { if (testParameterKey == null) { testParameterKey = new StringFilter(); @@ -232,74 +165,41 @@ public StringFilter testParameterId() { return testParameterKey; } - public void setTestParameterKey(StringFilter testParameterKey) { - this.testParameterKey = testParameterKey; - } - - public Boolean getDistinct() { - return distinct; - } - - public void setDistinct(Boolean distinct) { - this.distinct = distinct; - } - @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { + if (!(o instanceof TestResultCriteria testResultCriteria)) { return false; } - final TestResultCriteria that = (TestResultCriteria) o; - return ( - Objects.equals(id, that.id) && - Objects.equals(status, that.status) && - Objects.equals(testName, that.testName) && - Objects.equals(className, that.className) && - Objects.equals(errorMessage, that.errorMessage) && - Objects.equals(failureStack, that.failureStack) && - Objects.equals(failureType, that.failureType) && - Objects.equals(createdDate, that.createdDate) && - Objects.equals(lastModifiedDate, that.lastModifiedDate) && - Objects.equals(testParameterKey, that.testParameterKey) && - Objects.equals(distinct, that.distinct) - ); - } - @Override - public int hashCode() { - return Objects.hash( - id, - status, - testName, - className, - errorMessage, - failureStack, - failureType, - createdDate, - lastModifiedDate, - testParameterKey, - distinct - ); + return new EqualsBuilder() + .append(id, testResultCriteria.id) + .append(status, testResultCriteria.status) + .append(testName, testResultCriteria.testName) + .append(className, testResultCriteria.className) + .append(errorMessage, testResultCriteria.errorMessage) + .append(failureStack, testResultCriteria.failureStack) + .append(failureType, testResultCriteria.failureType) + .append(createdDate, testResultCriteria.createdDate) + .append(lastModifiedDate, testResultCriteria.lastModifiedDate) + .append(testParameterKey, testResultCriteria.testParameterKey) + .append(distinct, testResultCriteria.distinct) + .isEquals(); } - // prettier-ignore @Override - public String toString() { - return "TestResultCriteria{" + - (id != null ? "id=" + id + ", " : "") + - (status != null ? "status=" + status + ", " : "") + - (testName != null ? "testName=" + testName + ", " : "") + - (className != null ? "className=" + className + ", " : "") + - (errorMessage != null ? "errorMessage=" + errorMessage + ", " : "") + - (failureStack != null ? "failureStack=" + failureStack + ", " : "") + - (failureType != null ? "failureType=" + failureType + ", " : "") + - (createdDate != null ? "createdDate=" + createdDate + ", " : "") + - (lastModifiedDate != null ? "lastModifiedDate=" + lastModifiedDate + ", " : "") + - (testParameterKey != null ? "testParameterId=" + testParameterKey + ", " : "") + - (distinct != null ? "distinct=" + distinct + ", " : "") + - "}"; + public int hashCode() { + return new HashCodeBuilder() + .append(id) + .append(status) + .append(testName) + .append(className) + .append(errorMessage) + .append(failureStack) + .append(failureType) + .append(createdDate) + .append(lastModifiedDate) + .append(testParameterKey) + .append(distinct) + .toHashCode(); } }