summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-requests-db/src/main
diff options
context:
space:
mode:
authorc00149107 <chenchuanyu@huawei.com>2017-10-18 11:48:21 +0800
committerc00149107 <chenchuanyu@huawei.com>2017-10-19 14:12:16 +0800
commita13d6f4c3dd6d4c38d1f9cd97ac9fd377f580a4b (patch)
treea370ad9261b9cde7455a1cc3bf80444a58ecf5ce /mso-api-handlers/mso-requests-db/src/main
parent61354fab1e3c8783fd6a2ff5fcf7d1997fd999b5 (diff)
Deal With Error Response from Vfc
Deal With Error Response from Vfc Change-Id: Id5ce999d561099581b49524969c901ac6dac3f90 Issue-ID:SO-233 Signed-off-by: c00149107 <chenchuanyu@huawei.com>
Diffstat (limited to 'mso-api-handlers/mso-requests-db/src/main')
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationStatus.java55
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java2
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/ResourceOperationStatus.java60
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/OperationStatus.hbm.xml8
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/ResourceOperationStatus.hbm.xml8
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/hibernate-requests-core-mysql.cfg.xml2
6 files changed, 125 insertions, 10 deletions
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationStatus.java
index 010b79d38d..796a3f90fe 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationStatus.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationStatus.java
@@ -19,6 +19,7 @@
*/
package org.openecomp.mso.requestsdb;
+import java.io.Serializable;
import java.sql.Timestamp;
/**
@@ -30,8 +31,13 @@ import java.sql.Timestamp;
* @author
* @version ONAP Amsterdam Release 2017-08-28
*/
-public class OperationStatus {
+public class OperationStatus implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
private String serviceId;
private String operationId;
@@ -152,4 +158,51 @@ public class OperationStatus {
this.finishedAt = finishedAt;
}
+
+ /**
+ * <br>
+ *
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((operationId == null) ? 0 : operationId.hashCode());
+ result = prime * result + ((serviceId == null) ? 0 : serviceId.hashCode());
+ return result;
+ }
+
+
+ /**
+ * <br>
+ *
+ * @param obj
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if(this == obj)
+ return true;
+ if(obj == null)
+ return false;
+ if(getClass() != obj.getClass())
+ return false;
+ OperationStatus other = (OperationStatus)obj;
+ if(operationId == null) {
+ if(other.operationId != null)
+ return false;
+ } else if(!operationId.equals(other.operationId))
+ return false;
+ if(serviceId == null) {
+ if(other.serviceId != null)
+ return false;
+ } else if(!serviceId.equals(other.serviceId))
+ return false;
+ return true;
+ }
+
+
}
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 b426c39176..c6f0cea993 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
@@ -647,7 +647,7 @@ public class RequestsDatabase {
+ operStatus.getResourceTemplateUUID());
try {
String hql =
- "FROM ResourceOperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id and RESOURCE_TEMPLATE_UUID = : res_uuid";
+ "FROM ResourceOperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id and RESOURCE_TEMPLATE_UUID = :res_uuid";
Query query = session.createQuery(hql);
query.setParameter("service_id", operStatus.getServiceId());
query.setParameter("operation_id", operStatus.getOperationId());
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/ResourceOperationStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/ResourceOperationStatus.java
index 298eb9cf4b..2e91397d14 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/ResourceOperationStatus.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/ResourceOperationStatus.java
@@ -19,6 +19,8 @@
*/
package org.openecomp.mso.requestsdb;
+import java.io.Serializable;
+
/**
* The Resource operation status
* <br>
@@ -28,7 +30,12 @@ package org.openecomp.mso.requestsdb;
* @author
* @version ONAP Amsterdam Release 2017-08-28
*/
-public class ResourceOperationStatus {
+public class ResourceOperationStatus implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
private String serviceId;
@@ -161,6 +168,55 @@ public class ResourceOperationStatus {
public void setOperType(String operType) {
this.operType = operType;
}
-
+
+ /**
+ * <br>
+ *
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((operationId == null) ? 0 : operationId.hashCode());
+ result = prime * result + ((resourceTemplateUUID == null) ? 0 : resourceTemplateUUID.hashCode());
+ result = prime * result + ((serviceId == null) ? 0 : serviceId.hashCode());
+ return result;
+ }
+
+ /**
+ * <br>
+ *
+ * @param obj
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if(this == obj)
+ return true;
+ if(obj == null)
+ return false;
+ if(getClass() != obj.getClass())
+ return false;
+ ResourceOperationStatus other = (ResourceOperationStatus)obj;
+ if(operationId == null) {
+ if(other.operationId != null)
+ return false;
+ } else if(!operationId.equals(other.operationId))
+ return false;
+ if(resourceTemplateUUID == null) {
+ if(other.resourceTemplateUUID != null)
+ return false;
+ } else if(!resourceTemplateUUID.equals(other.resourceTemplateUUID))
+ return false;
+ if(serviceId == null) {
+ if(other.serviceId != null)
+ return false;
+ } else if(!serviceId.equals(other.serviceId))
+ return false;
+ return true;
+ }
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/OperationStatus.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/OperationStatus.hbm.xml
index f00c2da408..8d80f76649 100644
--- a/mso-api-handlers/mso-requests-db/src/main/resources/OperationStatus.hbm.xml
+++ b/mso-api-handlers/mso-requests-db/src/main/resources/OperationStatus.hbm.xml
@@ -28,8 +28,10 @@
<meta attribute="class-description">
This class describes a operation status
</meta>
- <id name="serviceId" type="string" column="SERVICE_ID"/>
- <id name="operationId" column="OPERATION_ID" type="string" length="256"/>
+ <composite-id>
+ <key-property name="serviceId" type="string" column="SERVICE_ID"/>
+ <key-property name="operationId" column="OPERATION_ID" type="string" length="256"/>
+ </composite-id>
<property name="operation" column="OPERATION_TYPE" type="string" length="256"/>
<property name="userId" column="USER_ID" type="string" length="256"/>
<property name="result" column="RESULT" type="string" length="256"/>
@@ -39,6 +41,6 @@
<property name="operateAt" type="timestamp" generated="insert" insert="false" update="false" not-null="true">
<column name="OPERATE_AT" default="CURRENT_TIMESTAMP"/>
</property>
- <property name="finishedAt" column="FINISHED_AT" type="timestamp" generated="update" insert="false" update="false"/>
+ <property name="finishedAt" column="FINISHED_AT" type="timestamp" generated="always" insert="false" update="false"/>
</class>
</hibernate-mapping>
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/ResourceOperationStatus.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/ResourceOperationStatus.hbm.xml
index 87e23980d6..22d147402d 100644
--- a/mso-api-handlers/mso-requests-db/src/main/resources/ResourceOperationStatus.hbm.xml
+++ b/mso-api-handlers/mso-requests-db/src/main/resources/ResourceOperationStatus.hbm.xml
@@ -28,9 +28,11 @@
<meta attribute="class-description">
This class describes a progress status
</meta>
- <id name="serviceId" type="string" column="SERVICE_ID"/>
- <id name="operationId" column="OPERATION_ID" type="string" length="256"/>
- <id name="resourceTemplateUUID" type="string" column="RESOURCE_TEMPLATE_UUID"/>
+ <composite-id>
+ <key-property name="serviceId" type="string" column="SERVICE_ID"/>
+ <key-property name="operationId" type="string" column="OPERATION_ID" length="256"/>
+ <key-property name="resourceTemplateUUID" type="string" column="RESOURCE_TEMPLATE_UUID"/>
+ </composite-id>
<property name="operType" column="OPER_TYPE" type="string" length="256"/>
<property name="resourceInstanceID" column="RESOURCE_INSTANCE_ID" type="string" length="256"/>
<property name="jobId" column="JOB_ID" type="string" length="256"/>
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/hibernate-requests-core-mysql.cfg.xml b/mso-api-handlers/mso-requests-db/src/main/resources/hibernate-requests-core-mysql.cfg.xml
index 531b77196c..edf8333016 100644
--- a/mso-api-handlers/mso-requests-db/src/main/resources/hibernate-requests-core-mysql.cfg.xml
+++ b/mso-api-handlers/mso-requests-db/src/main/resources/hibernate-requests-core-mysql.cfg.xml
@@ -33,5 +33,7 @@
<mapping resource="InfraActiveRequests.hbm.xml"></mapping>
<mapping resource="SiteStatus.hbm.xml"></mapping>
+ <mapping resource="OperationStatus.hbm.xml"></mapping>
+ <mapping resource="ResourceOperationStatus.hbm.xml"></mapping>
</session-factory>
</hibernate-configuration>