X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Futil%2FJPAUtils.java;h=05885ee16f4e3b69ddaabd0400d77d85699f5ab1;hb=7925630b5edc79119f29392edc6ddc84cf7c3757;hp=732ed2f44236b18532553d4da2af8f4f36995170;hpb=c53fa990ea27ec074859eb94bcb7ec6deaa2157b;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/JPAUtils.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/JPAUtils.java index 732ed2f44..05885ee16 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/JPAUtils.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/JPAUtils.java @@ -45,7 +45,7 @@ import org.onap.policy.common.logging.flexlogger.Logger; public class JPAUtils { private static Logger LOGGER = FlexLogger.getLogger(JPAUtils.class); - private EntityManagerFactory emf; + private static EntityManagerFactory emf; private static final Object mapAccess = new Object(); private static Map> mapDatatype2Function = null; private static Map mapID2Function = null; @@ -59,7 +59,7 @@ public class JPAUtils { * @return The new instance of JPAUtils or throw exception if the given emf is null. * @throws IllegalStateException if a JPAUtils has already been constructed. Call getJPAUtilsInstance() to get this. */ - public static JPAUtils getJPAUtilsInstance(EntityManagerFactory emf) throws Exception{ + public static JPAUtils getJPAUtilsInstance(EntityManagerFactory emf){ LOGGER.debug("getJPAUtilsInstance(EntityManagerFactory emf) as getJPAUtilsInstance("+emf+") called"); if(currentInstance == null){ if(emf != null){ @@ -81,7 +81,7 @@ public class JPAUtils { * @return The instance of JPAUtils or throws exception if the given instance is null. * @throws IllegalStateException if a JPAUtils instance is null. Call getJPAUtilsInstance(EntityManagerFactory emf) to get this. */ - public static JPAUtils getJPAUtilsInstance() throws Exception{ + public static JPAUtils getJPAUtilsInstance(){ LOGGER.debug("getJPAUtilsInstance() as getJPAUtilsInstance() called"); if(currentInstance != null){ return currentInstance; @@ -89,7 +89,7 @@ public class JPAUtils { throw new IllegalStateException("The JPAUtils.currentInstance is Null. Use getJPAUtilsInstance(EntityManagerFactory emf)"); } - public static AttributeDesignatorType createDesignator(Attribute attribute) { + public static AttributeDesignatorType createDesignator(Attribute attribute) { AttributeDesignatorType designator = new AttributeDesignatorType(); designator.setAttributeId(attribute.getXacmlId()); if (attribute.getCategoryBean() != null) { @@ -147,7 +147,7 @@ public class JPAUtils { public Map getFunctionIDMap() { synchronized(mapAccess) { - if (mapID2Function == null||mapID2Function.equals("{}")) { + if (mapID2Function == null||mapID2Function.isEmpty()) { try { buildFunctionMaps(); } catch (ServletException e) { @@ -158,7 +158,7 @@ public class JPAUtils { return mapID2Function; } - private void buildFunctionMaps() throws ServletException { + private static void buildFunctionMaps() throws ServletException { mapDatatype2Function = new HashMap<>(); mapID2Function = new HashMap<>();