diff options
author | Jim Hahn <jrh3@att.com> | 2021-06-29 16:48:07 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-06-29 17:08:10 -0400 |
commit | 749ee9da67d32ca8e33169607fcd7139632b29e7 (patch) | |
tree | c8d3fc059b663e6215bec8a347fe4cbb0117e686 /integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java | |
parent | fbaec67cb146add874f2aedeb5ba624f74e62d5e (diff) |
Address sonars in common
Fixed:
- use "var"
- duplicate code block
Issue-ID: POLICY-3284
Change-Id: I8cd7f2588353a2e7702c90d37d7b9f972634dca9
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java')
-rw-r--r-- | integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java index 1754c405..a8726f0f 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java @@ -20,24 +20,17 @@ package org.onap.policy.common.im.jpa; -import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import org.onap.policy.common.im.MonitorTime; /* * The Entity class to persist a policy object ResourceRegistration */ @@ -50,7 +43,7 @@ import org.onap.policy.common.im.MonitorTime; @Getter @Setter @NoArgsConstructor -public class ResourceRegistrationEntity implements Serializable { +public class ResourceRegistrationEntity extends DateEntity { private static final long serialVersionUID = 1L; @Id @@ -71,27 +64,4 @@ public class ResourceRegistrationEntity implements Serializable { @Column(name = "nodeType", nullable = true, length = 50) private String nodeType; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "created_date", updatable = false) - private Date createdDate; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "last_updated") - private Date lastUpdated; - - /** - * PrePersist callback method. - */ - @PrePersist - public void prePersist() { - var date = MonitorTime.getInstance().getDate(); - this.createdDate = date; - this.lastUpdated = date; - } - - @PreUpdate - public void preUpdate() { - this.lastUpdated = MonitorTime.getInstance().getDate(); - } } |