diff options
author | Jim Hahn <jrh3@att.com> | 2019-06-24 08:41:18 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-06-24 12:54:43 -0400 |
commit | b52c7f21f7defaeaf86ff3921fe7bc18670ce2c1 (patch) | |
tree | 2c658433bf5a26cfd05e95feb9994f197662e94b /integrity-monitor/src/main/java/org/onap/policy/common/im/jpa | |
parent | d6aa3faba917b45e01f5001fe3a768feddedc798 (diff) |
Fix more sonar issues in Integrity Audit & Monitor
Removed duplicate code in DbDao by refactoring common code
into a new updateIae() method.
Removed duplicate code in IntegrityMonitor by refactoring common code
into a new withinTransaction() method.
Removed duplicate code in StateManagementEntity, StateElement by
replacing with lombok Getter & Setter annotations.
Removed duplicate code in StateManagement by refactoring common code
into new setState() and getState() methods. Also removed
logger.isDebugEnabled() tests.
Added coverage for StateChangeNotifier.
Change-Id: I2e29b836dafc5de569a2267206a6a34105e44021
Issue-ID: POLICY-1791
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'integrity-monitor/src/main/java/org/onap/policy/common/im/jpa')
-rw-r--r-- | integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java | 54 |
1 files changed, 9 insertions, 45 deletions
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java index 79f843e4..494931d2 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java @@ -34,6 +34,9 @@ import javax.persistence.PreUpdate; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.Setter; import org.onap.policy.common.im.MonitorTime; @Entity @@ -41,6 +44,9 @@ import org.onap.policy.common.im.MonitorTime; @NamedQuery(name = "StateManagementEntity.findAll", query = "SELECT e FROM StateManagementEntity e") // @SequenceGenerator(name="seqSM", initialValue=1, allocationSize=1) +@Getter +@Setter + public class StateManagementEntity implements Serializable { private static final long serialVersionUID = 1L; @@ -48,6 +54,8 @@ public class StateManagementEntity implements Serializable { // @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqSM") @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") + @Getter(AccessLevel.NONE) + @Setter(AccessLevel.NONE) private long id; @Column(name = "resourceName", nullable = false, length = 100, unique = true) @@ -67,6 +75,7 @@ public class StateManagementEntity implements Serializable { @Temporal(TemporalType.TIMESTAMP) @Column(name = "created_Date", updatable = false) + @Setter(AccessLevel.NONE) private Date createdDate; @Temporal(TemporalType.TIMESTAMP) @@ -88,51 +97,6 @@ public class StateManagementEntity implements Serializable { this.modifiedDate = MonitorTime.getInstance().getDate(); } - public String getResourceName() { - return this.resourceName; - } - - public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } - - public String getAdminState() { - return this.adminState; - } - - public void setAdminState(String adminState) { - this.adminState = adminState; - } - - public String getOpState() { - return this.opState; - } - - public void setOpState(String opState) { - this.opState = opState; - - } - - public String getAvailStatus() { - return this.availStatus; - } - - public void setAvailStatus(String availStatus) { - this.availStatus = availStatus; - } - - public String getStandbyStatus() { - return this.standbyStatus; - } - - public void setStandbyStatus(String standbyStatus) { - this.standbyStatus = standbyStatus; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - /** * Clone a StateManagementEntity. * |