aboutsummaryrefslogtreecommitdiffstats
path: root/feature-session-persistence/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-08-26 14:36:35 -0400
committerJim Hahn <jrh3@att.com>2021-08-26 15:12:19 -0400
commitd04af420514c9c852af77780f0bd5ee23ebb401a (patch)
tree4212f3e411714770bd4bae3ecb25634190868b13 /feature-session-persistence/src
parent9869e3a9665c0215dc9f9724fe3b5576c0479157 (diff)
Fix sonars in drools-pdp
Fixed sonars: - use "var" - override "equals" - unused imports Also changed some of the JPA queries to make them typed queries. Issue-ID: POLICY-3289 Change-Id: Ib3a00be322d8d00ba492673708439cacfe2c7fc4 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'feature-session-persistence/src')
-rw-r--r--feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/JpaDroolsSessionConnector.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/JpaDroolsSessionConnector.java b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/JpaDroolsSessionConnector.java
index 8fcbc795..14c72708 100644
--- a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/JpaDroolsSessionConnector.java
+++ b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/JpaDroolsSessionConnector.java
@@ -36,10 +36,10 @@ public class JpaDroolsSessionConnector implements DroolsSessionConnector {
@Override
public DroolsSession get(String sessName) {
- EntityManager em = emf.createEntityManager();
+ var em = emf.createEntityManager();
DroolsSessionEntity entity = null;
- try (EntityMgrTrans trans = new EntityMgrTrans(em)) {
+ try (var trans = new EntityMgrTrans(em)) {
entity = em.find(DroolsSessionEntity.class, sessName);
if (entity != null) {
@@ -58,9 +58,9 @@ public class JpaDroolsSessionConnector implements DroolsSessionConnector {
logger.info("replace: Entering and manually updating session name= {}", sessName);
- EntityManager em = emf.createEntityManager();
+ var em = emf.createEntityManager();
- try (EntityMgrTrans trans = new EntityMgrTrans(em)) {
+ try (var trans = new EntityMgrTrans(em)) {
if (!update(em, sess)) {
add(em, sess);
@@ -81,7 +81,7 @@ public class JpaDroolsSessionConnector implements DroolsSessionConnector {
private void add(EntityManager em, DroolsSession sess) {
logger.info("add: Inserting session id={}", sess.getSessionId());
- DroolsSessionEntity ent = new DroolsSessionEntity(sess.getSessionName(), sess.getSessionId());
+ var ent = new DroolsSessionEntity(sess.getSessionName(), sess.getSessionId());
em.persist(ent);
}