[MSO-8] Update the maven dependency
Update the maven depenency for sdc-distribution-client to cooperate with the sdc changes.
Change-Id: I2da936e5c40cb68c7181bb78307192dd5655b5dc
Signed-off-by: xg353y <xg353y@intl.att.com>
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtil.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtil.java
deleted file mode 100644
index 21bece9..0000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtil.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * OPENECOMP - MSO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.requestsdb;
-
-
-import org.hibernate.SessionFactory;
-import org.hibernate.cfg.Configuration;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-@SuppressWarnings("deprecation")
-public class HibernateUtil {
-
- //private static SessionFactory SESSION_FACTORY;
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
-
- private static SessionFactory SESSION_FACTORY;
-
-
- static {
- try {
-
- if ("MYSQL".equals (System.getProperty ("mso.db")) || "MARIADB".equals(System.getProperty("mso.db"))) {
- SESSION_FACTORY = new Configuration ().configure ("hibernate-mysql.cfg.xml").buildSessionFactory ();
- } else {
- LOGGER.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC", "", "", MsoLogger.ErrorCode.DataError , "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC");
- }
- } catch (Exception ex) {
- LOGGER.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, ex.getMessage (), "", "", MsoLogger.ErrorCode.DataError , "Problem in getting DB connection type", ex);
- throw ex;
- }
- }
-
- public static SessionFactory getSessionFactory () {
- return SESSION_FACTORY;
- }
-
- private HibernateUtil () {
- // Avoid creation of an instance
- }
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtilsRequestsDb.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtilsRequestsDb.java
new file mode 100644
index 0000000..0954811
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtilsRequestsDb.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.requestsdb;
+
+import org.openecomp.mso.db.HibernateUtils;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+import java.net.URL;
+
+public class HibernateUtilsRequestsDb extends HibernateUtils {
+
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+
+ @Override
+ protected URL getHibernateConfigFile() {
+ try {
+
+ if ("MYSQL".equals (System.getProperty ("mso.db")) || "MARIADB".equals(System.getProperty("mso.db"))) {
+ return this.getClass().getClassLoader().getResource("hibernate-requests-core-mysql.cfg.xml");
+ } else {
+ LOGGER.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC", "", "", MsoLogger.ErrorCode.DataError , "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC");
+ return null;
+ }
+ } catch (Exception ex) {
+ LOGGER.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, ex.getMessage (), "", "", MsoLogger.ErrorCode.DataError , "Problem in getting DB connection type", ex);
+ return null;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraRequests.java
index 4312819..54574c8 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraRequests.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -77,7 +77,7 @@
private String networkId;
private String networkName;
private String networkType;
-
+ private String requestorId;
public InfraRequests() {
}
@@ -273,7 +273,7 @@
public void setRequestType(String requestType) {
this.requestType = requestType;
}
-
+
public String getVolumeGroupId() {
return this.volumeGroupId;
}
@@ -281,7 +281,7 @@
public void setVolumeGroupId(String volumeGroupId) {
this.volumeGroupId = volumeGroupId;
}
-
+
public String getVolumeGroupName() {
return this.volumeGroupName;
}
@@ -289,7 +289,7 @@
public void setVolumeGroupName(String volumeGroupName) {
this.volumeGroupName = volumeGroupName;
}
-
+
public String getVfModuleId() {
return this.vfModuleId;
}
@@ -297,7 +297,7 @@
public void setVfModuleId(String vfModuleId) {
this.vfModuleId = vfModuleId;
}
-
+
public String getVfModuleName() {
return this.vfModuleName;
}
@@ -305,7 +305,7 @@
public void setVfModuleName(String vfModuleName) {
this.vfModuleName = vfModuleName;
}
-
+
public String getVfModuleModelName() {
return this.vfModuleModelName;
}
@@ -313,7 +313,7 @@
public void setVfModuleModelName(String vfModuleModelName) {
this.vfModuleModelName = vfModuleModelName;
}
-
+
public String getAaiServiceId() {
return this.aaiServiceId;
}
@@ -369,7 +369,7 @@
public void setRequestScope(String requestScope) {
this.requestScope = requestScope;
}
-
+
public String getRequestAction() {
return requestAction;
}
@@ -401,5 +401,13 @@
public void setNetworkType(String networkType) {
this.networkType = networkType;
}
-
+
+ public String getRequestorId() {
+ return requestorId;
+ }
+
+ public void setRequestorId(String requestorId) {
+ this.requestorId = requestorId;
+ }
+
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
index fda4461..e32c456 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
@@ -35,13 +35,17 @@
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.hibernate.persister.entity.AbstractEntityPersister;
-
+import org.openecomp.mso.db.HibernateUtils;
+import org.openecomp.mso.requestsdb.HibernateUtilsRequestsDb;
import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.logger.MessageEnum;
public class RequestsDatabase {
+ protected static HibernateUtils hibernateUtils = new HibernateUtilsRequestsDb ();
+
protected static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
-
+
protected static final String SOURCE = "source";
protected static final String START_TIME = "startTime";
protected static final String REQUEST_TYPE = "requestType";
@@ -70,7 +74,7 @@
}
public static boolean healthCheck () {
- Session session = HibernateUtil.getSessionFactory ().openSession ();
+ Session session = hibernateUtils.getSessionFactory ().openSession ();
try {
Query query = session.createSQLQuery (" show tables ");
@@ -88,7 +92,7 @@
public static int updateInfraStatus (String requestId, String requestStatus, String lastModifiedBy) {
long startTime = System.currentTimeMillis ();
msoLogger.debug ("Update infra request record " + requestId + " with status " + requestStatus);
- Session session = HibernateUtil.getSessionFactory ().openSession ();
+ Session session = hibernateUtils.getSessionFactory ().openSession ();
int result = 0;
try {
@@ -113,7 +117,7 @@
public static int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
long startTime = System.currentTimeMillis ();
msoLogger.debug ("Update infra request record " + requestId + " with status " + requestStatus);
- Session session = HibernateUtil.getSessionFactory ().openSession ();
+ Session session = hibernateUtils.getSessionFactory ().openSession ();
int result = 0;
try {
@@ -139,7 +143,7 @@
public static int updateInfraFinalStatus (String requestId, String requestStatus, String statusMessage, long progress, String responseBody, String lastModifiedBy) {
long startTime = System.currentTimeMillis ();
msoLogger.debug ("Update infra request record " + requestId + " with status " + requestStatus);
- Session session = HibernateUtil.getSessionFactory ().openSession ();
+ Session session = hibernateUtils.getSessionFactory ().openSession ();
int result = 0;
try {
@@ -172,7 +176,7 @@
List <InfraActiveRequests> results = new ArrayList<InfraActiveRequests>();
- Session session = HibernateUtil.getSessionFactory ().openSession ();
+ Session session = hibernateUtils.getSessionFactory ().openSession ();
try {
session.beginTransaction ();
Criteria crit = session.createCriteria (InfraActiveRequests.class);
@@ -197,7 +201,7 @@
long startTime = System.currentTimeMillis ();
msoLogger.debug ("Get request " + requestId + " from InfraActiveRequests DB");
- Session session = HibernateUtil.getSessionFactory ().openSession ();
+ Session session = hibernateUtils.getSessionFactory ().openSession ();
InfraActiveRequests ar = null;
try {
session.beginTransaction ();
@@ -314,7 +318,7 @@
long startTime = System.currentTimeMillis ();
msoLogger.debug ("Get list of infra requests from DB with " + queryAttributeName + " = " + queryValue);
- Session session = HibernateUtil.getSessionFactory ().openSession ();
+ Session session = hibernateUtils.getSessionFactory ().openSession ();
try {
session.beginTransaction ();
Criteria crit = session.createCriteria (InfraActiveRequests.class)
@@ -342,7 +346,7 @@
long startTime = System.currentTimeMillis ();
msoLogger.debug ("Get infra request from DB with id " + requestId);
- Session session = HibernateUtil.getSessionFactory ().openSession ();
+ Session session = hibernateUtils.getSessionFactory ().openSession ();
InfraActiveRequests ar = null;
try {
session.beginTransaction ();
@@ -366,7 +370,7 @@
msoLogger.debug ("Get infra request from DB for VNF " + vnfName + " and action " + action + " and requestType " + requestType);
InfraActiveRequests ar = null;
- Session session = HibernateUtil.getSessionFactory ().openSession ();
+ Session session = hibernateUtils.getSessionFactory ().openSession ();
try {
session.beginTransaction ();
@@ -395,7 +399,7 @@
msoLogger.debug ("Get list of infra requests from DB for VNF " + vnfId + " and action " + action);
InfraActiveRequests ar = null;
- Session session = HibernateUtil.getSessionFactory ().openSession ();
+ Session session = hibernateUtils.getSessionFactory ().openSession ();
try {
session.beginTransaction ();
@@ -429,7 +433,7 @@
* @return SiteStatus object or null if none found
*/
public static SiteStatus getSiteStatus (String siteName) {
- Session session = HibernateUtil.getSessionFactory ().openSession ();
+ Session session = hibernateUtils.getSessionFactory ().openSession ();
long startTime = System.currentTimeMillis ();
SiteStatus siteStatus = null;
@@ -456,7 +460,7 @@
* @param status The updated status of the Site
*/
public static void updateSiteStatus (String siteName, boolean status) {
- Session session = HibernateUtil.getSessionFactory ().openSession ();
+ Session session = hibernateUtils.getSessionFactory ().openSession ();
session.beginTransaction ();
long startTime = System.currentTimeMillis ();
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml
index b98177a..ee12b45 100644
--- a/mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml
+++ b/mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml
@@ -8,9 +8,9 @@
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -142,5 +142,8 @@
<property name="networkType" type="string">
<column name="NETWORK_TYPE" length="80"/>
</property>
+ <property name="requestorId" type="string">
+ <column name="REQUESTOR_ID" length="80"/>
+ </property>
</class>
</hibernate-mapping>
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/hibernate-mysql.cfg.xml b/mso-api-handlers/mso-requests-db/src/main/resources/hibernate-requests-core-mysql.cfg.xml
similarity index 100%
rename from mso-api-handlers/mso-requests-db/src/main/resources/hibernate-mysql.cfg.xml
rename to mso-api-handlers/mso-requests-db/src/main/resources/hibernate-requests-core-mysql.cfg.xml