aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-requests-db/src/main/java
diff options
context:
space:
mode:
authorxg353y <xg353y@intl.att.com>2017-04-11 13:30:42 +0200
committerxg353y <xg353y@intl.att.com>2017-04-11 15:34:19 +0200
commitb6b7bef8bdcad15af01ac88a038dd763ce59f68f (patch)
tree399d39da23aaa37701e487df064e3e0c27709ef3 /mso-api-handlers/mso-requests-db/src/main/java
parent19340cad94eeaa1b580f7c0c99531de499e8ca14 (diff)
[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>
Diffstat (limited to 'mso-api-handlers/mso-requests-db/src/main/java')
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtil.java59
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtilsRequestsDb.java47
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraRequests.java30
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java32
4 files changed, 84 insertions, 84 deletions
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 21bece9b10..0000000000
--- 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 0000000000..09548116c5
--- /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 43128192d9..54574c85b5 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 @@ public class InfraRequests implements java.io.Serializable {
private String networkId;
private String networkName;
private String networkType;
-
+ private String requestorId;
public InfraRequests() {
}
@@ -273,7 +273,7 @@ public class InfraRequests implements java.io.Serializable {
public void setRequestType(String requestType) {
this.requestType = requestType;
}
-
+
public String getVolumeGroupId() {
return this.volumeGroupId;
}
@@ -281,7 +281,7 @@ public class InfraRequests implements java.io.Serializable {
public void setVolumeGroupId(String volumeGroupId) {
this.volumeGroupId = volumeGroupId;
}
-
+
public String getVolumeGroupName() {
return this.volumeGroupName;
}
@@ -289,7 +289,7 @@ public class InfraRequests implements java.io.Serializable {
public void setVolumeGroupName(String volumeGroupName) {
this.volumeGroupName = volumeGroupName;
}
-
+
public String getVfModuleId() {
return this.vfModuleId;
}
@@ -297,7 +297,7 @@ public class InfraRequests implements java.io.Serializable {
public void setVfModuleId(String vfModuleId) {
this.vfModuleId = vfModuleId;
}
-
+
public String getVfModuleName() {
return this.vfModuleName;
}
@@ -305,7 +305,7 @@ public class InfraRequests implements java.io.Serializable {
public void setVfModuleName(String vfModuleName) {
this.vfModuleName = vfModuleName;
}
-
+
public String getVfModuleModelName() {
return this.vfModuleModelName;
}
@@ -313,7 +313,7 @@ public class InfraRequests implements java.io.Serializable {
public void setVfModuleModelName(String vfModuleModelName) {
this.vfModuleModelName = vfModuleModelName;
}
-
+
public String getAaiServiceId() {
return this.aaiServiceId;
}
@@ -369,7 +369,7 @@ public class InfraRequests implements java.io.Serializable {
public void setRequestScope(String requestScope) {
this.requestScope = requestScope;
}
-
+
public String getRequestAction() {
return requestAction;
}
@@ -401,5 +401,13 @@ public class InfraRequests implements java.io.Serializable {
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 fda4461840..e32c456295 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.Criterion;
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 class RequestsDatabase {
}
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 class RequestsDatabase {
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 class RequestsDatabase {
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 class RequestsDatabase {
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 @@ public class RequestsDatabase {
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 @@ public class RequestsDatabase {
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 @@ public class RequestsDatabase {
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 @@ public class RequestsDatabase {
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 @@ public class RequestsDatabase {
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 @@ public class RequestsDatabase {
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 @@ public class RequestsDatabase {
* @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 @@ public class RequestsDatabase {
* @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 ();