diff --git a/src/main/java/com/epam/ta/reportportal/ws/reporting/LaunchResource.java b/src/main/java/com/epam/ta/reportportal/ws/reporting/LaunchResource.java index 95287d0..c31babf 100644 --- a/src/main/java/com/epam/ta/reportportal/ws/reporting/LaunchResource.java +++ b/src/main/java/com/epam/ta/reportportal/ws/reporting/LaunchResource.java @@ -16,24 +16,23 @@ package com.epam.ta.reportportal.ws.reporting; -import com.epam.ta.reportportal.ws.reporting.databind.OffsetDateTimeInstantSerializer; import com.epam.ta.reportportal.ws.reporting.databind.MultiFormatDateDeserializer; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import java.time.Instant; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Set; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + import javax.validation.Valid; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; +import java.time.Instant; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Set; /** * JSON Representation of Report Portal's Launch domain object @@ -70,17 +69,14 @@ public class LaunchResource extends OwnedResource { @NotNull @JsonProperty(value = "startTime", required = true) @JsonDeserialize(using = MultiFormatDateDeserializer.class) - @JsonSerialize(using = OffsetDateTimeInstantSerializer.class) private Instant startTime; @JsonProperty(value = "endTime") @JsonDeserialize(using = MultiFormatDateDeserializer.class) - @JsonSerialize(using = OffsetDateTimeInstantSerializer.class) private Instant endTime; @JsonProperty(value = "lastModified") @JsonDeserialize(using = MultiFormatDateDeserializer.class) - @JsonSerialize(using = OffsetDateTimeInstantSerializer.class) private Instant lastModified; @NotNull diff --git a/src/main/java/com/epam/ta/reportportal/ws/reporting/LaunchResourceOld.java b/src/main/java/com/epam/ta/reportportal/ws/reporting/LaunchResourceOld.java new file mode 100644 index 0000000..3e6bb95 --- /dev/null +++ b/src/main/java/com/epam/ta/reportportal/ws/reporting/LaunchResourceOld.java @@ -0,0 +1,57 @@ +/* + * Copyright 2024 EPAM Systems + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.epam.ta.reportportal.ws.reporting; + +import com.epam.ta.reportportal.ws.reporting.databind.MultiFormatDateDeserializer; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonFormat.Shape; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Getter; +import lombok.Setter; + +import java.time.Instant; + +import static com.fasterxml.jackson.annotation.JsonFormat.Feature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS; + +/** + * Serializes dates as long timestamp + * + * @author Pavel Bortnik + */ +@Getter +@Setter +@JsonInclude(Include.NON_NULL) +public class LaunchResourceOld extends LaunchResource { + + @JsonProperty(value = "startTime", required = true) + @JsonDeserialize(using = MultiFormatDateDeserializer.class) + @JsonFormat(shape = Shape.NUMBER, without = WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, timezone = "UTC") + private Instant startTime; + + @JsonProperty(value = "endTime") + @JsonDeserialize(using = MultiFormatDateDeserializer.class) + @JsonFormat(shape = Shape.NUMBER, without = WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, timezone = "UTC") + private Instant endTime; + + @JsonProperty(value = "lastModified") + @JsonDeserialize(using = MultiFormatDateDeserializer.class) + @JsonFormat(shape = Shape.NUMBER, without = WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, timezone = "UTC") + private Instant lastModified; +} + diff --git a/src/main/java/com/epam/ta/reportportal/ws/reporting/TestItemResource.java b/src/main/java/com/epam/ta/reportportal/ws/reporting/TestItemResource.java index 0736649..a15f657 100644 --- a/src/main/java/com/epam/ta/reportportal/ws/reporting/TestItemResource.java +++ b/src/main/java/com/epam/ta/reportportal/ws/reporting/TestItemResource.java @@ -16,20 +16,19 @@ package com.epam.ta.reportportal.ws.reporting; -import com.epam.ta.reportportal.ws.reporting.databind.OffsetDateTimeInstantSerializer; import com.epam.ta.reportportal.ws.reporting.databind.MultiFormatDateDeserializer; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import java.time.Instant; -import java.util.List; -import java.util.Set; import lombok.Getter; import lombok.Setter; import lombok.ToString; +import java.time.Instant; +import java.util.List; +import java.util.Set; + /** * JSON Representation of Report Portal domain object * @@ -67,12 +66,10 @@ public class TestItemResource { @JsonProperty(value = "startTime") @JsonDeserialize(using = MultiFormatDateDeserializer.class) - @JsonSerialize(using = OffsetDateTimeInstantSerializer.class) private Instant startTime; @JsonProperty(value = "endTime") @JsonDeserialize(using = MultiFormatDateDeserializer.class) - @JsonSerialize(using = OffsetDateTimeInstantSerializer.class) private Instant endTime; @JsonProperty(value = "status") diff --git a/src/main/java/com/epam/ta/reportportal/ws/reporting/TestItemResourceOld.java b/src/main/java/com/epam/ta/reportportal/ws/reporting/TestItemResourceOld.java new file mode 100644 index 0000000..cda7bc0 --- /dev/null +++ b/src/main/java/com/epam/ta/reportportal/ws/reporting/TestItemResourceOld.java @@ -0,0 +1,50 @@ +/* + * Copyright 2024 EPAM Systems + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.epam.ta.reportportal.ws.reporting; + +import com.epam.ta.reportportal.ws.reporting.databind.MultiFormatDateDeserializer; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Getter; +import lombok.Setter; + +import java.time.Instant; + +import static com.fasterxml.jackson.annotation.JsonFormat.Feature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS; + +/** + * Serializes dates as long timestamp + * + * @author Pavel Bortnik + */ +@Getter +@Setter +@JsonInclude(JsonInclude.Include.NON_NULL) +public class TestItemResourceOld extends TestItemResource { + + @JsonProperty(value = "startTime") + @JsonDeserialize(using = MultiFormatDateDeserializer.class) + @JsonFormat(shape = JsonFormat.Shape.NUMBER, without = WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, timezone = "UTC") + private Instant startTime; + + @JsonProperty(value = "endTime") + @JsonDeserialize(using = MultiFormatDateDeserializer.class) + @JsonFormat(shape = JsonFormat.Shape.NUMBER, without = WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, timezone = "UTC") + private Instant endTime; + +}