From 62cd6aaaf74aa91ee0037c0e155c8e7284f07567 Mon Sep 17 00:00:00 2001 From: Arthur Martella Date: Fri, 8 Sep 2017 13:27:46 -0400 Subject: 1710 Rebase - Second Attempt This commit rebases changes from openecomp-mso/internal-staging-1710 up to and including this codecloud commit: 54483fc6606ddb1591a2e9da61bff8712325f924 Wed Sep 6 18:12:56 2017 -0400 Rebasing was done on a branch on top of this commit in so/master in ONAP: 93fbdfbe46104f8859d4754040f979cb7997c157 Thu Sep 7 16:42:59 2017 +0000 Change-Id: I4ad9abf40da32bf5bdca43e868b8fa2dbcd9dc59 Issue-id: SO-107 Signed-off-by: Arthur Martella --- .../adapters/requestsdb/MsoRequestsDbAdapter.java | 3 ++- .../requestsdb/MsoRequestsDbAdapterImpl.java | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) (limited to 'adapters/mso-requests-db-adapter/src/main') diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java index 58299ea9d9..3653fd5082 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java @@ -48,7 +48,8 @@ public interface MsoRequestsDbAdapter { @WebParam(name = "vnfId") @XmlElement(required = false) String vnfId, @WebParam(name = "vfModuleId") @XmlElement(required = false) String vfModuleId, @WebParam(name = "volumeGroupId") @XmlElement(required = false) String volumeGroupId, - @WebParam(name = "serviceInstanceName") @XmlElement(required = false) String serviceInstanceName) throws MsoRequestsDbException; + @WebParam(name = "serviceInstanceName") @XmlElement(required = false) String serviceInstanceName, + @WebParam(name = "vfModuleName") @XmlElement(required = false) String vfModuleName) throws MsoRequestsDbException; @WebMethod public InfraActiveRequests getInfraRequest (@WebParam(name="requestId") @XmlElement(required = true) String requestId) throws MsoRequestsDbException; diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java index 0ff8b5ff43..f14264c7bc 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java @@ -34,14 +34,14 @@ import org.hibernate.Session; import org.openecomp.mso.adapters.requestsdb.exceptions.MsoRequestsDbException; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.db.HibernateUtils; -import org.openecomp.mso.requestsdb.HibernateUtilsRequestsDb; +import org.openecomp.mso.db.AbstractSessionFactoryManager; +import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager; import org.openecomp.mso.requestsdb.InfraActiveRequests; @WebService(serviceName = "RequestsDbAdapter", endpointInterface = "org.openecomp.mso.adapters.requestsdb.MsoRequestsDbAdapter", targetNamespace = "http://org.openecomp.mso/requestsdb") public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { - protected HibernateUtils hibernateUtils = new HibernateUtilsRequestsDb (); + protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager (); private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); @@ -58,9 +58,10 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { String vnfId, String vfModuleId, String volumeGroupId, - String serviceInstanceName) throws MsoRequestsDbException { + String serviceInstanceName, + String vfModuleName) throws MsoRequestsDbException { MsoLogger.setLogContext (requestId, null); - Session session = hibernateUtils.getSessionFactory ().openSession (); + Session session = requestsDbSessionFactoryManager.getSessionFactory ().openSession (); int result = 0; long startTime = System.currentTimeMillis (); try { @@ -99,6 +100,9 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { if (serviceInstanceName != null) { queryString += "serviceInstanceName = :serviceInstanceName, "; } + if (vfModuleName != null) { + queryString += "vfModuleName = :vfModuleName, "; + } if (requestStatus == RequestStatusType.COMPLETE || requestStatus == RequestStatusType.FAILED) { queryString += "endTime = :endTime, "; } else { @@ -155,6 +159,10 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { query.setParameter ("serviceInstanceName", serviceInstanceName); LOGGER.debug ("ServiceInstanceName in updateInfraRequest is set to: " + serviceInstanceName); } + if (vfModuleName != null) { + query.setParameter ("vfModuleName", vfModuleName); + LOGGER.debug ("vfModuleName in updateInfraRequest is set to: " + vfModuleName); + } Timestamp nowTimeStamp = new Timestamp (System.currentTimeMillis ()); if (requestStatus == RequestStatusType.COMPLETE || requestStatus == RequestStatusType.FAILED) { query.setParameter ("endTime", nowTimeStamp); @@ -195,7 +203,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { public InfraActiveRequests getInfraRequest (String requestId) throws MsoRequestsDbException { long startTime = System.currentTimeMillis (); MsoLogger.setLogContext (requestId, null); - Session session = hibernateUtils.getSessionFactory ().openSession (); + Session session = requestsDbSessionFactoryManager.getSessionFactory ().openSession (); LOGGER.debug ("Call to MSO Infra RequestsDb adapter get method with request Id: " + requestId); @@ -229,7 +237,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { */ public boolean getSiteStatus (String siteName) { UUIDChecker.generateUUID (LOGGER); - Session session = hibernateUtils.getSessionFactory ().openSession (); + Session session = requestsDbSessionFactoryManager.getSessionFactory ().openSession (); long startTime = System.currentTimeMillis (); SiteStatus siteStatus = null; -- cgit 1.2.3-korg