Skip to content

Commit

Permalink
EPMRPP-93396 || Add converters to all instant fields
Browse files Browse the repository at this point in the history
  • Loading branch information
pbortnik committed Aug 19, 2024
1 parent bc289e7 commit a2bd445
Show file tree
Hide file tree
Showing 18 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@

package com.epam.ta.reportportal.entity.activity;

import com.epam.ta.reportportal.dao.converters.JpaInstantConverter;
import java.io.Serializable;
import java.time.Instant;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
Expand Down Expand Up @@ -53,6 +55,7 @@ public class Activity implements Serializable {
private Long id;

@Column(name = "created_at", nullable = false)
@Convert(converter = JpaInstantConverter.class)
private Instant createdAt;

@Column(name = "action", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@

package com.epam.ta.reportportal.entity.analytics;

import com.epam.ta.reportportal.dao.converters.JpaInstantConverter;
import com.epam.ta.reportportal.entity.Metadata;
import java.io.Serializable;
import java.time.Instant;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
Expand Down Expand Up @@ -61,6 +63,7 @@ public class AnalyticsData implements Serializable {

@Column(name = "created_at", nullable = false)
@CreatedDate
@Convert(converter = JpaInstantConverter.class)
private Instant createdAt;

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@

package com.epam.ta.reportportal.entity.attachment;

import com.epam.ta.reportportal.dao.converters.JpaInstantConverter;
import java.io.Serializable;
import java.time.Instant;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
Expand Down Expand Up @@ -53,6 +55,7 @@ public class Attachment implements Serializable {
private long fileSize;

@Column(name = "creation_date")
@Convert(converter = JpaInstantConverter.class)
private Instant creationDate;

@Column(name = "project_id")
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/epam/ta/reportportal/entity/bts/Ticket.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@

package com.epam.ta.reportportal.entity.bts;

import com.epam.ta.reportportal.dao.converters.JpaInstantConverter;
import com.epam.ta.reportportal.entity.item.issue.IssueEntity;
import com.google.common.collect.Sets;
import java.io.Serializable;
import java.time.Instant;
import java.util.Objects;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
Expand Down Expand Up @@ -50,6 +52,7 @@ public class Ticket implements Serializable {
private String submitter;

@Column(name = "submit_date")
@Convert(converter = JpaInstantConverter.class)
private Instant submitDate;

@Column(name = "bts_url")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@

package com.epam.ta.reportportal.entity.dashboard;

import com.epam.ta.reportportal.dao.converters.JpaInstantConverter;
import com.epam.ta.reportportal.entity.OwnedEntity;
import com.google.common.collect.Sets;
import java.io.Serializable;
import java.time.Instant;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
Expand All @@ -46,6 +48,7 @@ public class Dashboard extends OwnedEntity implements Serializable {

@CreatedDate
@Column(name = "creation_date")
@Convert(converter = JpaInstantConverter.class)
private Instant creationDate;

@OneToMany(fetch = FetchType.EAGER, mappedBy = "dashboard")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@

package com.epam.ta.reportportal.entity.integration;

import com.epam.ta.reportportal.dao.converters.JpaInstantConverter;
import com.epam.ta.reportportal.entity.project.Project;
import java.io.Serializable;
import java.time.Instant;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
Expand Down Expand Up @@ -73,6 +75,7 @@ public class Integration implements Serializable {

@CreatedDate
@Column(name = "creation_date")
@Convert(converter = JpaInstantConverter.class)
private Instant creationDate;

public Integration(Long id, Project project, IntegrationType type, IntegrationParams params,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.epam.ta.reportportal.entity.integration;

import com.epam.ta.reportportal.dao.converters.JpaInstantConverter;
import com.epam.ta.reportportal.entity.enums.IntegrationAuthFlowEnum;
import com.epam.ta.reportportal.entity.enums.IntegrationGroupEnum;
import com.epam.ta.reportportal.entity.enums.PostgreSQLEnumType;
Expand All @@ -24,6 +25,7 @@
import java.time.Instant;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
Expand Down Expand Up @@ -61,6 +63,7 @@ public class IntegrationType implements Serializable {

@CreatedDate
@Column(name = "creation_date", nullable = false)
@Convert(converter = JpaInstantConverter.class)
private Instant creationDate;

@Enumerated(EnumType.STRING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.epam.ta.reportportal.entity.item;

import com.epam.ta.reportportal.dao.converters.JpaInstantConverter;
import com.epam.ta.reportportal.entity.ItemAttribute;
import com.epam.ta.reportportal.entity.enums.PostgreSQLEnumType;
import com.epam.ta.reportportal.entity.enums.TestItemTypeEnum;
Expand All @@ -29,6 +30,7 @@
import javax.persistence.CascadeType;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
Expand Down Expand Up @@ -79,6 +81,7 @@ public class TestItem implements Serializable {
private TestItemTypeEnum type;

@Column(name = "start_time", nullable = false)
@Convert(converter = JpaInstantConverter.class)
private Instant startTime;

@Column(name = "description")
Expand All @@ -89,6 +92,7 @@ public class TestItem implements Serializable {

@LastModifiedDate
@Column(name = "last_modified", nullable = false)
@Convert(converter = JpaInstantConverter.class)
private Instant lastModified;

@ElementCollection(fetch = FetchType.EAGER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.epam.ta.reportportal.entity.item;

import com.epam.ta.reportportal.dao.converters.JpaInstantConverter;
import com.epam.ta.reportportal.entity.enums.PostgreSQLEnumType;
import com.epam.ta.reportportal.entity.enums.StatusEnum;
import com.epam.ta.reportportal.entity.item.issue.IssueEntity;
Expand All @@ -27,6 +28,7 @@
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
Expand Down Expand Up @@ -60,6 +62,7 @@ public class TestItemResults implements Serializable {
private StatusEnum status;

@Column(name = "end_time")
@Convert(converter = JpaInstantConverter.class)
private Instant endTime;

@Column(name = "duration")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public class Launch implements Serializable {
private Instant startTime;

@Column(name = "end_time")
@Convert(converter = JpaInstantConverter.class)
private Instant endTime;

@Column(name = "number", nullable = false, precision = 32)
Expand All @@ -103,6 +104,7 @@ public class Launch implements Serializable {

@Column(name = "last_modified", nullable = false)
@LastModifiedDate
@Convert(converter = JpaInstantConverter.class)
private Instant lastModified;

@Column(name = "mode", nullable = false)
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/epam/ta/reportportal/entity/log/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.epam.ta.reportportal.entity.log;

import com.epam.ta.reportportal.dao.converters.JpaInstantConverter;
import com.epam.ta.reportportal.entity.attachment.Attachment;
import com.epam.ta.reportportal.entity.item.TestItem;
import com.epam.ta.reportportal.entity.launch.Launch;
Expand All @@ -24,6 +25,7 @@
import java.util.Objects;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
Expand Down Expand Up @@ -56,13 +58,15 @@ public class Log implements Serializable {
private String uuid;

@Column(name = "log_time", nullable = false)
@Convert(converter = JpaInstantConverter.class)
private Instant logTime;

@Column(name = "log_message", nullable = false)
private String logMessage;

@LastModifiedDate
@Column(name = "last_modified", nullable = false)
@Convert(converter = JpaInstantConverter.class)
private Instant lastModified;

@Column(name = "log_level", nullable = false, precision = 32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.epam.ta.reportportal.entity.project;

import com.epam.ta.reportportal.dao.converters.JpaInstantConverter;
import com.epam.ta.reportportal.entity.Metadata;
import com.epam.ta.reportportal.entity.enums.ProjectType;
import com.epam.ta.reportportal.entity.integration.Integration;
Expand All @@ -29,6 +30,7 @@
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
Expand Down Expand Up @@ -87,6 +89,7 @@ public class Project implements Serializable {
private Set<SenderCase> senderCases = Sets.newHashSet();

@Column(name = "creation_date")
@Convert(converter = JpaInstantConverter.class)
private Instant creationDate;

@Type(type = "json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@

package com.epam.ta.reportportal.entity.user;

import com.epam.ta.reportportal.dao.converters.JpaInstantConverter;
import java.time.Instant;
import java.time.LocalDate;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
Expand Down Expand Up @@ -46,6 +48,7 @@ public class ApiKey {
private String hash;

@Column(name = "created_at")
@Convert(converter = JpaInstantConverter.class)
private Instant createdAt;

@Column(name = "user_id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@

package com.epam.ta.reportportal.entity.user;

import com.epam.ta.reportportal.dao.converters.JpaInstantConverter;
import com.epam.ta.reportportal.entity.Modifiable;
import java.io.Serializable;
import java.time.Instant;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
Expand All @@ -43,6 +45,7 @@ public class RestorePasswordBid implements Serializable, Modifiable {

@LastModifiedDate
@Column(name = LAST_MODIFIED)
@Convert(converter = JpaInstantConverter.class)
private Instant lastModifiedDate;

@Column(name = "email")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@

package com.epam.ta.reportportal.entity.user;

import com.epam.ta.reportportal.dao.converters.JpaInstantConverter;
import com.epam.ta.reportportal.entity.Metadata;
import com.epam.ta.reportportal.entity.Modifiable;
import java.io.Serializable;
import java.time.Instant;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Id;
Expand All @@ -48,6 +50,7 @@ public class UserCreationBid implements Serializable, Modifiable {

@LastModifiedDate
@Column(name = LAST_MODIFIED)
@Convert(converter = JpaInstantConverter.class)
private Instant lastModified;

@Column(name = "email")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@

import static com.epam.ta.reportportal.dao.constant.WidgetContentRepositoryConstants.ID;

import com.epam.ta.reportportal.dao.converters.JpaInstantConverter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.time.Instant;
import javax.persistence.Column;
import javax.persistence.Convert;

/**
* @author Ivan Budayeu
Expand All @@ -44,6 +46,7 @@ public abstract class AbstractLaunchStatisticsContent implements Serializable {

@Column(name = "start_time")
@JsonProperty(value = "startTime")
@Convert(converter = JpaInstantConverter.class)
private Instant startTime;

public AbstractLaunchStatisticsContent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
import static com.epam.ta.reportportal.dao.constant.WidgetContentRepositoryConstants.DURATION;
import static com.epam.ta.reportportal.dao.constant.WidgetContentRepositoryConstants.END_TIME;

import com.epam.ta.reportportal.dao.converters.JpaInstantConverter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.Instant;
import javax.persistence.Column;
import javax.persistence.Convert;

/**
* @author Ivan Budayeu
Expand All @@ -34,6 +36,7 @@ public class LaunchesDurationContent extends AbstractLaunchStatisticsContent {

@Column(name = "end_time")
@JsonProperty(value = END_TIME)
@Convert(converter = JpaInstantConverter.class)
private Instant endTime;

@Column(name = "duration")
Expand Down
Loading

0 comments on commit a2bd445

Please sign in to comment.