diff options
Diffstat (limited to 'mso-api-handlers')
8 files changed, 130 insertions, 12 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java index 3e29a8221a..328ef816e9 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java @@ -23,6 +23,9 @@ package org.openecomp.mso.apihandlerinfra; public class Constants {
+ private Constants() {
+ }
+
public static final String VNF_TYPES_PATH = "/{version: v1|v2|v3}/vnf-types";
public static final String NETWORK_TYPES_PATH = "/{version: v1|v2|v3}/network-types";
public static final String VF_MODULE_MODEL_NAMES_PATH = "/{version: v2|v3}/vf-module-model-names";
@@ -47,4 +50,4 @@ public class Constants { public static final String VALID_INSTANCE_NAME_FORMAT = "^[a-zA-Z][a-zA-Z0-9._-]*$";
public static final String A_LA_CARTE = "aLaCarte";
-}
\ No newline at end of file +}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java index 91bf2df48c..746493c194 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java @@ -28,7 +28,7 @@ import org.openecomp.mso.apihandler.common.ErrorNumbers; public class Messages { - public static final Map<String,String> errors = new HashMap<>(); + protected static final Map<String,String> errors = new HashMap<>(); static { errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_service", "Service request FAILED schema validation. %s"); errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_feature", "Feature request FAILED schema validation. %s"); 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> |