From a13d6f4c3dd6d4c38d1f9cd97ac9fd377f580a4b Mon Sep 17 00:00:00 2001 From: c00149107 Date: Wed, 18 Oct 2017 11:48:21 +0800 Subject: Deal With Error Response from Vfc Deal With Error Response from Vfc Change-Id: Id5ce999d561099581b49524969c901ac6dac3f90 Issue-ID:SO-233 Signed-off-by: c00149107 --- .../openecomp/mso/requestsdb/OperationStatus.java | 55 +++++++++++++++++++- .../openecomp/mso/requestsdb/RequestsDatabase.java | 2 +- .../mso/requestsdb/ResourceOperationStatus.java | 60 +++++++++++++++++++++- .../src/main/resources/OperationStatus.hbm.xml | 8 +-- .../main/resources/ResourceOperationStatus.hbm.xml | 8 +-- .../hibernate-requests-core-mysql.cfg.xml | 2 + 6 files changed, 125 insertions(+), 10 deletions(-) (limited to 'mso-api-handlers/mso-requests-db') 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; } + + /** + *
+ * + * @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; + } + + + /** + *
+ * + * @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 *
@@ -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; } - + + /** + *
+ * + * @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; + } + + /** + *
+ * + * @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 @@ This class describes a operation status - - + + + + @@ -39,6 +41,6 @@ - + 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 @@ This class describes a progress status - - - + + + + + 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 @@ + + -- cgit 1.2.3-korg