aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-requests-db/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-requests-db/src/main')
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ArchivedInfraRequests.java91
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java93
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraRequests.java)262
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatus.java239
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatusId.java79
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvDistributionStatus.java177
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java190
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatusId.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatus.java)106
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatus.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/ResourceOperationStatus.java)135
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatusId.java91
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java105
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/Status.java40
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatus.java140
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatusId.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatus.java)69
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogDistributionStatus.java124
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookup.java111
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookupId.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookup.java)57
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java30
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java41
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java57
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java566
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java34
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java42
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java59
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java34
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraActiveRequests.java)24
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java34
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java30
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java33
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDBHelper.java)142
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDbConstant.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbConstant.java)131
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/adapter/TimestampXMLAdapter.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/adapter/TimestampXMLAdapter.java)2
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java72
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationStatus.java228
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusDb.java196
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatus.java121
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusDb.java243
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java888
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbSessionFactoryManager.java47
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/SiteStatus.java72
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusDb.java194
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatus.java71
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusDb.java197
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupDb.java124
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml161
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/OperationStatus.hbm.xml47
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvDistributionStatus.hbm.xml56
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvServiceModelStatus.hbm.xml54
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/ResourceOperationStatus.hbm.xml44
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/SiteStatus.hbm.xml37
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/WatchdogComponentDistributionStatus.hbm.xml46
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/WatchdogDistributionStatus.hbm.xml46
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/WatchdogServiceModVerIdLookup.hbm.xml38
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/beans.xml12
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/resources/hibernate-requests-core-mysql.cfg.xml44
55 files changed, 2975 insertions, 3431 deletions
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ArchivedInfraRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ArchivedInfraRequests.java
new file mode 100644
index 0000000000..b66e027a35
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ArchivedInfraRequests.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so.db.request.beans;
+
+import java.util.Objects;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+@Entity
+@Table(name = "archived_infra_requests")
+public class ArchivedInfraRequests extends InfraRequests {
+
+ private static final long serialVersionUID = 7132783898142451603L;
+
+ public ArchivedInfraRequests() {
+ }
+
+ public ArchivedInfraRequests(String requestId, String action) {
+ setRequestId(requestId);
+ setAction(action);
+ }
+
+ public ArchivedInfraRequests(String requestId) {
+ setRequestId(requestId);
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof ArchivedInfraRequests)) {
+ return false;
+ }
+ ArchivedInfraRequests castOther = (ArchivedInfraRequests) other;
+ return Objects.equals(getRequestId(), castOther.getRequestId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getRequestId());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("requestId", getRequestId())
+ .append("clientRequestId", getClientRequestId()).append("action", getAction())
+ .append("requestStatus", getRequestStatus()).append("statusMessage", getStatusMessage())
+ .append("progress", getProgress()).append("startTime", getStartTime()).append("endTime", getEndTime())
+ .append("source", getSource()).append("vnfId", getVnfId()).append("vnfName", getVnfName())
+ .append("vnfType", getVnfType()).append("serviceType", getServiceType())
+ .append("aicNodeClli", getAicNodeClli()).append("tenantId", getTenantId())
+ .append("provStatus", getProvStatus()).append("vnfParams", getVnfParams())
+ .append("vnfOutputs", getVnfOutputs()).append("requestBody", getRequestBody())
+ .append("responseBody", getResponseBody()).append("lastModifiedBy", getLastModifiedBy())
+ .append("modifyTime", getModifyTime()).append("requestType", getRequestType())
+ .append("volumeGroupId", getVolumeGroupId()).append("volumeGroupName", getVolumeGroupName())
+ .append("vfModuleId", getVfModuleId()).append("vfModuleName", getVfModuleName())
+ .append("vfModuleModelName", getVfModuleModelName()).append("aaiServiceId", getAaiServiceId())
+ .append("aicCloudRegion", getAicCloudRegion()).append("callBackUrl", getCallBackUrl())
+ .append("correlator", getCorrelator()).append("serviceInstanceId", getServiceInstanceId())
+ .append("serviceInstanceName", getServiceInstanceName()).append("requestScope", getRequestScope())
+ .append("requestAction", getRequestAction()).append("networkId", getNetworkId())
+ .append("networkName", getNetworkName()).append("networkType", getNetworkType())
+ .append("requestorId", getRequestorId()).append("configurationId", getConfigurationId())
+ .append("configurationName", getConfigurationName()).append("operationalEnvId", getOperationalEnvId())
+ .append("operationalEnvName", getOperationalEnvName()).toString();
+ }
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
new file mode 100644
index 0000000000..84ff458698
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.beans;
+
+import java.util.Objects;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * InfraActiveRequests generated by hbm2java
+ */
+@Entity
+@Table(name = "infra_active_requests")
+public class InfraActiveRequests extends InfraRequests {
+
+ private static final long serialVersionUID = -6818265918910035170L;
+
+ public InfraActiveRequests() {
+ }
+
+ public InfraActiveRequests(String requestId, String action) {
+ setRequestId(requestId);
+ setAction(action);
+ }
+
+ public InfraActiveRequests(String requestId) {
+ setRequestId(requestId);
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof InfraActiveRequests)) {
+ return false;
+ }
+ InfraActiveRequests castOther = (InfraActiveRequests) other;
+ return Objects.equals(getRequestId(), castOther.getRequestId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getRequestId());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("requestId", getRequestId())
+ .append("clientRequestId", getClientRequestId()).append("action", getAction())
+ .append("requestStatus", getRequestStatus()).append("statusMessage", getStatusMessage())
+ .append("progress", getProgress()).append("startTime", getStartTime()).append("endTime", getEndTime())
+ .append("source", getSource()).append("vnfId", getVnfId()).append("vnfName", getVnfName())
+ .append("vnfType", getVnfType()).append("serviceType", getServiceType())
+ .append("aicNodeClli", getAicNodeClli()).append("tenantId", getTenantId())
+ .append("provStatus", getProvStatus()).append("vnfParams", getVnfParams())
+ .append("vnfOutputs", getVnfOutputs()).append("requestBody", getRequestBody())
+ .append("responseBody", getResponseBody()).append("lastModifiedBy", getLastModifiedBy())
+ .append("modifyTime", getModifyTime()).append("requestType", getRequestType())
+ .append("volumeGroupId", getVolumeGroupId()).append("volumeGroupName", getVolumeGroupName())
+ .append("vfModuleId", getVfModuleId()).append("vfModuleName", getVfModuleName())
+ .append("vfModuleModelName", getVfModuleModelName()).append("aaiServiceId", getAaiServiceId())
+ .append("aicCloudRegion", getAicCloudRegion()).append("callBackUrl", getCallBackUrl())
+ .append("correlator", getCorrelator()).append("serviceInstanceId", getServiceInstanceId())
+ .append("serviceInstanceName", getServiceInstanceName()).append("requestScope", getRequestScope())
+ .append("requestAction", getRequestAction()).append("networkId", getNetworkId())
+ .append("networkName", getNetworkName()).append("networkType", getNetworkType())
+ .append("requestorId", getRequestorId()).append("configurationId", getConfigurationId())
+ .append("configurationName", getConfigurationName()).append("operationalEnvId", getOperationalEnvId())
+ .append("operationalEnvName", getOperationalEnvName()).toString();
+ }
+}
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/onap/so/db/request/beans/InfraRequests.java
index d2db8fb35b..48a6cf3ff0 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/onap/so/db/request/beans/InfraRequests.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 - 2018 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.
@@ -18,83 +18,135 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.requestsdb;
-
-// Generated Jul 27, 2015 3:05:00 PM by Hibernate Tools 3.4.0.CR1
+package org.onap.so.db.request.beans;
+import java.net.URI;
import java.sql.Timestamp;
-
+import java.util.Date;
+import java.util.Objects;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.openecomp.mso.requestsdb.adapter.TimestampXMLAdapter;
-
-/**
- * InfraActiveRequests generated by hbm2java
- */
-public class InfraRequests implements java.io.Serializable {
-
- /**
- * Serialization id.
- */
- private static final long serialVersionUID = -661307666798018192L;
-
- private String requestId = null;
- private String clientRequestId = null;
- private String action = null;
- private String requestStatus = null;
- private String statusMessage = null;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.onap.so.requestsdb.adapter.TimestampXMLAdapter;
+
+import uk.co.blackpepper.bowman.annotation.ResourceId;
+
+@MappedSuperclass
+public abstract class InfraRequests implements java.io.Serializable {
+
+ private static final long serialVersionUID = -5497583682393936143L;
+ private static final String UNKNOWN = "unknown";
+
+
+ @Id
+ @Column(name = "REQUEST_ID", length=45)
+ private String requestId;
+ @Column(name = "CLIENT_REQUEST_ID", length=45, unique=true)
+ private String clientRequestId;
+ @Column(name = "ACTION", length=45)
+ private String action;
+ @Column(name = "REQUEST_STATUS", length=20)
+ private String requestStatus;
+ @Column(name = "STATUS_MESSAGE", length=2000)
+ private String statusMessage;
+ @Column(name = "PROGRESS", precision=11)
private Long progress;
- private Timestamp startTime = null;
- private Timestamp endTime = null;
- private String source = null;
- private String vnfId = null;
- private String vnfName = null;
- private String vnfType = null;
- private String serviceType = null;
- private String aicNodeClli = null;
- private String tenantId = null;
- private String provStatus = null;
- private String vnfParams = null;
- private String vnfOutputs = null;
- private String requestBody = null;
- private String responseBody = null;
- private String lastModifiedBy = null;
- private Timestamp modifyTime = null;
- private String requestType = null;
- private String volumeGroupId = null;
- private String volumeGroupName = null;
- private String vfModuleId = null;
- private String vfModuleName = null;
- private String vfModuleModelName = null;
- private String aaiServiceId = null;
- private String aicCloudRegion = null;
- private String callBackUrl = null;
- private String correlator = null;
- private String serviceInstanceId = null;
- private String serviceInstanceName = null;
- private String requestScope = null;
- private String requestAction = null;
- private String networkId = null;
- private String networkName = null;
- private String networkType = null;
- private String requestorId = null;
- private String configurationId = null;
- private String configurationName = null;
- private String operationalEnvId = null;
- private String operationalEnvName = null;
-
- public InfraRequests() {
- }
-
- public InfraRequests(String requestId, String action) {
- this.requestId = requestId;
- this.action = action;
+
+ @Column(name = "START_TIME")
+ private Timestamp startTime;
+ @Column(name = "END_TIME")
+ private Timestamp endTime;
+ @Column(name = "SOURCE", length=45)
+ private String source;
+ @Column(name = "VNF_ID", length=45)
+ private String vnfId;
+ @Column(name = "VNF_NAME", length=80)
+ private String vnfName;
+ @Column(name = "VNF_TYPE", length=200)
+ private String vnfType;
+ @Column(name = "SERVICE_TYPE", length=45)
+ private String serviceType;
+ @Column(name = "AIC_NODE_CLLI", length=11)
+ private String aicNodeClli;
+ @Column(name = "TENANT_ID", length=45)
+ private String tenantId;
+ @Column(name = "PROV_STATUS", length=20)
+ private String provStatus;
+ @Column(name = "VNF_PARAMS")
+ private String vnfParams;
+ @Column(name = "VNF_OUTPUTS")
+ private String vnfOutputs;
+ @Column(name = "REQUEST_BODY")
+ private String requestBody;
+ @Column(name = "RESPONSE_BODY")
+ private String responseBody;
+ @Column(name = "LAST_MODIFIED_BY", length=50)
+ private String lastModifiedBy;
+ @Column(name = "MODIFY_TIME")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date modifyTime;
+ @Column(name = "REQUEST_TYPE", length=20)
+ private String requestType;
+ @Column(name = "VOLUME_GROUP_ID", length=45)
+ private String volumeGroupId;
+ @Column(name = "VOLUME_GROUP_NAME", length=45)
+ private String volumeGroupName;
+ @Column(name = "VF_MODULE_ID", length=45)
+ private String vfModuleId;
+ @Column(name = "VF_MODULE_NAME", length=200)
+ private String vfModuleName;
+ @Column(name = "VF_MODULE_MODEL_NAME", length=200)
+ private String vfModuleModelName;
+ @Column(name = "AAI_SERVICE_ID", length=50)
+ private String aaiServiceId;
+ @Column(name = "AIC_CLOUD_REGION", length=11)
+ private String aicCloudRegion;
+ @Column(name = "CALLBACK_URL", length=200)
+ private String callBackUrl;
+ @Column(name = "CORRELATOR", length=80)
+ private String correlator;
+ @Column(name = "SERVICE_INSTANCE_ID", length=45)
+ private String serviceInstanceId;
+ @Column(name = "SERVICE_INSTANCE_NAME", length=80)
+ private String serviceInstanceName;
+ @Column(name = "REQUEST_SCOPE", length=45)
+ private String requestScope;
+ @Column(name = "REQUEST_ACTION", length=45)
+ private String requestAction;
+ @Column(name = "NETWORK_ID", length=45)
+ private String networkId;
+ @Column(name = "NETWORK_NAME", length=80)
+ private String networkName;
+ @Column(name = "NETWORK_TYPE", length=80)
+ private String networkType;
+ @Column(name = "REQUESTOR_ID", length=80)
+ private String requestorId;
+ @Column(name = "CONFIGURATION_ID", length=45)
+ private String configurationId;
+ @Column(name = "CONFIGURATION_NAME", length=200)
+ private String configurationName;
+ @Column(name = "OPERATIONAL_ENV_ID", length=45)
+ private String operationalEnvId;
+ @Column(name = "OPERATIONAL_ENV_NAME", length=200)
+ private String operationalEnvName;
+
+ @ResourceId
+ public URI getRequestURI() {
+ return URI.create(this.requestId);
}
public String getRequestId() {
return this.requestId;
}
-
+
public void setRequestId(String requestId) {
this.requestId = requestId;
}
@@ -261,15 +313,10 @@ public class InfraRequests implements java.io.Serializable {
this.lastModifiedBy = lastModifiedBy;
}
- @XmlJavaTypeAdapter(TimestampXMLAdapter.class)
- public Timestamp getModifyTime() {
+ public Date getModifyTime() {
return this.modifyTime;
}
-
- public void setModifyTime(Timestamp modifyTime) {
- this.modifyTime = modifyTime;
- }
-
+
public String getRequestType() {
return this.requestType;
}
@@ -445,4 +492,65 @@ public class InfraRequests implements java.io.Serializable {
public void setOperationalEnvName(String operationalEnvName) {
this.operationalEnvName = operationalEnvName;
}
+
+ @PrePersist
+ protected void onCreate() {
+ if(requestScope==null)
+ requestScope=UNKNOWN;
+ if(requestAction==null)
+ requestAction=UNKNOWN;
+ this.modifyTime = new Date();
+ }
+
+ @PreUpdate
+ protected void onUpdate() {
+ if(requestScope==null)
+ requestScope=UNKNOWN;
+ if(requestAction==null)
+ requestAction=UNKNOWN;
+ this.modifyTime = new Date();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof InfraRequests)) {
+ return false;
+ }
+ InfraRequests castOther = (InfraRequests) other;
+ return Objects.equals(getRequestId(), castOther.getRequestId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getRequestId());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("requestId", getRequestId())
+ .append("clientRequestId", getClientRequestId()).append("action", getAction())
+ .append("requestStatus", getRequestStatus()).append("statusMessage", getStatusMessage())
+ .append("progress", getProgress()).append("startTime", getStartTime()).append("endTime", getEndTime())
+ .append("source", getSource()).append("vnfId", getVnfId()).append("vnfName", getVnfName())
+ .append("vnfType", getVnfType()).append("serviceType", getServiceType())
+ .append("aicNodeClli", getAicNodeClli()).append("tenantId", getTenantId())
+ .append("provStatus", getProvStatus()).append("vnfParams", getVnfParams())
+ .append("vnfOutputs", getVnfOutputs()).append("requestBody", getRequestBody())
+ .append("responseBody", getResponseBody()).append("lastModifiedBy", getLastModifiedBy())
+ .append("modifyTime", getModifyTime()).append("requestType", getRequestType())
+ .append("volumeGroupId", getVolumeGroupId()).append("volumeGroupName", getVolumeGroupName())
+ .append("vfModuleId", getVfModuleId()).append("vfModuleName", getVfModuleName())
+ .append("vfModuleModelName", getVfModuleModelName()).append("aaiServiceId", getAaiServiceId())
+ .append("aicCloudRegion", getAicCloudRegion()).append("callBackUrl", getCallBackUrl())
+ .append("correlator", getCorrelator()).append("serviceInstanceId", getServiceInstanceId())
+ .append("serviceInstanceName", getServiceInstanceName()).append("requestScope", getRequestScope())
+ .append("requestAction", getRequestAction()).append("networkId", getNetworkId())
+ .append("networkName", getNetworkName()).append("networkType", getNetworkType())
+ .append("requestorId", getRequestorId()).append("configurationId", getConfigurationId())
+ .append("configurationName", getConfigurationName()).append("operationalEnvId", getOperationalEnvId())
+ .append("operationalEnvName", getOperationalEnvName()).toString();
+ }
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatus.java
new file mode 100644
index 0000000000..dff9dd6687
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatus.java
@@ -0,0 +1,239 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.onap.so.db.request.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import java.util.Objects;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * The service operation status
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-08-28
+ */
+
+@IdClass(OperationStatusId.class)
+@Entity
+@Table(name = "operation_status")
+public class OperationStatus implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @Column(name = "SERVICE_ID")
+ private String serviceId;
+ @Id
+ @Column(name = "OPERATION_ID", length=256)
+ private String operationId;
+
+ @Column(name = "SERVICE_NAME", length=256)
+ private String serviceName;
+
+ @Column(name = "OPERATION_TYPE", length=256)
+ private String operation;
+
+ @Column(name = "USER_ID", length=256)
+ private String userId;
+
+ @Column(name = "RESULT", length=256)
+ private String result;
+
+ @Column(name = "OPERATION_CONTENT", length=256)
+ private String operationContent;
+
+ @Column(name = "PROGRESS", length=256)
+ private String progress = "0";
+
+ @Column(name = "REASON", length=256)
+ private String reason;
+
+ @Column(name = "OPERATE_AT", length=256, updatable=false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date operateAt;
+
+ @Column(name = "FINISHED_AT", length=256)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date finishedAt;
+
+ public OperationStatus() {
+
+ }
+
+ public OperationStatus(String serviceId, String operationId) {
+ this.serviceId = serviceId;
+ this.operationId = operationId;
+ }
+
+
+ public String getServiceId() {
+ return serviceId;
+ }
+
+
+ public void setServiceId(String serviceId) {
+ this.serviceId = serviceId;
+ }
+
+
+ public String getOperationId() {
+ return operationId;
+ }
+
+
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+
+
+ public String getOperation() {
+ return operation;
+ }
+
+
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
+
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+
+ public String getResult() {
+ return result;
+ }
+
+
+ public void setResult(String result) {
+ this.result = result;
+ }
+
+
+ public String getOperationContent() {
+ return operationContent;
+ }
+
+
+ public void setOperationContent(String operationContent) {
+ this.operationContent = operationContent;
+ }
+
+
+ public String getProgress() {
+ return progress;
+ }
+
+
+ public void setProgress(String progress) {
+ this.progress = progress;
+ }
+
+
+ public String getReason() {
+ return reason;
+ }
+
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
+
+ public Date getOperateAt() {
+ return operateAt;
+ }
+
+ public Date getFinishedAt() {
+ return finishedAt;
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.finishedAt = this.operateAt = new Date();
+ }
+
+ @PreUpdate
+ protected void onUpdate() {
+ this.finishedAt = new Date();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof OperationStatus)) {
+ return false;
+ }
+ OperationStatus castOther = (OperationStatus) other;
+ return Objects.equals(getServiceId(), castOther.getServiceId())
+ && Objects.equals(getOperationId(), castOther.getOperationId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getServiceId(), getOperationId());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("serviceId", getServiceId()).append("operationId", getOperationId())
+ .append("operation", getOperation()).append("userId", getUserId()).append("result", getResult())
+ .append("operationContent", getOperationContent()).append("progress", getProgress())
+ .append("reason", getReason()).append("operateAt", getOperateAt()).append("finishedAt", getFinishedAt())
+ .toString();
+ }
+
+
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatusId.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatusId.java
new file mode 100644
index 0000000000..d07788e55c
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationStatusId.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.beans;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+public class OperationStatusId implements Serializable {
+
+ private static final long serialVersionUID = 3114959241155882723L;
+
+ @BusinessKey
+ private String serviceId;
+ @BusinessKey
+ private String operationId;
+
+ public OperationStatusId() {
+
+ }
+ public OperationStatusId(String serviceId, String operationId) {
+ this.serviceId = serviceId;
+ this.operationId = operationId;
+ }
+ public String getServiceId() {
+ return serviceId;
+ }
+ public void setServiceId(String serviceId) {
+ this.serviceId = serviceId;
+ }
+ public String getOperationId() {
+ return operationId;
+ }
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof OperationStatusId)) {
+ return false;
+ }
+ OperationStatusId castOther = (OperationStatusId) other;
+ return Objects.equals(this.getServiceId(), castOther.getServiceId())
+ && Objects.equals(this.getOperationId(), castOther.getOperationId());
+ }
+ @Override
+ public int hashCode() {
+ return Objects.hash(this.getServiceId(), this.getOperationId());
+ }
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("serviceId", getServiceId()).append("operationId", getOperationId())
+ .toString();
+ }
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvDistributionStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvDistributionStatus.java
new file mode 100644
index 0000000000..a1e1278306
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvDistributionStatus.java
@@ -0,0 +1,177 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinColumns;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import java.util.Objects;
+
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+
+@Entity
+@Table(name = "activate_operational_env_per_distributionid_status")
+public class OperationalEnvDistributionStatus implements Serializable {
+
+ /**
+ * Serialization id.
+ */
+ private static final long serialVersionUID = 7398393659281364650L;
+
+ @Id
+ @Column(name = "DISTRIBUTION_ID", length=45)
+ private String distributionId;
+ @Column(name = "OPERATIONAL_ENV_ID", length=45)
+ private String operationalEnvId;
+ @Column(name = "SERVICE_MODEL_VERSION_ID", length=45)
+ private String serviceModelVersionId;
+ @Column(name = "REQUEST_ID", length=45)
+ private String requestId;
+ @Column(name = "DISTRIBUTION_ID_STATUS", length=45)
+ private String distributionIdStatus;
+ @Column(name = "DISTRIBUTION_ID_ERROR_REASON", length=250)
+ private String distributionIdErrorReason;
+ @Column(name = "CREATE_TIME", updatable=false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date createTime;
+ @Column(name = "MODIFY_TIME")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date modifyTime;
+
+
+ public OperationalEnvDistributionStatus() {
+
+ }
+
+ public OperationalEnvDistributionStatus(String distributionId, String operationalEnvId, String serviceModelVersionId) {
+ this.distributionId = distributionId;
+ this.operationalEnvId = operationalEnvId;
+ this.serviceModelVersionId = serviceModelVersionId;
+ }
+ public String getDistributionId() {
+ return distributionId;
+ }
+
+ public void setDistributionId(String distributionId) {
+ this.distributionId = distributionId;
+ }
+
+ public String getOperationalEnvId() {
+ return operationalEnvId;
+ }
+
+ public void setOperationalEnvId(String operationalEnvId) {
+ this.operationalEnvId = operationalEnvId;
+ }
+
+ public String getServiceModelVersionId() {
+ return serviceModelVersionId;
+ }
+
+ public void setServiceModelVersionId(String serviceModelVersionId) {
+ this.serviceModelVersionId = serviceModelVersionId;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public String getDistributionIdStatus() {
+ return distributionIdStatus;
+ }
+
+ public void setDistributionIdStatus(String distributionIdStatus) {
+ this.distributionIdStatus = distributionIdStatus;
+ }
+
+ public String getDistributionIdErrorReason() {
+ return distributionIdErrorReason;
+ }
+
+ public void setDistributionIdErrorReason(String distributionIdErrorReason) {
+ this.distributionIdErrorReason = distributionIdErrorReason;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ public Date getModifyTime() {
+ return modifyTime;
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.createTime = this.modifyTime = new Date();
+ }
+
+ @PreUpdate
+ protected void onUpdate() {
+ this.modifyTime = new Date();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof OperationalEnvDistributionStatus)) {
+ return false;
+ }
+ OperationalEnvDistributionStatus castOther = (OperationalEnvDistributionStatus) other;
+ return Objects.equals(getDistributionId(), castOther.getDistributionId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getDistributionId());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("distributionId", getDistributionId())
+ .append("operationalEnvId", getOperationalEnvId())
+ .append("serviceModelVersionId", getServiceModelVersionId()).append("requestId", getRequestId())
+ .append("distributionIdStatus", getDistributionIdStatus())
+ .append("distributionIdErrorReason", getDistributionIdErrorReason())
+ .append("createTime", getCreateTime()).append("modifyTime", getModifyTime()).toString();
+ }
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java
new file mode 100644
index 0000000000..588822cce0
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java
@@ -0,0 +1,190 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import java.util.Objects;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * @author PB6115
+ *
+ */
+@IdClass(OperationalEnvServiceModelStatusId.class)
+@Entity
+@Table(name = "activate_operational_env_service_model_distribution_status")
+public class OperationalEnvServiceModelStatus implements Serializable {
+
+ /**
+ * Serialization id.
+ */
+ private static final long serialVersionUID = 8197084996598869656L;
+
+ @Id
+ @Column(name = "REQUEST_ID", length=45)
+ private String requestId;
+ @Id
+ @Column(name = "OPERATIONAL_ENV_ID", length=45)
+ private String operationalEnvId;
+ @Id
+ @Column(name = "SERVICE_MODEL_VERSION_ID", length=45)
+ private String serviceModelVersionId;
+ @Column(name = "SERVICE_MOD_VER_FINAL_DISTR_STATUS", length=45)
+ private String serviceModelVersionDistrStatus;
+ @Column(name = "RECOVERY_ACTION", length=30)
+ private String recoveryAction;
+ @Column(name = "RETRY_COUNT_LEFT")
+ private Integer retryCount;
+ @Column(name = "WORKLOAD_CONTEXT", length=80)
+ private String workloadContext;
+ @Column(name = "CREATE_TIME", updatable=false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date createTime;
+ @Column(name = "MODIFY_TIME")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date modifyTime;
+
+ public OperationalEnvServiceModelStatus() {
+
+ }
+
+ public OperationalEnvServiceModelStatus(String requestId, String operationalEnvId, String serviceModelVersionId) {
+ this.requestId = requestId;
+ this.operationalEnvId = operationalEnvId;
+ this.serviceModelVersionId = serviceModelVersionId;
+ }
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public String getOperationalEnvId() {
+ return operationalEnvId;
+ }
+
+ public void setOperationalEnvId(String operationalEnvId) {
+ this.operationalEnvId = operationalEnvId;
+ }
+
+ public String getServiceModelVersionId() {
+ return serviceModelVersionId;
+ }
+
+ public void setServiceModelVersionId(String serviceModelVersionId) {
+ this.serviceModelVersionId = serviceModelVersionId;
+ }
+
+ public String getServiceModelVersionDistrStatus() {
+ return serviceModelVersionDistrStatus;
+ }
+
+ public void setServiceModelVersionDistrStatus(String serviceModelVersionDistrStatus) {
+ this.serviceModelVersionDistrStatus = serviceModelVersionDistrStatus;
+ }
+
+ public String getRecoveryAction() {
+ return recoveryAction;
+ }
+
+ public void setRecoveryAction(String recoveryAction) {
+ this.recoveryAction = recoveryAction;
+ }
+
+ public Integer getRetryCount() {
+ return retryCount;
+ }
+
+ public void setRetryCount(Integer retryCount) {
+ this.retryCount = retryCount;
+ }
+
+ public String getWorkloadContext() {
+ return workloadContext;
+ }
+
+ public void setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+
+ public Date getModifyTime() {
+ return modifyTime;
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.createTime = this.modifyTime = new Date();
+ }
+
+ @PreUpdate
+ protected void onUpdate() {
+ this.modifyTime = new Date();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof OperationalEnvServiceModelStatus)) {
+ return false;
+ }
+ OperationalEnvServiceModelStatus castOther = (OperationalEnvServiceModelStatus) other;
+ return Objects.equals(getRequestId(), castOther.getRequestId())
+ && Objects.equals(getOperationalEnvId(), castOther.getOperationalEnvId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getRequestId(), getOperationalEnvId());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("requestId", getRequestId())
+ .append("operationalEnvId", getOperationalEnvId())
+ .append("serviceModelVersionId", getServiceModelVersionId())
+ .append("serviceModelVersionDistrStatus", getServiceModelVersionDistrStatus())
+ .append("recoveryAction", getRecoveryAction()).append("retryCount", getRetryCount())
+ .append("workloadContext", getWorkloadContext()).append("createTime", getCreateTime())
+ .append("modifyTime", getModifyTime()).toString();
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatusId.java
index c5df122816..301e24f8ec 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatus.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatusId.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.
@@ -18,89 +18,65 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.requestsdb;
+package org.onap.so.db.request.beans;
import java.io.Serializable;
-import java.sql.Timestamp;
+import java.util.Objects;
-public class OperationalEnvDistributionStatus implements Serializable {
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.ToStringBuilder;
- /**
- * Serialization id.
- */
- private static final long serialVersionUID = 7398393659281364650L;
+public class OperationalEnvServiceModelStatusId implements Serializable {
- private String distributionId = null;
- private String operationalEnvId = null;
- private String serviceModelVersionId = null;
- private String requestId = null;
- private String distributionIdStatus = null;
- private String distributionIdErrorReason = null;
- private Timestamp createTime = null;
- private Timestamp modifyTime = null;
+ private static final long serialVersionUID = 6885534735320068787L;
- public String getDistributionId() {
- return distributionId;
- }
+ @BusinessKey
+ private String requestId;
+ @BusinessKey
+ private String operationalEnvId;
+ @BusinessKey
+ private String serviceModelVersionId;
- public void setDistributionId(String distributionId) {
- this.distributionId = distributionId;
+ public String getRequestId() {
+ return requestId;
+ }
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
}
-
public String getOperationalEnvId() {
return operationalEnvId;
}
-
public void setOperationalEnvId(String operationalEnvId) {
this.operationalEnvId = operationalEnvId;
}
-
public String getServiceModelVersionId() {
return serviceModelVersionId;
}
-
public void setServiceModelVersionId(String serviceModelVersionId) {
this.serviceModelVersionId = serviceModelVersionId;
}
-
- public String getRequestId() {
- return requestId;
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof OperationalEnvServiceModelStatusId)) {
+ return false;
+ }
+ OperationalEnvServiceModelStatusId castOther = (OperationalEnvServiceModelStatusId) other;
+ return Objects.equals(this.getRequestId(), castOther.getRequestId())
+ && Objects.equals(this.getOperationalEnvId(), castOther.getOperationalEnvId())
+ && Objects.equals(this.getServiceModelVersionId(), castOther.getServiceModelVersionId());
+ }
+ @Override
+ public int hashCode() {
+ return Objects.hash(this.getRequestId(), this.getOperationalEnvId(), this.getServiceModelVersionId());
+ }
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("requestId", getRequestId())
+ .append("operationalEnvId", getOperationalEnvId())
+ .append("serviceModelVersionId", getServiceModelVersionId()).toString();
}
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- public String getDistributionIdStatus() {
- return distributionIdStatus;
- }
-
- public void setDistributionIdStatus(String distributionIdStatus) {
- this.distributionIdStatus = distributionIdStatus;
- }
-
- public String getDistributionIdErrorReason() {
- return distributionIdErrorReason;
- }
-
- public void setDistributionIdErrorReason(String distributionIdErrorReason) {
- this.distributionIdErrorReason = distributionIdErrorReason;
- }
-
- public Timestamp getCreateTime() {
- return createTime;
- }
-
- public void setCreateTime(Timestamp createTime) {
- this.createTime = createTime;
- }
-
- public Timestamp getModifyTime() {
- return modifyTime;
- }
-
- public void setModifyTime(Timestamp modifyTime) {
- this.modifyTime = modifyTime;
- }
-
}
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/onap/so/db/request/beans/ResourceOperationStatus.java
index 07650ac417..386daa6dbb 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/onap/so/db/request/beans/ResourceOperationStatus.java
@@ -17,10 +17,19 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.requestsdb;
+
+package org.onap.so.db.request.beans;
import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.Table;
+import java.util.Objects;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
/**
* The Resource operation status
* <br>
@@ -30,6 +39,10 @@ import java.io.Serializable;
* @author
* @version ONAP Amsterdam Release 2017-08-28
*/
+
+@IdClass(ResourceOperationStatusId.class)
+@Entity
+@Table(name = "resource_operation_status")
public class ResourceOperationStatus implements Serializable{
/**
@@ -37,25 +50,36 @@ public class ResourceOperationStatus implements Serializable{
*/
private static final long serialVersionUID = 1L;
- private String serviceId = null;
-
- private String operationId = null;
-
- private String resourceTemplateUUID = null;
-
- private String operType = null;
-
- private String resourceInstanceID = null;
-
- private String jobId = null;
-
- private String status = null;
-
+ @Id
+ @Column(name = "SERVICE_ID")
+ private String serviceId;
+ @Id
+ @Column(name = "OPERATION_ID", length=256)
+ private String operationId;
+ @Id
+ @Column(name = "RESOURCE_TEMPLATE_UUID")
+ private String resourceTemplateUUID;
+
+ @Column(name = "OPER_TYPE", length=256)
+ private String operType;
+
+ @Column(name = "RESOURCE_INSTANCE_ID", length=256)
+ private String resourceInstanceID;
+
+ @Column(name = "JOB_ID", length=256)
+ private String jobId;
+
+ @Column(name = "STATUS", length=256)
+ private String status;
+
+ @Column(name = "PROGRESS", length=256)
private String progress = "0";
- private String errorCode = null;
+ @Column(name = "ERROR_CODE", length=256)
+ private String errorCode;
- private String statusDescription = null;
+ @Column(name = "STATUS_DESCRIPOTION", length=256)
+ private String statusDescription;
public ResourceOperationStatus(){
@@ -169,54 +193,31 @@ public class ResourceOperationStatus implements Serializable{
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;
- }
-
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof ResourceOperationStatus)) {
+ return false;
+ }
+ ResourceOperationStatus castOther = (ResourceOperationStatus) other;
+ return Objects.equals(getServiceId(), castOther.getServiceId())
+ && Objects.equals(getOperationId(), castOther.getOperationId())
+ && Objects.equals(getResourceTemplateUUID(), castOther.getResourceTemplateUUID());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getServiceId(), getOperationId(), getResourceTemplateUUID());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("serviceId", getServiceId()).append("operationId", getOperationId())
+ .append("resourceTemplateUUID", getResourceTemplateUUID()).append("operType", getOperType())
+ .append("resourceInstanceID", getResourceInstanceID()).append("jobId", getJobId())
+ .append("status", getStatus()).append("progress", getProgress()).append("errorCode", getErrorCode())
+ .append("statusDescription", getStatusDescription()).toString();
+ }
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatusId.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatusId.java
new file mode 100644
index 0000000000..0f3656cd31
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatusId.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.beans;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+public class ResourceOperationStatusId implements Serializable {
+
+ private static final long serialVersionUID = -7425019928845751157L;
+
+ @BusinessKey
+ private String serviceId;
+ @BusinessKey
+ private String operationId;
+ @BusinessKey
+ private String resourceTemplateUUID;
+
+ public ResourceOperationStatusId() {
+
+ }
+
+ public ResourceOperationStatusId(String serviceId, String operationId, String resourceTemplateUUID) {
+ this.serviceId = serviceId;
+ this.operationId = operationId;
+ this.resourceTemplateUUID = resourceTemplateUUID;
+ }
+ public String getServiceId() {
+ return serviceId;
+ }
+ public void setServiceId(String serviceId) {
+ this.serviceId = serviceId;
+ }
+ public String getOperationId() {
+ return operationId;
+ }
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+ public String getResourceTemplateUUID() {
+ return resourceTemplateUUID;
+ }
+ public void setResourceTemplateUUID(String resourceTemplateUUID) {
+ this.resourceTemplateUUID = resourceTemplateUUID;
+ }
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof ResourceOperationStatusId)) {
+ return false;
+ }
+ ResourceOperationStatusId castOther = (ResourceOperationStatusId) other;
+ return Objects.equals(this.getServiceId(), castOther.getServiceId())
+ && Objects.equals(this.getOperationId(), castOther.getOperationId())
+ && Objects.equals(this.getResourceTemplateUUID(), castOther.getResourceTemplateUUID());
+ }
+ @Override
+ public int hashCode() {
+ return Objects.hash(this.getServiceId(), this.getOperationId(),this.getResourceTemplateUUID());
+ }
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("serviceId", getServiceId()).append("operationId", getOperationId())
+ .append("resourceTemplateUUID", getResourceTemplateUUID()).toString();
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java
new file mode 100644
index 0000000000..4e83ea5911
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java
@@ -0,0 +1,105 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.beans;
+
+
+import java.time.format.DateTimeFormatter;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.onap.so.logger.MsoLogger;
+import java.util.Objects;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+@Entity
+@Table(name = "site_status")
+public class SiteStatus {
+
+ @Column(name = "STATUS")
+ private boolean status;
+ @Id
+ @Column(name = "SITE_NAME")
+ private String siteName;
+ @Column(name = "CREATION_TIMESTAMP", insertable = false, updatable = false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ public SiteStatus() {
+ }
+
+ public SiteStatus(String siteName) {
+ this.siteName = siteName;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public String getSiteName() {
+ return siteName;
+ }
+
+ public void setSiteName(String siteName) {
+ this.siteName = siteName;
+ }
+
+ public void setStatus(boolean status) {
+ this.status = status;
+ }
+
+ public boolean getStatus() {
+ return status;
+ }
+
+ @PrePersist
+ protected void createdAt() {
+ this.created = new Date();
+ }
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof SiteStatus)) {
+ return false;
+ }
+ SiteStatus castOther = (SiteStatus) other;
+ return Objects.equals(getSiteName(), castOther.getSiteName());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getSiteName());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("status", getStatus()).append("siteName", getSiteName())
+ .append("created", getCreated()).toString();
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/Status.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/Status.java
new file mode 100644
index 0000000000..f6ee5086c9
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/Status.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.beans;
+
+
+/*
+ * Enum for Status values returned by API Handler to Tail-F
+*/
+public enum Status {
+ PENDING, INPROGRESS, COMPLETED, FAILED, TIMEOUT;
+
+ public boolean isFinished () {
+ switch (this) {
+ case COMPLETED:
+ case FAILED:
+ case TIMEOUT:
+ return true;
+ default:
+ return false;
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatus.java
new file mode 100644
index 0000000000..f72a7b327a
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatus.java
@@ -0,0 +1,140 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import java.util.Objects;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+@IdClass(WatchdogComponentDistributionStatusId.class)
+@Entity
+@Table(name = "watchdog_per_component_distribution_status")
+public class WatchdogComponentDistributionStatus implements Serializable {
+
+
+ /**
+ * Serialization id.
+ */
+ private static final long serialVersionUID = -4344508954204488669L;
+ @Id
+ @Column(name = "DISTRIBUTION_ID", length=45)
+ private String distributionId;
+ @Id
+ @Column(name = "COMPONENT_NAME", length=45)
+ private String componentName;
+ @Column(name = "COMPONENT_DISTRIBUTION_STATUS", length=45)
+ private String componentDistributionStatus;
+ @Column(name = "CREATE_TIME", updatable=false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date createTime;
+ @Column(name = "MODIFY_TIME")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date modifyTime;
+
+ public WatchdogComponentDistributionStatus() {
+
+ }
+
+ public WatchdogComponentDistributionStatus(String distributionId, String componentName) {
+ this.distributionId = distributionId;
+ this.componentName = componentName;
+ }
+
+ public String getDistributionId() {
+ return distributionId;
+ }
+
+ public void setDistributionId(String distributionId) {
+ this.distributionId = distributionId;
+ }
+
+ public String getComponentName() {
+ return componentName;
+ }
+
+ public void setComponentName(String componentName) {
+ this.componentName = componentName;
+ }
+
+ public String getComponentDistributionStatus() {
+ return componentDistributionStatus;
+ }
+
+ public void setComponentDistributionStatus(String componentDistributionStatus) {
+ this.componentDistributionStatus = componentDistributionStatus;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ public Date getModifyTime() {
+ return modifyTime;
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.createTime = this.modifyTime = new Date();
+ }
+
+ @PreUpdate
+ protected void onUpdate() {
+ this.modifyTime = new Date();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof WatchdogComponentDistributionStatus)) {
+ return false;
+ }
+ WatchdogComponentDistributionStatus castOther = (WatchdogComponentDistributionStatus) other;
+ return Objects.equals(getDistributionId(), castOther.getDistributionId())
+ && Objects.equals(getComponentName(), castOther.getComponentName());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getDistributionId(), getComponentName());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("distributionId", getDistributionId())
+ .append("componentName", getComponentName())
+ .append("componentDistributionStatus", getComponentDistributionStatus())
+ .append("createTime", getCreateTime()).append("modifyTime", getModifyTime()).toString();
+ }
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatusId.java
index 8f2bda3728..79e6fbaced 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatus.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatusId.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.
@@ -18,63 +18,56 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.requestsdb;
+package org.onap.so.db.request.beans;
import java.io.Serializable;
-import java.sql.Timestamp;
+import java.util.Objects;
-public class WatchdogComponentDistributionStatus implements Serializable {
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+public class WatchdogComponentDistributionStatusId implements Serializable {
- /**
- * Serialization id.
- */
- private static final long serialVersionUID = -4344508954204488669L;
-
- private String distributionId = null;
- private String componentName = null;
- private String componentDistributionStatus = null;
- private Timestamp createTime = null;
- private Timestamp modifyTime = null;
+ private static final long serialVersionUID = -4785382368168200031L;
+ @BusinessKey
+ private String distributionId;
+ @BusinessKey
+ private String componentName;
public String getDistributionId() {
return distributionId;
}
-
public void setDistributionId(String distributionId) {
this.distributionId = distributionId;
}
-
public String getComponentName() {
return componentName;
}
-
public void setComponentName(String componentName) {
this.componentName = componentName;
}
-
- public String getComponentDistributionStatus() {
- return componentDistributionStatus;
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof WatchdogComponentDistributionStatusId)) {
+ return false;
+ }
+ WatchdogComponentDistributionStatusId castOther = (WatchdogComponentDistributionStatusId) other;
+ return Objects.equals(this.getDistributionId(), castOther.getDistributionId())
+ && Objects.equals(this.getComponentName(), castOther.getComponentName());
}
-
- public void setComponentDistributionStatus(String componentDistributionStatus) {
- this.componentDistributionStatus = componentDistributionStatus;
+ @Override
+ public int hashCode() {
+ return Objects.hash(this.getDistributionId(), this.getComponentName());
}
-
- public Timestamp getCreateTime() {
- return createTime;
- }
- public void setCreateTime(Timestamp createTime) {
- this.createTime = createTime;
- }
-
- public Timestamp getModifyTime() {
- return modifyTime;
- }
-
- public void setModifyTime(Timestamp modifyTime) {
- this.modifyTime = modifyTime;
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("distributionId", getDistributionId())
+ .append("componentName", getComponentName()).toString();
}
+
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogDistributionStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogDistributionStatus.java
new file mode 100644
index 0000000000..40c81b96e7
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogDistributionStatus.java
@@ -0,0 +1,124 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import java.util.Objects;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+@Entity
+@Table(name = "watchdog_distributionid_status")
+public class WatchdogDistributionStatus implements Serializable {
+
+ /**
+ * Serialization id.
+ */
+ private static final long serialVersionUID = -4449711060885719079L;
+
+ @Id
+ @Column(name = "DISTRIBUTION_ID", length=45)
+ private String distributionId;
+ @Column(name = "DISTRIBUTION_ID_STATUS", length=45)
+ private String distributionIdStatus;
+ @Column(name = "CREATE_TIME", updatable=false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date createTime;
+ @Column(name = "MODIFY_TIME")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date modifyTime;
+
+ public WatchdogDistributionStatus() {
+
+ }
+
+ public WatchdogDistributionStatus(String distributionId) {
+ this.distributionId = distributionId;
+ }
+
+ public String getDistributionId() {
+ return distributionId;
+ }
+
+ public void setDistributionId(String distributionId) {
+ this.distributionId = distributionId;
+ }
+
+ public String getDistributionIdStatus() {
+ return distributionIdStatus;
+ }
+
+ public void setDistributionIdStatus(String distributionIdStatus) {
+ this.distributionIdStatus = distributionIdStatus;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ public Date getModifyTime() {
+ return modifyTime;
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.createTime = this.modifyTime = new Date();
+ }
+
+ @PreUpdate
+ protected void onUpdate() {
+ this.modifyTime = new Date();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof WatchdogDistributionStatus)) {
+ return false;
+ }
+ WatchdogDistributionStatus castOther = (WatchdogDistributionStatus) other;
+ return Objects.equals(getDistributionId(), castOther.getDistributionId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getDistributionId());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("distributionId", getDistributionId())
+ .append("distributionIdStatus", getDistributionIdStatus()).append("createTime", getCreateTime())
+ .append("modifyTime", getModifyTime()).toString();
+ }
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookup.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookup.java
new file mode 100644
index 0000000000..77089cbbdc
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookup.java
@@ -0,0 +1,111 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import java.util.Objects;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+@IdClass(WatchdogServiceModVerIdLookupId.class)
+@Entity
+@Table(name = "watchdog_service_mod_ver_id_lookup")
+public class WatchdogServiceModVerIdLookup implements Serializable {
+
+ /**
+ * Serialization id.
+ */
+ private static final long serialVersionUID = 7783869906430250355L;
+
+ @Id
+ @Column(name = "DISTRIBUTION_ID", length=45)
+ private String distributionId;
+ @Id
+ @Column(name = "SERVICE_MODEL_VERSION_ID", length=45)
+ private String serviceModelVersionId;
+ @Column(name = "CREATE_TIME", updatable=false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date createTime;
+
+ public WatchdogServiceModVerIdLookup() {
+
+ }
+ public WatchdogServiceModVerIdLookup(String distributionId, String serviceModelVersionId) {
+ this.distributionId = distributionId;
+ this.serviceModelVersionId = serviceModelVersionId;
+ }
+
+ public String getDistributionId() {
+ return distributionId;
+ }
+
+ public void setDistributionId(String distributionId) {
+ this.distributionId = distributionId;
+ }
+
+ public String getServiceModelVersionId() {
+ return serviceModelVersionId;
+ }
+
+ public void setServiceModelVersionId(String serviceModelVersionId) {
+ this.serviceModelVersionId = serviceModelVersionId;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.createTime = new Date();
+ }
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof WatchdogServiceModVerIdLookup)) {
+ return false;
+ }
+ WatchdogServiceModVerIdLookup castOther = (WatchdogServiceModVerIdLookup) other;
+ return Objects.equals(getDistributionId(), castOther.getDistributionId())
+ && Objects.equals(getServiceModelVersionId(), castOther.getServiceModelVersionId());
+ }
+ @Override
+ public int hashCode() {
+ return Objects.hash(getDistributionId(), getServiceModelVersionId());
+ }
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("distributionId", getDistributionId())
+ .append("serviceModelVersionId", getServiceModelVersionId()).append("createTime", getCreateTime())
+ .toString();
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookup.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookupId.java
index ced4f4f0a5..2c0b67bac2 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookup.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookupId.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.
@@ -18,44 +18,57 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.requestsdb;
+package org.onap.so.db.request.beans;
import java.io.Serializable;
-import java.sql.Timestamp;
+import java.util.Objects;
-public class WatchdogServiceModVerIdLookup implements Serializable {
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.ToStringBuilder;
- /**
- * Serialization id.
- */
- private static final long serialVersionUID = 7783869906430250355L;
-
- private String distributionId = null;
- private String serviceModelVersionId = null;
- private Timestamp createTime = null;
-
+public class WatchdogServiceModVerIdLookupId implements Serializable{
+
+ private static final long serialVersionUID = 9112709226209619993L;
+ @BusinessKey
+ private String distributionId;
+ @BusinessKey
+ private String serviceModelVersionId;
public String getDistributionId() {
return distributionId;
}
-
public void setDistributionId(String distributionId) {
this.distributionId = distributionId;
}
-
public String getServiceModelVersionId() {
return serviceModelVersionId;
}
-
public void setServiceModelVersionId(String serviceModelVersionId) {
this.serviceModelVersionId = serviceModelVersionId;
}
-
- public Timestamp getCreateTime() {
- return createTime;
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof WatchdogServiceModVerIdLookupId)) {
+ return false;
+ }
+ WatchdogServiceModVerIdLookupId castOther = (WatchdogServiceModVerIdLookupId) other;
+ return Objects.equals(this.getDistributionId(), castOther.getDistributionId())
+ && Objects.equals(getServiceModelVersionId(), castOther.getServiceModelVersionId());
+ }
+ @Override
+ public int hashCode() {
+ return Objects.hash(this.getDistributionId(), this.getServiceModelVersionId());
}
- public void setCreateTime(Timestamp createTime) {
- this.createTime = createTime;
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("distributionId", getDistributionId())
+ .append("serviceModelVersionId", getServiceModelVersionId()).toString();
}
+
+
+
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java
new file mode 100644
index 0000000000..f3e92ed16a
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so.db.request.data.repository;
+
+import org.onap.so.db.request.beans.ArchivedInfraRequests;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface ArchivedInfraRequestsRepository extends JpaRepository<ArchivedInfraRequests, String> {
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java
new file mode 100644
index 0000000000..cd25b122be
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.data.repository;
+
+import java.util.Date;
+import java.util.List;
+
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+
+@RepositoryRestResource(collectionResourceRel = "infraActiveRequests", path = "infraActiveRequests")
+public interface InfraActiveRequestsRepository extends JpaRepository<InfraActiveRequests, String>, InfraActiveRequestsRepositoryCustom {
+
+ InfraActiveRequests findOneByRequestIdOrClientRequestId(String requestId, String clientRequestId);
+ InfraActiveRequests findOneByRequestIdOrClientRequestIdAndRequestType(String requestId,String clientRequestId, String requestType);
+ InfraActiveRequests findOneByRequestId(String string);
+ InfraActiveRequests findOneByRequestBody(String requestBody);
+ List<InfraActiveRequests> findByEndTimeLessThan(Date endTime, Pageable request);
+ List<InfraActiveRequests> findByStartTimeLessThanAndEndTime(Date startTime, Date endTime, Pageable request);
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
new file mode 100644
index 0000000000..ba237bfa35
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.data.repository;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface InfraActiveRequestsRepositoryCustom {
+
+ public boolean healthCheck();
+
+ public InfraActiveRequests getRequestFromInfraActive(String requestId);
+
+ public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName,
+ String requestScope);
+
+ public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive(Map<String, List<String>> orchestrationMap);
+
+ // Added this method for Tenant Isolation project ( 1802-295491a) to query the mso_requests DB
+ // (infra_active_requests table) for operationalEnvId and OperationalEnvName
+ public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive(Map<String, String> orchestrationMap);
+
+ public List<InfraActiveRequests> getRequestListFromInfraActive(String queryAttributeName, String queryValue,
+ String requestType);
+
+ public InfraActiveRequests getRequestFromInfraActive(String requestId, String requestType);
+
+ public InfraActiveRequests checkDuplicateByVnfName(String vnfName, String action, String requestType);
+
+ public InfraActiveRequests checkDuplicateByVnfId(String vnfId, String action, String requestType);
+
+ public InfraActiveRequests checkVnfIdStatus(String operationalEnvironmentId);
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
new file mode 100644
index 0000000000..3240972a58
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
@@ -0,0 +1,566 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.onap.so.db.request.data.repository;
+
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import javax.persistence.EntityManager;
+import javax.persistence.NonUniqueResultException;
+import javax.persistence.Query;
+import javax.persistence.TypedQuery;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Order;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.beans.OperationStatus;
+import org.onap.so.db.request.beans.ResourceOperationStatus;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.requestsdb.RequestsDbConstant;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.data.domain.Example;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+
+@Repository
+@Transactional(readOnly = true)
+public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRepositoryCustom {
+
+ @Qualifier("requestEntityManagerFactory")
+ @Autowired
+ private EntityManager entityManager;
+
+ protected static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, InfraActiveRequestsRepositoryImpl.class);
+
+ protected static final String SOURCE = "source";
+ protected static final String START_TIME = "startTime";
+ protected static final String REQUEST_TYPE = "requestType";
+ protected static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
+ protected static final String SERVICE_INSTANCE_NAME = "serviceInstanceName";
+ protected static final String VNF_INSTANCE_NAME = "vnfName";
+ protected static final String VNF_INSTANCE_ID = "vnfId";
+ protected static final String VOLUME_GROUP_INSTANCE_NAME = "volumeGroupName";
+ protected static final String VOLUME_GROUP_INSTANCE_ID = "volumeGroupId";
+ protected static final String VFMODULE_INSTANCE_NAME = "vfModuleName";
+ protected static final String VFMODULE_INSTANCE_ID = "vfModuleId";
+ protected static final String NETWORK_INSTANCE_NAME = "networkName";
+ protected static final String CONFIGURATION_INSTANCE_ID = "configurationId";
+ protected static final String CONFIGURATION_INSTANCE_NAME= "configurationName";
+ protected static final String OPERATIONAL_ENV_ID = "operationalEnvId";
+ protected static final String OPERATIONAL_ENV_NAME = "operationalEnvName";
+ protected static final String NETWORK_INSTANCE_ID = "networkId";
+ protected static final String GLOBAL_SUBSCRIBER_ID = "globalSubscriberId";
+ protected static final String SERVICE_NAME_VERSION_ID = "serviceNameVersionId";
+ protected static final String SERVICE_ID = "serviceId";
+ protected static final String SERVICE_VERSION = "serviceVersion";
+ protected static final String REQUEST_ID = "requestId";
+ protected static final String REQUESTOR_ID = "requestorId";
+
+ @Autowired
+ private OperationStatusRepository operationStatusRepository;
+
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#healthCheck()
+ */
+ @Override
+ public boolean healthCheck () {
+
+ Query query = entityManager.createNativeQuery(" show tables ");
+
+ List<?> list = query.getResultList();
+
+ return true;
+ }
+
+ private List<InfraActiveRequests> executeInfraQuery (CriteriaQuery<InfraActiveRequests> crit, List <Predicate> predicates, Order order) {
+
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("Execute query on infra active request table");
+
+ List <InfraActiveRequests> results = new ArrayList<InfraActiveRequests>();
+
+ try {
+ CriteriaBuilder cb = entityManager.getCriteriaBuilder();
+ crit.where(cb.and(predicates.toArray(new Predicate[0])));
+ crit.orderBy(order);
+ results = entityManager.createQuery(crit).getResultList();
+
+ } finally {
+ msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "getInfraActiveRequest", null);
+ }
+ return results;
+ }
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestFromInfraActive(java.lang.String)
+ */
+ @Override
+ public InfraActiveRequests getRequestFromInfraActive (String requestId) {
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("Get request " + requestId + " from InfraActiveRequests DB");
+
+ InfraActiveRequests ar = null;
+ try {
+ Query query = entityManager.createQuery ("from InfraActiveRequests where requestId = :requestId OR clientRequestId = :requestId");
+ query.setParameter (REQUEST_ID, requestId);
+ ar = this.getSingleResult(query);
+ } finally {
+
+ msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "InfraRequestDB", "getRequestFromInfraActive", null);
+ }
+ return ar;
+ }
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkInstanceNameDuplicate(java.util.HashMap, java.lang.String, java.lang.String)
+ */
+ @Override
+ public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
+
+ List <Predicate> predicates = new LinkedList <> ();
+ CriteriaBuilder cb = entityManager.getCriteriaBuilder();
+ CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class);
+ Root<InfraActiveRequests> tableRoot = crit.from(InfraActiveRequests.class);
+
+ if(instanceName != null && !instanceName.equals("")) {
+
+ if("service".equals(requestScope)){
+ predicates.add (cb.equal(tableRoot.get(SERVICE_INSTANCE_NAME), instanceName));
+ } else if("vnf".equals(requestScope)){
+ predicates.add (cb.equal(tableRoot.get(VNF_INSTANCE_NAME), instanceName));
+ } else if("volumeGroup".equals(requestScope)){
+ predicates.add (cb.equal(tableRoot.get(VOLUME_GROUP_INSTANCE_NAME), instanceName));
+ } else if("vfModule".equals(requestScope)){
+ predicates.add (cb.equal(tableRoot.get(VFMODULE_INSTANCE_NAME), instanceName));
+ } else if("network".equals(requestScope)){
+ predicates.add (cb.equal(tableRoot.get(NETWORK_INSTANCE_NAME), instanceName));
+ } else if(requestScope.equals("configuration")) {
+ predicates.add (cb.equal(tableRoot.get(CONFIGURATION_INSTANCE_NAME), instanceName));
+ } else if(requestScope.equals("operationalEnvironment")) {
+ predicates.add (cb.equal(tableRoot.get(OPERATIONAL_ENV_NAME), instanceName));
+ }
+
+ } else {
+ if(instanceIdMap != null){
+ if("service".equals(requestScope) && instanceIdMap.get("serviceInstanceId") != null){
+ predicates.add (cb.equal(tableRoot.get(SERVICE_INSTANCE_ID), instanceIdMap.get("serviceInstanceId")));
+ }
+
+ if("vnf".equals(requestScope) && instanceIdMap.get("vnfInstanceId") != null){
+ predicates.add (cb.equal(tableRoot.get(VNF_INSTANCE_ID), instanceIdMap.get("vnfInstanceId" )));
+ }
+
+ if("vfModule".equals(requestScope) && instanceIdMap.get("vfModuleInstanceId") != null){
+ predicates.add (cb.equal(tableRoot.get(VFMODULE_INSTANCE_ID), instanceIdMap.get("vfModuleInstanceId")));
+ }
+
+ if("volumeGroup".equals(requestScope) && instanceIdMap.get("volumeGroupInstanceId") != null){
+ predicates.add (cb.equal(tableRoot.get(VOLUME_GROUP_INSTANCE_ID), instanceIdMap.get("volumeGroupInstanceId")));
+ }
+
+ if("network".equals(requestScope) && instanceIdMap.get("networkInstanceId") != null){
+ predicates.add (cb.equal(tableRoot.get(NETWORK_INSTANCE_ID), instanceIdMap.get("networkInstanceId")));
+ }
+
+ if(requestScope.equals("configuration") && instanceIdMap.get("configurationInstanceId") != null){
+ predicates.add (cb.equal(tableRoot.get(CONFIGURATION_INSTANCE_ID), instanceIdMap.get("configurationInstanceId")));
+ }
+
+ if(requestScope.equals("operationalEnvironment") && instanceIdMap.get("operationalEnvironmentId") != null) {
+ predicates.add (cb.equal(tableRoot.get(OPERATIONAL_ENV_ID), instanceIdMap.get("operationalEnvironmentId")));
+ }
+ }
+ }
+
+ predicates.add (tableRoot.get("requestStatus").in(Arrays.asList("PENDING", "IN_PROGRESS", "TIMEOUT", "PENDING_MANUAL_TASK")));
+
+ Order order = cb.desc(tableRoot.get(START_TIME));
+
+ List<InfraActiveRequests> dupList = executeInfraQuery(crit, predicates, order);
+
+ InfraActiveRequests infraActiveRequests = null;
+
+ if(dupList != null && !dupList.isEmpty()){
+ infraActiveRequests = dupList.get(0);
+ }
+
+ return infraActiveRequests;
+ }
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getOrchestrationFiltersFromInfraActive(java.util.Map)
+ */
+ @Override
+ public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive (Map<String, List<String>> orchestrationMap) {
+
+
+ List <Predicate> predicates = new LinkedList <> ();
+ CriteriaBuilder cb = entityManager.getCriteriaBuilder();
+ CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class);
+ Root<InfraActiveRequests> tableRoot = crit.from(InfraActiveRequests.class);
+ for (Map.Entry<String, List<String>> entry : orchestrationMap.entrySet())
+ {
+ String mapKey = entry.getKey();
+ if("serviceInstanceId".equalsIgnoreCase(mapKey)) {
+ mapKey = "serviceInstanceId";
+ } else if("serviceInstanceName".equalsIgnoreCase(mapKey)) {
+ mapKey = "serviceInstanceName";
+ } else if("vnfInstanceId".equalsIgnoreCase(mapKey)){
+ mapKey = "vnfId";
+ } else if("vnfInstanceName".equalsIgnoreCase(mapKey)) {
+ mapKey = "vnfName";
+ } else if("vfModuleInstanceId".equalsIgnoreCase(mapKey)) {
+ mapKey = "vfModuleId";
+ } else if("vfModuleInstanceName".equalsIgnoreCase(mapKey)) {
+ mapKey = "vfModuleName";
+ } else if("volumeGroupInstanceId".equalsIgnoreCase(mapKey)) {
+ mapKey = "volumeGroupId";
+ } else if("volumeGroupInstanceName".equalsIgnoreCase(mapKey)) {
+ mapKey = "volumeGroupName";
+ } else if("networkInstanceId".equalsIgnoreCase(mapKey)) {
+ mapKey = "networkId";
+ } else if("networkInstanceName".equalsIgnoreCase(mapKey)) {
+ mapKey = "networkName";
+ } else if(mapKey.equalsIgnoreCase("configurationInstanceId")) {
+ mapKey = "configurationId";
+ } else if(mapKey.equalsIgnoreCase("configurationInstanceName")) {
+ mapKey = "configurationName";
+ } else if("lcpCloudRegionId".equalsIgnoreCase(mapKey)) {
+ mapKey = "aicCloudRegion";
+ } else if("tenantId".equalsIgnoreCase(mapKey)) {
+ mapKey = "tenantId";
+ } else if("modelType".equalsIgnoreCase(mapKey)) {
+ mapKey = "requestScope";
+ } else if("requestorId".equalsIgnoreCase(mapKey)) {
+ mapKey = "requestorId";
+ } else if("requestExecutionDate".equalsIgnoreCase(mapKey)) {
+ mapKey = "startTime";
+ }
+
+ String propertyValue = entry.getValue().get(1);
+ if ("startTime".equals(mapKey)) {
+ SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy");
+ try {
+ Date thisDate = format.parse(propertyValue);
+ Timestamp minTime = new Timestamp(thisDate.getTime());
+ Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1));
+
+ if("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) {
+ predicates.add(cb.or(cb.lessThan(tableRoot.get(mapKey), minTime), cb.greaterThanOrEqualTo(tableRoot.get(mapKey), maxTime)));
+ } else {
+ predicates.add(cb.between(tableRoot.get(mapKey), minTime, maxTime));
+ }
+ }
+ catch (Exception e){
+ msoLogger.debug("Exception in getOrchestrationFiltersFromInfraActive(): + " + e.getMessage(), e);
+ return null;
+ }
+ }
+ else if("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) {
+ predicates.add(cb.notEqual(tableRoot.get(mapKey), propertyValue));
+ } else {
+ predicates.add(cb.equal(tableRoot.get(mapKey), propertyValue));
+ }
+
+ }
+
+ Order order = cb.asc(tableRoot.get(START_TIME));
+
+ return executeInfraQuery (crit, predicates, order);
+ }
+
+ // Added this method for Tenant Isolation project ( 1802-295491a) to query the mso_requests DB
+ // (infra_active_requests table) for operationalEnvId and OperationalEnvName
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getCloudOrchestrationFiltersFromInfraActive(java.util.Map)
+ */
+ @Override
+ public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive (Map<String, String> orchestrationMap) {
+ List <Predicate> predicates = new LinkedList <> ();
+ CriteriaBuilder cb = entityManager.getCriteriaBuilder();
+ CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class);
+ Root<InfraActiveRequests> tableRoot = crit.from(InfraActiveRequests.class);
+
+ // Add criteria on OperationalEnvironment RequestScope when requestorId is only specified in the filter
+ // as the same requestorId can also match on different API methods
+ String resourceType = orchestrationMap.get("resourceType");
+ if(resourceType == null) {
+ predicates.add(cb.equal(tableRoot.get("requestScope"), "operationalEnvironment"));
+ }
+
+ for (Map.Entry<String, String> entry : orchestrationMap.entrySet()) {
+ String mapKey = entry.getKey();
+ if(mapKey.equalsIgnoreCase("requestorId")) {
+ mapKey = "requestorId";
+ } else if(mapKey.equalsIgnoreCase("requestExecutionDate")) {
+ mapKey = "startTime";
+ } else if(mapKey.equalsIgnoreCase("operationalEnvironmentId")) {
+ mapKey = "operationalEnvId";
+ } else if(mapKey.equalsIgnoreCase("operationalEnvironmentName")) {
+ mapKey = "operationalEnvName";
+ } else if(mapKey.equalsIgnoreCase("resourceType")) {
+ mapKey = "requestScope";
+ }
+
+ String propertyValue = entry.getValue();
+ if (mapKey.equals("startTime")) {
+ SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy");
+ try {
+ Date thisDate = format.parse(propertyValue);
+ Timestamp minTime = new Timestamp(thisDate.getTime());
+ Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1));
+
+ predicates.add(cb.between(tableRoot.get(mapKey), minTime, maxTime));
+ }
+ catch (Exception e){
+ msoLogger.debug("Exception in getCloudOrchestrationFiltersFromInfraActive(): + " + e.getMessage());
+ return null;
+ }
+ } else {
+ predicates.add(cb.equal(tableRoot.get(mapKey), propertyValue));
+ }
+ }
+
+ Order order = cb.asc(tableRoot.get(START_TIME));
+ return executeInfraQuery (crit, predicates, order);
+ }
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestListFromInfraActive(java.lang.String, java.lang.String, java.lang.String)
+ */
+ @Override
+ public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
+ String queryValue,
+ String requestType) {
+ msoLogger.debug ("Get list of infra requests from DB with " + queryAttributeName + " = " + queryValue);
+
+
+ try {
+ CriteriaBuilder cb = entityManager.getCriteriaBuilder();
+ CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class);
+ Root<InfraActiveRequests> candidateRoot = crit.from(InfraActiveRequests.class);
+ Predicate isEqual = cb.equal(candidateRoot.get(queryAttributeName), queryValue);
+ Predicate equalRequestType = cb.equal(candidateRoot.get(REQUEST_TYPE), requestType);
+ Predicate isNull = cb.isNull(candidateRoot.get(REQUEST_TYPE));
+ Predicate orClause = cb.or(equalRequestType, isNull);
+ Order orderDesc = cb.desc(candidateRoot.get(START_TIME));
+ Order orderAsc = cb.asc(candidateRoot.get(SOURCE));
+ crit.where(cb.and(isEqual, orClause)).orderBy(orderDesc, orderAsc);
+
+ @SuppressWarnings("unchecked")
+ List <InfraActiveRequests> arList = entityManager.createQuery(crit).getResultList();
+ if (arList != null && !arList.isEmpty ()) {
+ return arList;
+ }
+ } finally {
+ // msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "getRequestListFromInfraActive", null);
+ }
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestFromInfraActive(java.lang.String, java.lang.String)
+ */
+ @Override
+ public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) {
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("Get infra request from DB with id " + requestId);
+
+ InfraActiveRequests ar = null;
+ try {
+ Query query = entityManager.createQuery ("from InfraActiveRequests where (requestId = :requestId OR clientRequestId = :requestId) and requestType = :requestType");
+ query.setParameter (REQUEST_ID, requestId);
+ query.setParameter (REQUEST_TYPE, requestType);
+ ar = this.getSingleResult(query);
+ } finally {
+ msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "getRequestFromInfraActive", null);
+ }
+ return ar;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkDuplicateByVnfName(java.lang.String, java.lang.String, java.lang.String)
+ */
+ @Override
+ public InfraActiveRequests checkDuplicateByVnfName (String vnfName, String action, String requestType) {
+
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("Get infra request from DB for VNF " + vnfName + " and action " + action + " and requestType " + requestType);
+
+ InfraActiveRequests ar = null;
+ try {
+ Query query = entityManager.createQuery ("from InfraActiveRequests where vnfName = :vnfName and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC");
+ query.setParameter ("vnfName", vnfName);
+ query.setParameter ("action", action);
+ query.setParameter (REQUEST_TYPE, requestType);
+ @SuppressWarnings("unchecked")
+ List <InfraActiveRequests> results = query.getResultList();
+ if (!results.isEmpty ()) {
+ ar = results.get (0);
+ }
+ } finally {
+ msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "checkDuplicateByVnfName", null);
+ }
+
+ return ar;
+ }
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkDuplicateByVnfId(java.lang.String, java.lang.String, java.lang.String)
+ */
+ @Override
+ public InfraActiveRequests checkDuplicateByVnfId (String vnfId, String action, String requestType) {
+
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("Get list of infra requests from DB for VNF " + vnfId + " and action " + action);
+
+ InfraActiveRequests ar = null;
+ try {
+ Query query = entityManager.createQuery ("from InfraActiveRequests where vnfId = :vnfId and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC");
+ query.setParameter ("vnfId", vnfId);
+ query.setParameter ("action", action);
+ query.setParameter (REQUEST_TYPE, requestType);
+ @SuppressWarnings("unchecked")
+ List <InfraActiveRequests> results = query.getResultList();
+ if (!results.isEmpty ()) {
+ ar = results.get (0);
+ }
+ } finally {
+ msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "checkDuplicateByVnfId", null);
+ }
+
+ return ar;
+ }
+
+ /**
+ * update service operation status when a operation resource status updated
+ * <br>
+ *
+ * @param operStatus the resource operation status
+ * @since ONAP Amsterdam Release
+ */
+ private void updateOperationStatusBasedOnResourceStatus(ResourceOperationStatus operStatus) {
+ long startTime = System.currentTimeMillis();
+ msoLogger.debug("Request database - query Resource Operation Status with service Id:"
+ + operStatus.getServiceId() + ", operationId:" + operStatus.getOperationId());
+ try {
+ // query all resources of the service
+ String hql = "FROM ResourceOperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id";
+ Query query = entityManager.createQuery(hql);
+ query.setParameter("service_id", operStatus.getServiceId());
+ query.setParameter("operation_id", operStatus.getOperationId());
+ @SuppressWarnings("unchecked")
+ List<ResourceOperationStatus> lstResourceStatus = (List<ResourceOperationStatus>)query.getResultList();
+ // count the total progress
+ int resourceCount = lstResourceStatus.size();
+ int progress = 0;
+ boolean isFinished = true;
+ for(int i = 0; i < resourceCount; i++) {
+ progress = progress + Integer.valueOf(lstResourceStatus.get(i).getProgress()) / resourceCount;
+ if(RequestsDbConstant.Status.PROCESSING.equals(lstResourceStatus.get(i).getStatus())) {
+ isFinished = false;
+ }
+ }
+
+ OperationStatus serviceOperStatus = new OperationStatus(operStatus.getServiceId(), operStatus.getOperationId());
+ serviceOperStatus = operationStatusRepository.findOne(Example.of(serviceOperStatus));
+ progress = progress > 100 ? 100 : progress;
+ serviceOperStatus.setProgress(String.valueOf(progress));
+ serviceOperStatus.setOperationContent(operStatus.getStatusDescription());
+ // if current resource failed. service failed.
+ if(RequestsDbConstant.Status.ERROR.equals(operStatus.getStatus())) {
+ serviceOperStatus.setResult(RequestsDbConstant.Status.ERROR);
+ serviceOperStatus.setReason(operStatus.getStatusDescription());
+ } else if(isFinished) {
+ // if finished
+ serviceOperStatus.setResult(RequestsDbConstant.Status.FINISHED);
+ serviceOperStatus.setProgress(RequestsDbConstant.Progress.ONE_HUNDRED);
+ }
+ operationStatusRepository.save(serviceOperStatus);
+ } finally {
+ msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "Successfully", "RequestDB", "updateResOperStatus", null);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkVnfIdStatus(java.lang.String)
+ */
+ @Override
+ public InfraActiveRequests checkVnfIdStatus(String operationalEnvironmentId) {
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("Get Infra request from DB for OperationalEnvironmentId " + operationalEnvironmentId);
+
+ InfraActiveRequests ar = null;
+ try {
+ CriteriaBuilder cb = entityManager.getCriteriaBuilder();
+ CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class);
+ Root<InfraActiveRequests> candidateRoot = crit.from(InfraActiveRequests.class);
+ Predicate operationalEnvEq = cb.equal(candidateRoot.get("operationalEnvId"), operationalEnvironmentId);
+ Predicate requestStatusNotEq = cb.notEqual(candidateRoot.get("requestStatus"), "COMPLETE");
+ Predicate actionEq = cb.equal(candidateRoot.get("action"), "create");
+ Order startTimeOrder = cb.desc(candidateRoot.get("startTime"));
+ crit.select(candidateRoot);
+ crit.where(cb.and(operationalEnvEq, requestStatusNotEq, actionEq));
+ crit.orderBy(startTimeOrder);
+ TypedQuery<InfraActiveRequests> query = entityManager.createQuery(crit);
+ @SuppressWarnings("unchecked")
+ List <InfraActiveRequests> results = query.getResultList();
+ if (!results.isEmpty ()) {
+ ar = results.get (0);
+ }
+ } finally {
+ msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "checkDuplicateByVnfName", null);
+ }
+
+ return ar;
+ }
+
+ protected <T> T getSingleResult(Query query) {
+ query.setMaxResults(1);
+ List<T> list = query.getResultList();
+ if (list == null || list.isEmpty()) {
+ return null;
+ } else if (list.size() == 1) {
+ return list.get(0);
+ } else {
+ throw new NonUniqueResultException();
+ }
+
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java
new file mode 100644
index 0000000000..c51e4edcea
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.data.repository;
+
+import org.onap.so.db.request.beans.OperationStatus;
+import org.onap.so.db.request.beans.OperationStatusId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface OperationStatusRepository extends JpaRepository<OperationStatus, OperationStatusId> {
+
+ OperationStatus findOneByServiceIdAndOperationId(String serviceId, String operationId);
+ public OperationStatus findOneByServiceName(String serviceName);
+ public OperationStatus findOneByServiceId(String serviceId);
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java
new file mode 100644
index 0000000000..799e5ad147
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.data.repository;
+
+import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+public interface OperationalEnvDistributionStatusRepository extends JpaRepository<OperationalEnvDistributionStatus, String> {
+
+ @Modifying
+ @Transactional
+ @Query("update OperationalEnvDistributionStatus set distributionIdStatus = :distributionIdStatus where "
+ + "distributionId = :distributionId and operationalEnvId = :operationalEnvId and serviceModelVersionId = :serviceModelVersionId")
+ public int setDistributionIdStatus(@Param("distributionIdStatus") String distributionIdStatus,
+ @Param("distributionId") String distributionId,
+ @Param("operationalEnvId") String operationalEnvId,
+ @Param("serviceModelVersionId") String serviceModelVersionId);
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java
new file mode 100644
index 0000000000..ee2baedf61
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.data.repository;
+
+import java.util.List;
+
+import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
+import org.onap.so.db.request.beans.OperationalEnvServiceModelStatusId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository
+public interface OperationalEnvServiceModelStatusRepository extends JpaRepository<OperationalEnvServiceModelStatus, OperationalEnvServiceModelStatusId>{
+
+ public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndRequestId(String operationalEnvId, String requestId);
+ public List<OperationalEnvServiceModelStatus> findAllByOperationalEnvIdAndRequestId(String operationalEnvId, String requestId);
+ public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionId(String operationalEnvId, String serviceModelVersionId);
+
+ @Modifying
+ @Transactional
+ @Query("update OperationalEnvServiceModelStatus set serviceModelVersionDistrStatus = :asdcStatus, retryCount = :retryCount where "
+ + "operationalEnvId = :operationalEnvId and serviceModelVersionId = :serviceModelVersionId")
+ public int setServiceModelVersionDistrStatusAndRetryCountFor(@Param("asdcStatus") String serviceModelVersionDistrStatus,
+ @Param("retryCount") int retryCount,
+ @Param("operationalEnvId") String operationalEnvId,
+ @Param("serviceModelVersionId") String serviceModelVersionId);
+
+ @Modifying
+ @Transactional
+ @Query("update OperationalEnvServiceModelStatus set serviceModelVersionDistrStatus = :asdcStatus, retryCount = :retryCount where "
+ + "operationalEnvId = :operationalEnvId and serviceModelVersionId = :serviceModelVersionId and requestId = :requestId")
+ public int setServiceModelVersionDistrStatusAndRetryCountFor(@Param("asdcStatus") String serviceModelVersionDistrStatus,
+ @Param("retryCount") int retryCount,
+ @Param("operationalEnvId") String operationalEnvId,
+ @Param("serviceModelVersionId") String serviceModelVersionId,
+ @Param("requestId") String requestId);
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java
new file mode 100644
index 0000000000..2d77f7589e
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.data.repository;
+
+import java.util.List;
+
+import org.onap.so.db.request.beans.ResourceOperationStatus;
+import org.onap.so.db.request.beans.ResourceOperationStatusId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface ResourceOperationStatusRepository extends JpaRepository<ResourceOperationStatus, ResourceOperationStatusId> {
+
+ List<ResourceOperationStatus> findByServiceIdAndOperationId(String serviceId, String operationId);
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraActiveRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java
index 1d62efb18d..11923512a5 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraActiveRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java
@@ -18,24 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.requestsdb;
+package org.onap.so.db.request.data.repository;
+import org.onap.so.db.request.beans.SiteStatus;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
-/**
- * InfraActiveRequests
- */
-public class InfraActiveRequests extends InfraRequests {
-
- /**
- * Serialization id.
- */
- private static final long serialVersionUID = 5003555140088137254L;
-
- public InfraActiveRequests() {
- super ();
- }
+@Repository
+public interface SiteStatusRepository extends JpaRepository<SiteStatus, String> {
+ SiteStatus findOneBySiteName(String siteName);
- public InfraActiveRequests(String requestId, String action) {
- super (requestId, action);
- }
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java
new file mode 100644
index 0000000000..8310d79a5b
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.data.repository;
+
+import java.util.List;
+
+import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
+import org.onap.so.db.request.beans.WatchdogComponentDistributionStatusId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface WatchdogComponentDistributionStatusRepository extends JpaRepository<WatchdogComponentDistributionStatus, WatchdogComponentDistributionStatusId> {
+
+ public List<WatchdogComponentDistributionStatus> findByDistributionId(String distributionId);
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java
new file mode 100644
index 0000000000..6e37181380
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.data.repository;
+
+import org.onap.so.db.request.beans.WatchdogDistributionStatus;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface WatchdogDistributionStatusRepository extends JpaRepository<WatchdogDistributionStatus, String> {
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java
new file mode 100644
index 0000000000..b83481b88b
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.db.request.data.repository;
+
+import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup;
+import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookupId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface WatchdogServiceModVerIdLookupRepository extends JpaRepository<WatchdogServiceModVerIdLookup, WatchdogServiceModVerIdLookupId> {
+
+ public WatchdogServiceModVerIdLookup findOneByDistributionId(String distributionId);
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDBHelper.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java
index 29e55b8042..6eb00ea1e9 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDBHelper.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.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.
@@ -18,54 +18,90 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.requestsdb;
-
-import org.openecomp.mso.logger.MsoLogger;
-
-public class RequestsDBHelper {
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
- private String className = this.getClass().getSimpleName() +" class\'s ";
- private String methodName = "";
- private String classMethodMessage = "";
-
- /**
- * This util method is to update the InfraRequest table to Complete
- * @param msg - string, unique message for each caller
- * @param requestId - string
- * @param operationalEnvironmentId - string
- * @return void - nothing
- * @throws Exception
- */
- public void updateInfraSuccessCompletion(String msg, String requestId, String operationalEnvironmentId) {
- methodName = "updateInfraSuccessCompletion() method.";
- classMethodMessage = className + " " + methodName;
- msoLogger.debug("Begin of " + classMethodMessage);
-
- RequestsDatabase requestDB = RequestsDatabase.getInstance();
- requestDB.updateInfraFinalStatus(requestId, "COMPLETE", "SUCCESSFUL, operationalEnvironmentId - " + operationalEnvironmentId + "; Success Message: " + msg,
- 100L, null, "APIH");
- msoLogger.debug("End of " + classMethodMessage);
-
- }
-
- /**
- * This util method is to update the InfraRequest table to Failure
- * @param msg - string, unique message for each caller
- * @param requestId - string
- * @param operationalEnvironmentId - string
- * @return void - nothing
- * @throws Exception
- */
- public void updateInfraFailureCompletion(String msg, String requestId, String operationalEnvironmentId) {
- methodName = "updateInfraFailureCompletion() method.";
- classMethodMessage = className + " " + methodName;
- msoLogger.debug("Begin of " + classMethodMessage);
-
- RequestsDatabase requestDB = RequestsDatabase.getInstance();
- requestDB.updateInfraFinalStatus(requestId, "FAILED", "FAILURE, operationalEnvironmentId - " + operationalEnvironmentId + "; Error message: " + msg,
- 100L, null, "APIH");
- msoLogger.debug("End of " + classMethodMessage);
-
- }
-}
+package org.onap.so.requestsdb;
+
+import java.sql.Timestamp;
+
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RequestsDBHelper {
+
+ private static final String UNKNOWN = "UNKNOWN";
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, RequestsDBHelper.class);
+ private String className = this.getClass().getSimpleName() +" class\'s ";
+ private String methodName = "";
+ private String classMethodMessage = "";
+ @Autowired
+ private InfraActiveRequestsRepository infraActiveRequestsRepository;
+ /**
+ * This util method is to update the InfraRequest table to Complete
+ * @param msg - string, unique message for each caller
+ * @param requestId - string
+ * @param operationalEnvironmentId - string
+ * @return void - nothing
+ * @throws Exception
+ */
+ public void updateInfraSuccessCompletion(String msg, String requestId, String operationalEnvironmentId) {
+ methodName = "updateInfraSuccessCompletion() method.";
+ classMethodMessage = className + " " + methodName;
+ msoLogger.debug("Begin of " + classMethodMessage);
+
+ InfraActiveRequests request = infraActiveRequestsRepository.findOneByRequestId(requestId);
+
+ request.setRequestStatus("COMPLETE");
+ request.setStatusMessage("SUCCESSFUL, operationalEnvironmentId - " + operationalEnvironmentId + "; Success Message: " + msg);
+ request.setProgress(100L);
+ request.setLastModifiedBy("APIH");
+ request.setOperationalEnvId(operationalEnvironmentId);
+ if(request.getAction() == null){
+ request.setRequestAction(UNKNOWN);
+ }
+ if(request.getRequestScope() == null){
+ request.setRequestScope(UNKNOWN);
+ }
+ Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
+ request.setEndTime(endTimeStamp);
+ infraActiveRequestsRepository.save(request);
+
+ msoLogger.debug("End of " + classMethodMessage);
+
+ }
+
+ /**
+ * This util method is to update the InfraRequest table to Failure
+ * @param msg - string, unique message for each caller
+ * @param requestId - string
+ * @param operationalEnvironmentId - string
+ * @return void - nothing
+ * @throws Exception
+ */
+ public void updateInfraFailureCompletion(String msg, String requestId, String operationalEnvironmentId) {
+ methodName = "updateInfraFailureCompletion() method.";
+ classMethodMessage = className + " " + methodName;
+ msoLogger.debug("Begin of " + classMethodMessage);
+
+ InfraActiveRequests request = infraActiveRequestsRepository.findOneByRequestId(requestId);
+ request.setRequestStatus("FAILED");
+ request.setStatusMessage("FAILURE, operationalEnvironmentId - " + operationalEnvironmentId + "; Error message: " + msg);
+ request.setProgress(100L);
+ request.setLastModifiedBy("APIH");
+ request.setOperationalEnvId(operationalEnvironmentId);
+ if(request.getAction() == null){
+ request.setRequestAction(UNKNOWN);
+ }
+ if(request.getRequestScope() == null){
+ request.setRequestScope(UNKNOWN);
+ }
+ Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
+ request.setEndTime(endTimeStamp);
+ infraActiveRequestsRepository.save(request);
+
+ msoLogger.debug("End of " + classMethodMessage);
+
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbConstant.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDbConstant.java
index 18e51cef16..60bad3791c 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbConstant.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDbConstant.java
@@ -1,65 +1,66 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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;
-
-/**
- * The constants of the request db
- * <br>
- * <p>
- * </p>
- *
- * @author
- * @version ONAP Amsterdam Release 2017-08-28
- */
-public class RequestsDbConstant {
-
- public static class Progress {
-
- public static final String ONE_HUNDRED = "100";
-
- private Progress() {
-
- }
- }
-
- public static class Status {
-
- public static final String FINISHED = "finished";
-
- public static final String PROCESSING = "processing";
-
- public static final String ERROR = "error";
-
- private Status() {
-
- }
- }
-
- public static class OperationType {
-
- public static final String CREATE = "create";
-
- public static final String DELETE = "delete";
-
- private OperationType() {
-
- }
- }
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.onap.so.requestsdb;
+
+/**
+ * The constants of the request db
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-08-28
+ */
+public class RequestsDbConstant {
+
+ public static class Progress {
+
+ public static final String ONE_HUNDRED = "100";
+
+ private Progress() {
+
+ }
+ }
+
+ public static class Status {
+
+ public static final String FINISHED = "finished";
+
+ public static final String PROCESSING = "processing";
+
+ public static final String ERROR = "error";
+
+ private Status() {
+
+ }
+ }
+
+ public static class OperationType {
+
+ public static final String CREATE = "create";
+
+ public static final String DELETE = "delete";
+
+ private OperationType() {
+
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/adapter/TimestampXMLAdapter.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/adapter/TimestampXMLAdapter.java
index 37ea2924a3..1cde1aac51 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/adapter/TimestampXMLAdapter.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/adapter/TimestampXMLAdapter.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.requestsdb.adapter;
+package org.onap.so.requestsdb.adapter;
import java.sql.Timestamp;
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java
deleted file mode 100644
index c88f31c819..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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 java.util.HashMap;
-import java.util.Map;
-
-public class MockRequestsDatabase {
-
- private Map<String, InfraActiveRequests> activeRequests;
-
- public MockRequestsDatabase() {
- activeRequests = new HashMap<>();
- }
-
- public void addRecord(InfraActiveRequests record) {
- String serviceType = record.getServiceType();
- String serviceInstanceId = record.getServiceInstanceId();
- String key = serviceType + "::" + serviceInstanceId;
- activeRequests.put(key, record);
- }
-
- public void deleteRecord(String serviceType, String serviceInstanceId) {
- String key = serviceType + "::" + serviceInstanceId;
- activeRequests.remove(key);
- }
-
- public InfraActiveRequests getRecord(String serviceType, String serviceInstanceId) {
- String key = serviceType + "::" + serviceInstanceId;
- InfraActiveRequests record = activeRequests.get(key);
- return record;
- }
-
- public InfraActiveRequests checkDuplicate(String serviceType, String serviceInstanceId) {
- return getRecord(serviceType, serviceInstanceId);
- }
-
- public InfraActiveRequests checkRetry(String serviceType, String serviceInstanceId) {
- InfraActiveRequests record = getRecord(serviceType, serviceInstanceId);
- InfraActiveRequests returnRecord = null;
- if (record != null) {
- String requestAction = record.getRequestAction();
- if (!"GetLayer3ServiceDetailsRequest".equals(requestAction)) {
- String status = record.getRequestStatus();
- if ("COMPLETED".equals(status)) {
- returnRecord = record;
- }
- }
- }
- return returnRecord;
- }
-}
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
deleted file mode 100644
index f61b2729e8..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationStatus.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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 java.io.Serializable;
-import java.sql.Timestamp;
-
-/**
- * The service operation status
- * <br>
- * <p>
- * </p>
- *
- * @author
- * @version ONAP Amsterdam Release 2017-08-28
- */
-public class OperationStatus implements Serializable{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private String serviceId = null;
-
- private String operationId = null;
-
- private String serviceName = null;
-
- private String operation = null;
-
- private String userId = null;
-
- private String result = null;
-
- private String operationContent = null;
-
- private String progress = "0";
-
- private String reason = null;
-
- private Timestamp operateAt = null;
-
- private Timestamp finishedAt = null;
-
-
- public String getServiceId() {
- return serviceId;
- }
-
-
- public void setServiceId(String serviceId) {
- this.serviceId = serviceId;
- }
-
-
- public String getOperationId() {
- return operationId;
- }
-
-
- public void setOperationId(String operationId) {
- this.operationId = operationId;
- }
-
-
- public String getOperation() {
- return operation;
- }
-
-
- public void setOperation(String operation) {
- this.operation = operation;
- }
-
-
- public String getUserId() {
- return userId;
- }
-
-
- public void setUserId(String userId) {
- this.userId = userId;
- }
-
-
- public String getResult() {
- return result;
- }
-
-
- public void setResult(String result) {
- this.result = result;
- }
-
-
- public String getOperationContent() {
- return operationContent;
- }
-
-
- public void setOperationContent(String operationContent) {
- this.operationContent = operationContent;
- }
-
-
- public String getProgress() {
- return progress;
- }
-
-
- public void setProgress(String progress) {
- this.progress = progress;
- }
-
-
- public String getReason() {
- return reason;
- }
-
-
- public void setReason(String reason) {
- this.reason = reason;
- }
-
-
- public Timestamp getOperateAt() {
- return operateAt;
- }
-
-
- public void setOperateAt(Timestamp operateAt) {
- this.operateAt = operateAt;
- }
-
-
- public Timestamp getFinishedAt() {
- return finishedAt;
- }
-
-
- public void setFinishedAt(Timestamp finishedAt) {
- this.finishedAt = finishedAt;
- }
-
-
-
- /**
- * @return Returns the serviceName.
- */
- public String getServiceName() {
- return serviceName;
- }
-
-
-
- /**
- * @param serviceName The serviceName to set.
- */
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
-
- /**
- * <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/OperationalEnvDistributionStatusDb.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusDb.java
deleted file mode 100644
index ce2e1f6906..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvDistributionStatusDb.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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 java.sql.Timestamp;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-public class OperationalEnvDistributionStatusDb {
-
- protected final AbstractSessionFactoryManager sessionFactoryRequestDB;
-
- protected static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
-
-
- protected static final String DISTRIBUTION_ID = "distributionId";
- protected static final String OPERATIONAL_ENV_ID = "operationalEnvId";
- protected static final String REQUEST_ID = "requestId";
- protected static final String SERVICE_MODEL_VERSION_ID = "serviceModelVersionId";
- protected static final String DISTRIBUTION_ID_STATUS = "distributionIdStatus";
- protected static final String CREATE_TIME = "startTime";
- protected static final String MODIFY_TIME = "modifyTime";
-
-
- public static OperationalEnvDistributionStatusDb getInstance() {
- return new OperationalEnvDistributionStatusDb(new RequestsDbSessionFactoryManager ());
- }
-
- protected OperationalEnvDistributionStatusDb (AbstractSessionFactoryManager sessionFactoryRequest) {
- sessionFactoryRequestDB = sessionFactoryRequest;
- }
-
-
- /**
- * Retrieve OperationalEnvDistributionStatus from getSecgiven distributionId
- * @param distributionId
- * @return
- */
- public OperationalEnvDistributionStatus getOperationalEnvDistributionStatus(String distributionId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Retrieve Operational Environment Distribution Status with distributionId: " + distributionId);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- OperationalEnvDistributionStatus request = null;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("from OperationalEnvDistributionStatus where distributionId = :distributionId");
- query.setParameter (DISTRIBUTION_ID, distributionId);
- request = (OperationalEnvDistributionStatus) query.uniqueResult ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "OperationalEnvDistributionStatus", "getOperationalEnvDistributionStatus", null);
- }
- return request;
- }
-
- /**
- * Retrieve OperationalEnvDistributionStatus from given distributionId and requestId
- * @param distributionId
- * @param requestId
- * @return OperationalEnvDistributionStatus
- */
- public OperationalEnvDistributionStatus getOperationalEnvDistributionStatusPerReqId(String distributionId, String requestId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Retrieve Operational Environment Distribution Status with distributionId: " + distributionId + ", requestId: " + requestId);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- OperationalEnvDistributionStatus request = null;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("from OperationalEnvDistributionStatus where distributionId = :distributionId AND requestId = :requestId");
- query.setParameter (DISTRIBUTION_ID, distributionId);
- query.setParameter (REQUEST_ID, requestId);
- request = (OperationalEnvDistributionStatus) query.uniqueResult ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "OperationalEnvDistributionStatus", "getOperationalEnvDistributionStatusPerReqId", null);
- }
- return request;
- }
-
- /**
- * Update OperationalEnvDistributionStatus with distributionIdStatus for given distributionId, serviceModelVersionId, serviceModelVersionId
- * @param asdcStatus
- * @param distributionId
- * @param operationalEnvId
- * @param serviceModelVersionId
- */
- public int updateOperationalEnvDistributionStatus(String asdcStatus, String distributionId,
- String operationalEnvId, String serviceModelVersionId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Update OperationalEnvDistributionStatus DISTRIBUTION_ID_STATUS with asdcStatus: " + asdcStatus);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- int result = 0;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("update OperationalEnvDistributionStatus set distributionIdStatus = :distributionIdStatus, modifyTime = :modifyTime where distributionId = :distributionId and "
- + "operationalEnvId = :operationalEnvId and serviceModelVersionId = :serviceModelVersionId ");
- query.setParameter (DISTRIBUTION_ID_STATUS, asdcStatus);
- query.setParameter ("distributionId", distributionId);
- query.setParameter ("operationalEnvId", operationalEnvId);
- query.setParameter ("serviceModelVersionId", serviceModelVersionId);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- query.setParameter ("modifyTime", modifyTimeStamp);
- result = query.executeUpdate ();
- session.getTransaction ().commit ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "updateOperationalEnvDistributionStatus", null);
- }
- return result;
- }
-
- /**
- * Insert into OperationalEnvDistributionStatus with distributionId, operationalEnvId, serviceModelVersionId, distributionIdStatus
- * @param distributionId
- * @param operationalEnvId
- * @param serviceModelVersionId
- * @param distributionIdStatus
- */
- public void insertOperationalEnvDistributionStatus(String distributionId, String operationalEnvId, String serviceModelVersionId,
- String distributionIdStatus, String requestId) {
- long startTime = System.currentTimeMillis ();
- Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
- msoLogger.debug ("Insert into OperationalEnvDistributionStatus " );
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- OperationalEnvDistributionStatus oed = new OperationalEnvDistributionStatus ();
-
- try {
- session.beginTransaction ();
-
- oed.setDistributionId (distributionId);
- oed.setOperationalEnvId (operationalEnvId);
- oed.setServiceModelVersionId (serviceModelVersionId);
- oed.setDistributionIdStatus (distributionIdStatus);
- oed.setRequestId(requestId);
- oed.setCreateTime (startTimeStamp);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- oed.setModifyTime (modifyTimeStamp);
-
- msoLogger.debug ("About to insert a record into OperationalEnvDistributionStatus");
-
- session.save (oed);
- session.getTransaction ().commit ();
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in insertOperationalEnvDistributionStatus", e);
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, e.getMessage (), "OperationalEnvDistributionStatusDB", "saveRequest", null);
- if (session != null) {
- session.close ();
- }
- // throw an Exception in the event of a DB insert failure so that the calling routine can exit
- throw e;
- }
- finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "OperationalEnvDistributionStatusDB", "insertOperationalEnvDistributionStatus", null);
- }
- }
-
-
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatus.java
deleted file mode 100644
index fe581de71b..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatus.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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 java.io.Serializable;
-import java.sql.Timestamp;
-
-/**
- * @author PB6115
- *
- */
-public class OperationalEnvServiceModelStatus implements Serializable {
-
- /**
- * Serialization id.
- */
- private static final long serialVersionUID = 8197084996598869656L;
-
- private String requestId = null;
- private String operationalEnvId = null;
- private String serviceModelVersionId = null;
- private String serviceModelVersionDistrStatus = null;
- private String recoveryAction = null;
- private int retryCount;
- private String workloadContext = null;
- private Timestamp createTime = null;
- private Timestamp modifyTime = null;
-
- public String getRequestId() {
- return requestId;
- }
-
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- public String getOperationalEnvId() {
- return operationalEnvId;
- }
-
- public void setOperationalEnvId(String operationalEnvId) {
- this.operationalEnvId = operationalEnvId;
- }
-
- public String getServiceModelVersionId() {
- return serviceModelVersionId;
- }
-
- public void setServiceModelVersionId(String serviceModelVersionId) {
- this.serviceModelVersionId = serviceModelVersionId;
- }
-
- public String getServiceModelVersionDistrStatus() {
- return serviceModelVersionDistrStatus;
- }
-
- public void setServiceModelVersionDistrStatus(String serviceModelVersionDistrStatus) {
- this.serviceModelVersionDistrStatus = serviceModelVersionDistrStatus;
- }
-
- public String getRecoveryAction() {
- return recoveryAction;
- }
-
- public void setRecoveryAction(String recoveryAction) {
- this.recoveryAction = recoveryAction;
- }
-
- public int getRetryCount() {
- return retryCount;
- }
-
- public void setRetryCount(int retryCount) {
- this.retryCount = retryCount;
- }
-
- public String getWorkloadContext() {
- return workloadContext;
- }
-
- public void setWorkloadContext(String workloadContext) {
- this.workloadContext = workloadContext;
- }
-
- public Timestamp getCreateTime() {
- return createTime;
- }
- public void setCreateTime(Timestamp createTime) {
- this.createTime = createTime;
- }
-
- public Timestamp getModifyTime() {
- return modifyTime;
- }
-
- public void setModifyTime(Timestamp modifyTime) {
- this.modifyTime = modifyTime;
- }
-
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusDb.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusDb.java
deleted file mode 100644
index 1c2055ee91..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/OperationalEnvServiceModelStatusDb.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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 java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-public class OperationalEnvServiceModelStatusDb {
-
- protected final AbstractSessionFactoryManager sessionFactoryRequestDB;
-
- protected static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
-
-
- protected static final String REQUEST_ID = "requestId";
- protected static final String OPERATIONAL_ENV_ID = "operationalEnvId";
- protected static final String SERVICE_MODEL_VERSION_ID = "serviceModelVersionId";
- protected static final String SERVICE_MOD_VER_DISTR_STATUS = "serviceModelVersionDistrStatus";
- protected static final String RECOVERY_ACTION = "recoveryAction";
- protected static final int RETRY_COUNT_LEFT = 0;
- protected static final String CREATE_TIME = "startTime";
- protected static final String MODIFY_TIME = "modifyTime";
-
-
- public static OperationalEnvServiceModelStatusDb getInstance() {
- return new OperationalEnvServiceModelStatusDb(new RequestsDbSessionFactoryManager ());
- }
-
- protected OperationalEnvServiceModelStatusDb (AbstractSessionFactoryManager sessionFactoryRequest) {
- sessionFactoryRequestDB = sessionFactoryRequest;
- }
-
-
- /**
- * Retrieve OperationalEnvServiceModelStatus from given OperationalEnvironmentId and serviceModelVersionId
- * @param operationalEnvId
- * @param serviceModelVersionId
- * @return
- */
- public OperationalEnvServiceModelStatus getOperationalEnvServiceModelStatus(String operationalEnvId, String serviceModelVersionId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Retrieve OperationalEnvironmentServiceModel with operationalEnvironmentId: " + operationalEnvId + ", serviceModelVersionId: " + serviceModelVersionId);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- OperationalEnvServiceModelStatus request = null;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("FROM OperationalEnvServiceModelStatus WHERE operationalEnvId = :operationalEnvId AND serviceModelVersionId = :serviceModelVersionId");
- query.setParameter ("operationalEnvId", operationalEnvId);
- query.setParameter ("serviceModelVersionId", serviceModelVersionId);
- request = (OperationalEnvServiceModelStatus) query.uniqueResult ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "OperationalEnvServiceModelStatus", "getOperationalEnvServiceModelStatus", null);
- }
- return request;
- }
-
-
- /**
- * Retrieve OperationalEnvServiceModelStatus from given OperationalEnvironmentId and serviceModelVersionId
- * @param operationalEnvId
- * @param serviceModelVersionId
- * @return
- */
- @SuppressWarnings("unchecked")
- public List<OperationalEnvServiceModelStatus> getOperationalEnvIdStatus(String operationalEnvId, String requestId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Retrieve OperationalEnvironmentServiceModel with operationalEnvironmentId: " + operationalEnvId + ", requestId: " + requestId);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- List<OperationalEnvServiceModelStatus> requests = new ArrayList<OperationalEnvServiceModelStatus>();
-
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("FROM OperationalEnvServiceModelStatus WHERE operationalEnvId = :operationalEnvId AND requestId = :requestId");
- query.setParameter ("operationalEnvId", operationalEnvId);
- query.setParameter ("requestId", requestId);
- requests = query.list();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "OperationalEnvServiceModelStatus", "getOperationalEnvIdStatus", null);
- }
- return requests;
- }
-
-
- /**
- * Update OperationalEnvServiceModelStatus serviceModelVersionDistrStatus with asdcStatus and retryCount for given operationalEnvId, serviceModelVersionId
- * @param operationalEnvId
- * @param serviceModelVersionId
- * @param asdcStatus
- * @param retryCount
- */
- public int updateOperationalEnvRetryCountStatus(String operationalEnvId, String serviceModelVersionId, String asdcStatus, int retryCount) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Update OperationalEnvServiceModelStatus retryCount: " + retryCount + " and serviceModelVersionDistrStatus :" + asdcStatus);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- int result = 0;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("update OperationalEnvServiceModelStatus set serviceModelVersionDistrStatus = :serviceModelVersionDistrStatus, retryCount = :retryCount, modifyTime = :modifyTime where "
- + "operationalEnvId = :operationalEnvId and serviceModelVersionId = :serviceModelVersionId ");
- query.setParameter ("retryCount", retryCount);
- query.setParameter (SERVICE_MOD_VER_DISTR_STATUS, asdcStatus);
- query.setParameter ("operationalEnvId", operationalEnvId);
- query.setParameter ("serviceModelVersionId", serviceModelVersionId);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- query.setParameter ("modifyTime", modifyTimeStamp);
- result = query.executeUpdate ();
- session.getTransaction ().commit ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "OperationalEnvServiceModelDB", "updateOperationalEnvRetryCountStatus", null);
- }
- return result;
- }
-
- /**
- * Update OperationalEnvServiceModelStatus serviceModelVersionDistrStatus with asdcStatus and retryCount for given operationalEnvId, serviceModelVersionId, requestId
- * @param operationalEnvId
- * @param serviceModelVersionId
- * @param asdcStatus
- * @param retryCount
- * @param requestId
- */
- public int updateOperationalEnvRetryCountStatusPerReqId(String operationalEnvId, String serviceModelVersionId, String asdcStatus, int retryCount, String requestId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Update OperationalEnvServiceModelStatus retryCount: " + retryCount + " and serviceModelVersionDistrStatus :" + asdcStatus);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- int result = 0;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("update OperationalEnvServiceModelStatus set serviceModelVersionDistrStatus = :asdcStatus, retryCount = :retryCount, modifyTime = :modifyTime where "
- + "operationalEnvId = :operationalEnvId and serviceModelVersionId = :serviceModelVersionId and requestId = :requestId ");
- query.setParameter ("retryCount", retryCount);
- query.setParameter (SERVICE_MOD_VER_DISTR_STATUS, asdcStatus);
- query.setParameter ("operationalEnvId", operationalEnvId);
- query.setParameter ("serviceModelVersionId", serviceModelVersionId);
- query.setParameter ("requestId", requestId);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- query.setParameter ("modifyTime", modifyTimeStamp);
- result = query.executeUpdate ();
- session.getTransaction ().commit ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "OperationalEnvServiceModelDB", "updateOperationalEnvRetryCountStatusPerReqId", null);
- }
- return result;
- }
-
-
- /**
- * Insert into OperationalEnvServiceModelStatus with operationalEnvId, serviceModelVersionId, distributionIdStatus, recoveryAction, retryCount
- * @param operationalEnvId
- * @param serviceModelVersionId
- * @param distributionIdStatus
- * @param distributionId
- * @param recoveryAction
- * @param retryCount
- */
- public void insertOperationalEnvServiceModelStatus(String requestId, String operationalEnvId, String serviceModelVersionId,
- String distributionIdStatus, String recoveryAction, int retryCount, String workloadContext) {
- long startTime = System.currentTimeMillis ();
- Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
- msoLogger.debug ("Insert into OperationalEnvServiceModelStatus " );
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- OperationalEnvServiceModelStatus oesm = new OperationalEnvServiceModelStatus ();
-
- try {
- session.beginTransaction ();
-
- oesm.setRequestId (requestId);
- oesm.setOperationalEnvId (operationalEnvId);
- oesm.setServiceModelVersionId (serviceModelVersionId);
- oesm.setServiceModelVersionDistrStatus (distributionIdStatus);
- oesm.setRecoveryAction (recoveryAction);
- oesm.setRetryCount (retryCount);
- oesm.setWorkloadContext(workloadContext);
- oesm.setCreateTime (startTimeStamp);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- oesm.setModifyTime (modifyTimeStamp);
-
- msoLogger.debug ("About to insert a record into OperationalEnvServiceModelStatus");
-
- session.save (oesm);
- session.getTransaction ().commit ();
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in insertOperationalEnvServiceModelStatus", e);
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, e.getMessage (), "OperationalEnvServiceModelStatusDB", "saveRequest", null);
- if (session != null) {
- session.close ();
- }
- // throw an Exception in the event of a DB insert failure so that the calling routine can exit
- throw e;
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "OperationalEnvServiceModelStatusDB", "insertOperationalEnvServiceModelStatus", null);
- }
-
- }
-
-}
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
deleted file mode 100644
index 9964b93df4..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
+++ /dev/null
@@ -1,888 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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 java.sql.Timestamp;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import org.hibernate.Criteria;
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.criterion.Criterion;
-import org.hibernate.criterion.Order;
-import org.hibernate.criterion.Restrictions;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.requestsdb.RequestsDbConstant.Status;
-import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
-import org.openecomp.mso.logger.MsoLogger;
-
-public class RequestsDatabase {
-
- protected final AbstractSessionFactoryManager sessionFactoryRequestDB;
-
- 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";
- protected static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
- protected static final String SERVICE_INSTANCE_NAME = "serviceInstanceName";
- protected static final String VNF_INSTANCE_NAME = "vnfName";
- protected static final String VNF_INSTANCE_ID = "vnfId";
- protected static final String VOLUME_GROUP_INSTANCE_NAME = "volumeGroupName";
- protected static final String VOLUME_GROUP_INSTANCE_ID = "volumeGroupId";
- protected static final String VFMODULE_INSTANCE_NAME = "vfModuleName";
- protected static final String VFMODULE_INSTANCE_ID = "vfModuleId";
- protected static final String NETWORK_INSTANCE_NAME = "networkName";
- protected static final String CONFIGURATION_INSTANCE_ID = "configurationId";
- protected static final String CONFIGURATION_INSTANCE_NAME= "configurationName";
- protected static final String OPERATIONAL_ENV_ID = "operationalEnvId";
- protected static final String OPERATIONAL_ENV_NAME = "operationalEnvName";
- protected static final String NETWORK_INSTANCE_ID = "networkId";
- protected static final String GLOBAL_SUBSCRIBER_ID = "globalSubscriberId";
- protected static final String SERVICE_NAME_VERSION_ID = "serviceNameVersionId";
- protected static final String SERVICE_ID = "serviceId";
- protected static final String SERVICE_VERSION = "serviceVersion";
- protected static final String REQUEST_ID = "requestId";
- protected static final String REQUESTOR_ID = "requestorId";
-
- protected static MockRequestsDatabase mockDB = null;
-
- public static RequestsDatabase getInstance() {
- return new RequestsDatabase(new RequestsDbSessionFactoryManager ());
- }
-
- protected RequestsDatabase (AbstractSessionFactoryManager sessionFactoryRequest) {
- sessionFactoryRequestDB = sessionFactoryRequest;
- }
-
- public boolean healthCheck () {
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- try {
- Query query = session.createSQLQuery (" show tables ");
-
- List<?> list = query.list();
-
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- }
- return true;
- }
-
-
- public int updateInfraStatus (String requestId, String requestStatus, String lastModifiedBy) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Update infra request record " + requestId + " with status " + requestStatus);
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
-
- int result = 0;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("update InfraActiveRequests set requestStatus = :requestStatus, modifyTime = :modifyTime, lastModifiedBy = :lastModifiedBy where requestId = :requestId ");
- query.setParameter ("requestStatus", requestStatus);
- query.setParameter (REQUEST_ID, requestId);
- query.setParameter ("lastModifiedBy", lastModifiedBy);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- query.setParameter ("modifyTime", modifyTimeStamp);
- result = query.executeUpdate ();
- session.getTransaction ().commit ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "updateInfraStatus", null);
- }
- return result;
- }
-
- public 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 = sessionFactoryRequestDB.getSessionFactory ().openSession ();
-
- int result = 0;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("update InfraActiveRequests set requestStatus = :requestStatus, modifyTime = :modifyTime, progress = :progress, lastModifiedBy = :lastModifiedBy where requestId = :requestId ");
- query.setParameter ("requestStatus", requestStatus);
- query.setParameter (REQUEST_ID, requestId);
- query.setParameter ("progress", progress);
- query.setParameter ("lastModifiedBy", lastModifiedBy);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- query.setParameter ("modifyTime", modifyTimeStamp);
- result = query.executeUpdate ();
- session.getTransaction ().commit ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "updateInfraStatus", null);
- }
- return result;
- }
-
- public 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 = sessionFactoryRequestDB.getSessionFactory ().openSession ();
-
- int result = 0;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("update InfraActiveRequests set requestStatus = :requestStatus, statusMessage = :statusMessage, progress = :progress, endTime = :endTime, responseBody = :responseBody, lastModifiedBy = :lastModifiedBy where id.requestId = :requestId ");
- query.setParameter ("requestStatus", requestStatus);
- query.setParameter ("requestId", requestId);
- Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
- query.setParameter ("endTime", endTimeStamp);
- query.setParameter ("statusMessage", statusMessage);
- query.setParameter ("progress", progress);
- query.setParameter ("responseBody", responseBody);
- query.setParameter ("lastModifiedBy", lastModifiedBy);
- result = query.executeUpdate ();
- session.getTransaction ().commit ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "updateInfraFinalStatus", null);
- }
- return result;
- }
-
-
- private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
-
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Execute query on infra active request table");
-
- List <InfraActiveRequests> results = new ArrayList<>();
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- try {
- session.beginTransaction ();
- Criteria crit = session.createCriteria (InfraActiveRequests.class);
- for (Criterion criterion : criteria) {
- crit.add (criterion);
- }
- crit.addOrder (order);
-
- // @SuppressWarnings("unchecked")
- results = crit.list ();
-
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "getInfraActiveRequest", null);
- }
- return results;
- }
-
- public InfraActiveRequests getRequestFromInfraActive (String requestId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Get request " + requestId + " from InfraActiveRequests DB");
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- InfraActiveRequests ar = null;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("from InfraActiveRequests where requestId = :requestId OR clientRequestId = :requestId");
- query.setParameter (REQUEST_ID, requestId);
- ar = (InfraActiveRequests) query.uniqueResult ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "InfraRequestDB", "getRequestFromInfraActive", null);
- }
- return ar;
- }
-
- public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
-
- List <Criterion> criteria = new LinkedList <> ();
-
- if(instanceName != null && !instanceName.equals("")) {
-
- if("service".equals(requestScope)){
- criteria.add (Restrictions.eq (SERVICE_INSTANCE_NAME, instanceName));
- } else if("vnf".equals(requestScope)){
- criteria.add (Restrictions.eq (VNF_INSTANCE_NAME, instanceName));
- } else if("volumeGroup".equals(requestScope)){
- criteria.add (Restrictions.eq (VOLUME_GROUP_INSTANCE_NAME, instanceName));
- } else if("vfModule".equals(requestScope)){
- criteria.add (Restrictions.eq (VFMODULE_INSTANCE_NAME, instanceName));
- } else if("network".equals(requestScope)){
- criteria.add (Restrictions.eq (NETWORK_INSTANCE_NAME, instanceName));
- } else if(requestScope.equals("configuration")) {
- criteria.add (Restrictions.eq (CONFIGURATION_INSTANCE_NAME, instanceName));
- } else if(requestScope.equals("operationalEnvironment")) {
- criteria.add (Restrictions.eq (OPERATIONAL_ENV_NAME, instanceName));
- }
-
- } else {
- if(instanceIdMap != null){
- if("service".equals(requestScope) && instanceIdMap.get("serviceInstanceId") != null){
- criteria.add (Restrictions.eq (SERVICE_INSTANCE_ID, instanceIdMap.get("serviceInstanceId")));
- }
-
- if("vnf".equals(requestScope) && instanceIdMap.get("vnfInstanceId") != null){
- criteria.add (Restrictions.eq (VNF_INSTANCE_ID, instanceIdMap.get("vnfInstanceId")));
- }
-
- if("vfModule".equals(requestScope) && instanceIdMap.get("vfModuleInstanceId") != null){
- criteria.add (Restrictions.eq (VFMODULE_INSTANCE_ID, instanceIdMap.get("vfModuleInstanceId")));
- }
-
- if("volumeGroup".equals(requestScope) && instanceIdMap.get("volumeGroupInstanceId") != null){
- criteria.add (Restrictions.eq (VOLUME_GROUP_INSTANCE_ID, instanceIdMap.get("volumeGroupInstanceId")));
- }
-
- if("network".equals(requestScope) && instanceIdMap.get("networkInstanceId") != null){
- criteria.add (Restrictions.eq (NETWORK_INSTANCE_ID, instanceIdMap.get("networkInstanceId")));
- }
-
- if(requestScope.equals("configuration") && instanceIdMap.get("configurationInstanceId") != null){
- criteria.add (Restrictions.eq (CONFIGURATION_INSTANCE_ID, instanceIdMap.get("configurationInstanceId")));
- }
-
- if(requestScope.equals("operationalEnvironment") && instanceIdMap.get("operationalEnvironmentId") != null) {
- criteria.add (Restrictions.eq (OPERATIONAL_ENV_ID, instanceIdMap.get("operationalEnvironmentId")));
- }
- }
- }
-
- criteria.add (Restrictions.in ("requestStatus", new String[] { "PENDING", "IN_PROGRESS", "TIMEOUT", "PENDING_MANUAL_TASK" }));
-
- Order order = Order.desc (START_TIME);
-
- List<InfraActiveRequests> dupList = executeInfraQuery(criteria, order);
-
- InfraActiveRequests infraActiveRequests = null;
-
- if(dupList != null && !dupList.isEmpty()){
- infraActiveRequests = dupList.get(0);
- }
-
- return infraActiveRequests;
- }
-
- public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive (Map<String, List<String>> orchestrationMap) {
-
-
- List <Criterion> criteria = new LinkedList <> ();
- for (Map.Entry<String, List<String>> entry : orchestrationMap.entrySet())
- {
- String mapKey = entry.getKey();
- if("serviceInstanceId".equalsIgnoreCase(mapKey)) {
- mapKey = "serviceInstanceId";
- } else if("serviceInstanceName".equalsIgnoreCase(mapKey)) {
- mapKey = "serviceInstanceName";
- } else if("vnfInstanceId".equalsIgnoreCase(mapKey)){
- mapKey = "vnfId";
- } else if("vnfInstanceName".equalsIgnoreCase(mapKey)) {
- mapKey = "vnfName";
- } else if("vfModuleInstanceId".equalsIgnoreCase(mapKey)) {
- mapKey = "vfModuleId";
- } else if("vfModuleInstanceName".equalsIgnoreCase(mapKey)) {
- mapKey = "vfModuleName";
- } else if("volumeGroupInstanceId".equalsIgnoreCase(mapKey)) {
- mapKey = "volumeGroupId";
- } else if("volumeGroupInstanceName".equalsIgnoreCase(mapKey)) {
- mapKey = "volumeGroupName";
- } else if("networkInstanceId".equalsIgnoreCase(mapKey)) {
- mapKey = "networkId";
- } else if("networkInstanceName".equalsIgnoreCase(mapKey)) {
- mapKey = "networkName";
- } else if(mapKey.equalsIgnoreCase("configurationInstanceId")) {
- mapKey = "configurationId";
- } else if(mapKey.equalsIgnoreCase("configurationInstanceName")) {
- mapKey = "configurationName";
- } else if("lcpCloudRegionId".equalsIgnoreCase(mapKey)) {
- mapKey = "aicCloudRegion";
- } else if("tenantId".equalsIgnoreCase(mapKey)) {
- mapKey = "tenantId";
- } else if("modelType".equalsIgnoreCase(mapKey)) {
- mapKey = "requestScope";
- } else if("requestorId".equalsIgnoreCase(mapKey)) {
- mapKey = "requestorId";
- } else if("requestExecutionDate".equalsIgnoreCase(mapKey)) {
- mapKey = "startTime";
- }
-
- String propertyValue = entry.getValue().get(1);
- if ("startTime".equals(mapKey)) {
- SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy");
- try {
- Date thisDate = format.parse(propertyValue);
- Timestamp minTime = new Timestamp(thisDate.getTime());
- Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1));
-
- if("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) {
- criteria.add(Restrictions.or(Restrictions.lt(mapKey, minTime),
- Restrictions.ge(mapKey, maxTime)));
- } else {
- criteria.add(Restrictions.between(mapKey, minTime, maxTime));
- }
- }
- catch (Exception e){
- msoLogger.debug("Exception in getOrchestrationFiltersFromInfraActive(): + " + e.getMessage(), e);
- return null;
- }
- }
- else if("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) {
- criteria.add(Restrictions.ne(mapKey, propertyValue));
- } else {
- criteria.add(Restrictions.eq(mapKey, propertyValue));
- }
-
- }
-
- Order order = Order.asc (START_TIME);
-
- return executeInfraQuery (criteria, order);
- }
-
- // Added this method for Tenant Isolation project ( 1802-295491a) to query the mso_requests DB
- // (infra_active_requests table) for operationalEnvId and OperationalEnvName
- public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive (Map<String, String> orchestrationMap) {
- List <Criterion> criteria = new LinkedList <> ();
-
- // Add criteria on OperationalEnvironment RequestScope when requestorId is only specified in the filter
- // as the same requestorId can also match on different API methods
- String resourceType = orchestrationMap.get("resourceType");
- if(resourceType == null) {
- criteria.add(Restrictions.eq("requestScope", "operationalEnvironment"));
- }
-
- for (Map.Entry<String, String> entry : orchestrationMap.entrySet()) {
- String mapKey = entry.getKey();
- if(mapKey.equalsIgnoreCase("requestorId")) {
- mapKey = "requestorId";
- } else if(mapKey.equalsIgnoreCase("requestExecutionDate")) {
- mapKey = "startTime";
- } else if(mapKey.equalsIgnoreCase("operationalEnvironmentId")) {
- mapKey = "operationalEnvId";
- } else if(mapKey.equalsIgnoreCase("operationalEnvironmentName")) {
- mapKey = "operationalEnvName";
- } else if(mapKey.equalsIgnoreCase("resourceType")) {
- mapKey = "requestScope";
- }
-
- String propertyValue = entry.getValue();
- if (mapKey.equals("startTime")) {
- SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy");
- try {
- Date thisDate = format.parse(propertyValue);
- Timestamp minTime = new Timestamp(thisDate.getTime());
- Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1));
-
- criteria.add(Restrictions.between(mapKey, minTime, maxTime));
- }
- catch (Exception e){
- msoLogger.debug("Exception in getCloudOrchestrationFiltersFromInfraActive(): + " + e.getMessage());
- return null;
- }
- } else {
- criteria.add(Restrictions.eq(mapKey, propertyValue));
- }
- }
-
- Order order = Order.asc (START_TIME);
- return executeInfraQuery (criteria, order);
- }
-
- public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
- String queryValue,
- String requestType) {
- msoLogger.debug ("Get list of infra requests from DB with " + queryAttributeName + " = " + queryValue);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- try {
- session.beginTransaction ();
- Criteria crit = session.createCriteria (InfraActiveRequests.class)
- .add (Restrictions.eq (queryAttributeName, queryValue));
- crit.add (Restrictions.eqOrIsNull (REQUEST_TYPE, requestType));
- crit.addOrder (Order.desc (START_TIME));
- crit.addOrder (Order.asc (SOURCE));
-
- @SuppressWarnings("unchecked")
- List <InfraActiveRequests> arList = crit.list ();
- if (arList != null && !arList.isEmpty ()) {
- return arList;
- }
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- // msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "getRequestListFromInfraActive", null);
- }
- return null;
- }
-
-
- public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Get infra request from DB with id " + requestId);
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- InfraActiveRequests ar = null;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("from InfraActiveRequests where (requestId = :requestId OR clientRequestId = :requestId) and requestType = :requestType");
- query.setParameter (REQUEST_ID, requestId);
- query.setParameter (REQUEST_TYPE, requestType);
- ar = (InfraActiveRequests) query.uniqueResult ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "getRequestFromInfraActive", null);
- }
- return ar;
- }
-
-
- public InfraActiveRequests checkDuplicateByVnfName (String vnfName, String action, String requestType) {
-
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Get infra request from DB for VNF " + vnfName + " and action " + action + " and requestType " + requestType);
-
- InfraActiveRequests ar = null;
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
-
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("from InfraActiveRequests where vnfName = :vnfName and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC");
- query.setParameter ("vnfName", vnfName);
- query.setParameter ("action", action);
- query.setParameter (REQUEST_TYPE, requestType);
- @SuppressWarnings("unchecked")
- List <InfraActiveRequests> results = query.list ();
- if (!results.isEmpty ()) {
- ar = results.get (0);
- }
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "checkDuplicateByVnfName", null);
- }
-
- return ar;
- }
-
- public InfraActiveRequests checkDuplicateByVnfId (String vnfId, String action, String requestType) {
-
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Get list of infra requests from DB for VNF " + vnfId + " and action " + action);
-
- InfraActiveRequests ar = null;
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
-
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("from InfraActiveRequests where vnfId = :vnfId and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC");
- query.setParameter ("vnfId", vnfId);
- query.setParameter ("action", action);
- query.setParameter (REQUEST_TYPE, requestType);
- @SuppressWarnings("unchecked")
- List <InfraActiveRequests> results = query.list ();
- if (!results.isEmpty ()) {
- ar = results.get (0);
- }
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "checkDuplicateByVnfId", null);
- }
-
- return ar;
- }
-
- public void setMockDB(MockRequestsDatabase mockDB) {
- RequestsDatabase.mockDB = mockDB;
- }
-
- /**
- * Fetch a specific SiteStatus by SiteName.
- *
- * @param siteName The unique name of the site
- * @return SiteStatus object or null if none found
- */
- public SiteStatus getSiteStatus (String siteName) {
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
-
- SiteStatus siteStatus = null;
- msoLogger.debug ("Request database - get Site Status with Site name:" + siteName);
- try {
- String hql = "FROM SiteStatus WHERE siteName = :site_name";
- Query query = session.createQuery (hql);
- query.setParameter ("site_name", siteName);
-
- siteStatus = (SiteStatus) query.uniqueResult ();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.debug ("getSiteStatus - Successfully: " + siteStatus);
- }
- return siteStatus;
- }
-
- /**
- * Fetch a specific SiteStatus by SiteName.
- *
- * @param siteName The unique name of the site
- * @param status The updated status of the Site
- */
- public void updateSiteStatus (String siteName, boolean status) {
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- session.beginTransaction ();
-
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Request database - save Site Status with Site name:" + siteName);
- try {
- String hql = "FROM SiteStatus WHERE siteName = :site_name";
- Query query = session.createQuery (hql);
- query.setParameter ("site_name", siteName);
-
- SiteStatus siteStatus = (SiteStatus) query.uniqueResult ();
- if (siteStatus == null) {
- siteStatus = new SiteStatus ();
- siteStatus.setSiteName (siteName);
- siteStatus.setStatus (status);
- //siteStatus.setCreated(new Timestamp(new Date().getTime()));
- session.save (siteStatus);
- } else {
- siteStatus.setStatus(status);
- //siteStatus.setCreated(new Timestamp(new Date().getTime()));
- session.merge (siteStatus);
- }
- session.getTransaction ().commit ();
- } finally {
- session.close ();
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "updateSiteStatus", null);
- }
- }
-
- /**
- * get the operation progress
- * <br>
- *
- * @param serviceId the serviceId
- * @param operationId the operation id
- * @return current progress of the operation
- * @since ONAP Amsterdam Release
- */
- public OperationStatus getOperationStatus(String serviceId, String operationId) {
-
- long startTime = System.currentTimeMillis();
- msoLogger.debug("Execute query on infra active request table");
-
- OperationStatus operStatus = null;
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- try {
- session.beginTransaction();
- String hql = "FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id";
- Query query = session.createQuery(hql);
- query.setParameter("service_id", serviceId);
- query.setParameter("operation_id", operationId);
- operStatus = (OperationStatus)query.uniqueResult();
-
- } finally {
- if(session != null && session.isOpen()) {
- session.close();
- }
- msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "RequestDB", "getOperationStatus", null);
- }
- return operStatus;
- }
-
- /**
- * get the operation progress
- * <br>
- *
- * @param serviceId the serviceId
- * @return current progress of the operation
- * @since ONAP Amsterdam Release
- */
- public OperationStatus getOperationStatusByServiceId(String serviceId) {
-
- long startTime = System.currentTimeMillis();
- msoLogger.debug("Execute query on infra active request table");
-
- OperationStatus operStatus = null;
- List<Object> list = null;
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- try {
- session.beginTransaction();
- String hql = "FROM OperationStatus WHERE SERVICE_ID = :service_id order by OPERATE_AT desc";
- Query query = session.createQuery(hql);
- query.setParameter("service_id", serviceId);
- list = query.list();
- if(list != null && list.size() >= 1) {
- operStatus = (OperationStatus) list.get(0);
- }
-
- } finally {
- if(session != null && session.isOpen()) {
- session.close();
- }
- msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "RequestDB", "getOperationStatus", null);
- }
- return operStatus;
- }
-
- /**
- * get the operation progress
- * <br>
- *
- * @param serviceName the serviceName
- * @return current progress of the operation
- * @since ONAP Amsterdam Release
- */
- public OperationStatus getOperationStatusByServiceName(String serviceName) {
-
- long startTime = System.currentTimeMillis();
- msoLogger.debug("Execute query on infra active request table");
-
- OperationStatus operStatus = null;
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- try {
- session.beginTransaction();
- String hql = "FROM OperationStatus WHERE SERVICE_NAME = :service_name";
- Query query = session.createQuery(hql);
- query.setParameter("service_name", serviceName);
- operStatus = (OperationStatus)query.uniqueResult();
-
- } finally {
- if(session != null && session.isOpen()) {
- session.close();
- }
- msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "RequestDB", "getOperationStatus", null);
- }
- return operStatus;
- }
-
- /**
- * update the operation status
- * <br>
- *
- * @param operstatus the operation object
- * @since ONAP Amsterdam Release
- */
- public void updateOperationStatus(OperationStatus operstatus) {
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- session.beginTransaction();
-
- long startTime = System.currentTimeMillis();
- msoLogger.debug("Request database - save Operation Status with service Id:" + operstatus.getServiceId()
- + ", operationId:" + operstatus.getOperationId());
- try {
- String hql =
- "FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id";
- Query query = session.createQuery(hql);
- query.setParameter("service_id", operstatus.getServiceId());
- query.setParameter("operation_id", operstatus.getOperationId());
- OperationStatus exsitingStatus = (OperationStatus)query.uniqueResult();
- if(exsitingStatus == null) {
- session.save(operstatus);
- } else {
- session.merge(operstatus);
- }
- session.getTransaction().commit();
- } finally {
- session.close();
- msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "RequestDB", "updateOperationStatus", null);
- }
- }
-
- /**
- * get a operation status of a resource
- * <br>
- *
- * @param serviceId the service Id
- * @param operationId the operation id
- * @param resourceTemplateUUID the resource template uuid
- * @return the progress status of a resource
- * @since ONAP Amsterdam Release
- */
- public ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId,
- String resourceTemplateUUID) {
- long startTime = System.currentTimeMillis();
- msoLogger.debug("Execute query on infra active request table");
-
- ResourceOperationStatus operStatus = null;
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- try {
- session.beginTransaction();
- String hql =
- "FROM ResourceOperationStatus WHERE serviceId = :service_id and operationId = :operation_id and resourceTemplateUUID= :uuid";
- Query query = session.createQuery(hql);
- query.setParameter("service_id", serviceId);
- query.setParameter("operation_id", operationId);
- query.setParameter("uuid", resourceTemplateUUID);
- operStatus = (ResourceOperationStatus)query.uniqueResult();
-
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "RequestDB", "getOperationStatus", null);
- }
- return operStatus;
- }
-
- /**
- * update the resource operation
- * <br>
- *
- * @param operStatus the resource operation object
- * @since ONAP Amsterdam Release
- */
- public void updateResOperStatus(ResourceOperationStatus operStatus) {
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- session.beginTransaction();
-
- long startTime = System.currentTimeMillis();
- msoLogger.debug("Request database - save Resource Operation Status with service Id:" + operStatus.getServiceId()
- + ", operationId:" + operStatus.getOperationId() + ", resourceUUId:"
- + operStatus.getResourceTemplateUUID());
- try {
- String hql =
- "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());
- query.setParameter("res_uuid", operStatus.getResourceTemplateUUID());
- ResourceOperationStatus exsitingStatus = (ResourceOperationStatus)query.uniqueResult();
- if(exsitingStatus == null) {
- session.save(operStatus);
- } else {
- session.merge(operStatus);
- }
- session.getTransaction().commit();
- } finally {
- session.close();
- msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "RequestDB", "updateResOperStatus", null);
- }
- updateOperationStatusBasedOnResourceStatus(operStatus);
- }
-
- /**
- * update service operation status when a operation resource status updated
- * <br>
- *
- * @param operStatus the resource operation status
- * @since ONAP Amsterdam Release
- */
- private void updateOperationStatusBasedOnResourceStatus(ResourceOperationStatus operStatus) {
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- session.beginTransaction();
-
- long startTime = System.currentTimeMillis();
- msoLogger.debug("Request database - query Resource Operation Status with service Id:"
- + operStatus.getServiceId() + ", operationId:" + operStatus.getOperationId());
- try {
- // query all resources of the service
- String hql = "FROM ResourceOperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id";
- Query query = session.createQuery(hql);
- query.setParameter("service_id", operStatus.getServiceId());
- query.setParameter("operation_id", operStatus.getOperationId());
- @SuppressWarnings("unchecked")
- List<ResourceOperationStatus> lstResourceStatus = (List<ResourceOperationStatus>)query.list();
- // count the total progress
- int resourceCount = lstResourceStatus.size();
- int progress = 0;
- boolean isFinished = true;
- for (ResourceOperationStatus lstResourceStatu : lstResourceStatus) {
- progress = progress + Integer.valueOf(lstResourceStatu.getProgress()) / resourceCount;
- if (Status.PROCESSING.equals(lstResourceStatu.getStatus())) {
- isFinished = false;
- }
- }
- OperationStatus serviceOperStatus =
- getOperationStatus(operStatus.getServiceId(), operStatus.getOperationId());
- progress = progress > 100 ? 100 : progress;
- serviceOperStatus.setProgress(String.valueOf(progress));
- serviceOperStatus.setOperationContent(operStatus.getStatusDescription());
- // if current resource failed. service failed.
- if(RequestsDbConstant.Status.ERROR.equals(operStatus.getStatus())) {
- serviceOperStatus.setResult(RequestsDbConstant.Status.ERROR);
- serviceOperStatus.setReason(operStatus.getStatusDescription());
- } else if(isFinished) {
- // if finished
- serviceOperStatus.setResult(RequestsDbConstant.Status.FINISHED);
- serviceOperStatus.setProgress(RequestsDbConstant.Progress.ONE_HUNDRED);
- }
- updateOperationStatus(serviceOperStatus);
- } finally {
- session.close();
- msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "RequestDB", "updateResOperStatus", null);
- }
- }
-
- public InfraActiveRequests checkVnfIdStatus(String operationalEnvironmentId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Get Infra request from DB for OperationalEnvironmentId " + operationalEnvironmentId);
-
- InfraActiveRequests ar = null;
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
-
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("FROM InfraActiveRequests WHERE operationalEnvId = :operationalEnvId AND requestStatus != 'COMPLETE' AND action = 'create' ORDER BY startTime DESC");
- query.setParameter ("operationalEnvId", operationalEnvironmentId);
-
- @SuppressWarnings("unchecked")
- List <InfraActiveRequests> results = query.list ();
- if (!results.isEmpty ()) {
- ar = results.get (0);
- }
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "checkDuplicateByVnfName", null);
- }
-
- return ar;
- }
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbSessionFactoryManager.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbSessionFactoryManager.java
deleted file mode 100644
index 674867af65..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDbSessionFactoryManager.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.AbstractSessionFactoryManager;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import java.net.URL;
-
-public class RequestsDbSessionFactoryManager extends AbstractSessionFactoryManager {
-
- 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/SiteStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/SiteStatus.java
deleted file mode 100644
index 3685093740..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/SiteStatus.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.logger.MsoLogger;
-
-import java.sql.Timestamp;
-
-
-public class SiteStatus {
-
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
-
- private boolean status;
- private String siteName = null;
- private Timestamp created = null;
-
- public SiteStatus() {
- }
-
- public Timestamp getCreated() {
- return created;
- }
-
- public void setCreated(Timestamp created) {
- this.created = created;
- }
-
- public String getSiteName() {
- return siteName;
- }
-
- public void setSiteName(String siteName) {
- this.siteName = siteName;
- }
-
- public void setStatus(boolean status) {
- this.status = status;
- }
-
- public boolean getStatus() {
- return status;
- }
-
- @Override
- public String toString() {
- return "SiteStatus{" +
- "status=" + status +
- ", siteName='" + siteName + '\'' +
- ", created=" + created +
- '}';
- }
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusDb.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusDb.java
deleted file mode 100644
index 10114348a0..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogComponentDistributionStatusDb.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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 java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-public class WatchdogComponentDistributionStatusDb {
-
- protected final AbstractSessionFactoryManager sessionFactoryRequestDB;
-
- protected static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
-
-
- protected static final String DISTRIBUTION_ID = "distributionId";
- protected static final String COMPONENT_NAME = "componentName";
- protected static final String COMPONENT_DISTRIBUTION_STATUS = "componentDistributionIdStatus";
- protected static final String CREATE_TIME = "startTime";
- protected static final String MODIFY_TIME = "modifyTime";
-
-
- public static WatchdogComponentDistributionStatusDb getInstance() {
- return new WatchdogComponentDistributionStatusDb(new RequestsDbSessionFactoryManager ());
- }
-
- protected WatchdogComponentDistributionStatusDb (AbstractSessionFactoryManager sessionFactoryRequest) {
- sessionFactoryRequestDB = sessionFactoryRequest;
- }
-
-
- /**
- * Insert into watchdog_per_component_distribution_status.
- *
- * @param distributionId
- * @param componentName
- * @param componentDistributionStatus
- * @return void
- */
- public void insertWatchdogComponentDistributionStatus(String distributionId, String componentName, String componentDistributionStatus ) {
- long startTime = System.currentTimeMillis ();
- Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
- msoLogger.debug ("Insert into WatchdogPerComponentDistributionStatus for DistributionId: " + distributionId + " ComponentName: " + componentName + " and ComponentDistributionStatus: " + componentDistributionStatus);
-
- List<WatchdogComponentDistributionStatus> componentList = getWatchdogComponentDistributionStatus(distributionId, componentName);
-
- if((componentList == null) || componentList.isEmpty())
- {
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- WatchdogComponentDistributionStatus wdcds = new WatchdogComponentDistributionStatus ();
-
- try {
- session.beginTransaction ();
-
- wdcds.setDistributionId (distributionId);
- wdcds.setComponentName (componentName);
- wdcds.setComponentDistributionStatus (componentDistributionStatus);
- wdcds.setCreateTime (startTimeStamp);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- wdcds.setModifyTime (modifyTimeStamp);
-
- msoLogger.debug ("About to insert a record into WatchdogPerComponentDistributionStatus");
-
- session.save (wdcds);
- session.getTransaction ().commit ();
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in insertWatchdogComponentDistributionStatus", e);
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, e.getMessage (), "WatchdogComponentDistributionStatusDB", "saveRequest", null);
- if (session != null) {
- session.close ();
- }
- // throw an Exception in the event of a DB insert failure so that the calling routine can exit
- throw e;
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "WatchdogComponentDistributionStatusDB", "insertWatchdogComponentDistributionStatus", null);
- }
- }
-
- }
-
- /**
- * Retrieve records from WatchdogComponentDistributionStatus.
- *
- * @param distributionId
- * @return WatchdogComponentDistributionStatus
- */
- @SuppressWarnings("unchecked")
- public List<WatchdogComponentDistributionStatus> getWatchdogComponentDistributionStatus(String distributionId) {
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- session.beginTransaction();
-
- List<WatchdogComponentDistributionStatus> results = new ArrayList<WatchdogComponentDistributionStatus>();
- msoLogger.debug("Request database - getWatchdogComponentDistributionStatus:" + distributionId);
- try {
- String hql = "FROM WatchdogComponentDistributionStatus WHERE distributionId = :distributionId";
- Query query = session.createQuery(hql);
- query.setParameter("distributionId", distributionId);
- results = query.list();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.debug ("getWatchdogComponentDistributionStatus - Successfully");
- }
- return results;
- }
-
- /**
- * Retrieve records from WatchdogComponentDistributionStatus.
- *
- * @param distributionId
- * @param componentName
- * @return WatchdogComponentDistributionStatus
- */
- @SuppressWarnings("unchecked")
- public List<WatchdogComponentDistributionStatus> getWatchdogComponentDistributionStatus(String distributionId, String componentName) {
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- session.beginTransaction();
-
- List<WatchdogComponentDistributionStatus> results = new ArrayList<WatchdogComponentDistributionStatus>();
- msoLogger.debug("Request database - getWatchdogComponentDistributionStatus:" + distributionId + " and componentName:" + componentName);
- try {
- String hql = "FROM WatchdogComponentDistributionStatus WHERE distributionId = :distributionId AND componentName = :componentName";
- Query query = session.createQuery(hql);
- query.setParameter("distributionId", distributionId);
- query.setParameter("componentName", componentName);
- results = query.list();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.debug ("getWatchdogComponentDistributionStatus by ComponentName - Successfully");
- }
- return results;
- }
-
- /**
- * Retrieve records from getWatchdogComponentNames.
- *
- * @param distributionId
- * @return String
- */
- @SuppressWarnings("unchecked")
- public List<String> getWatchdogComponentNames(String distributionId) {
- Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
- session.beginTransaction();
-
- List<String> results = new ArrayList<String>();
- msoLogger.debug("Request database - getWatchdogComponentNames:" + distributionId);
- try {
- String hql = "Select componentName FROM WatchdogComponentDistributionStatus WHERE distributionId = :distributionId";
- Query query = session.createQuery(hql);
- query.setParameter("distributionId", distributionId);
- results = query.list();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.debug ("getWatchdogComponentNames - Successfully");
- }
- return results;
- }
-
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatus.java
deleted file mode 100644
index deb2b6824d..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatus.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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 java.io.Serializable;
-import java.sql.Timestamp;
-
-public class WatchdogDistributionStatus implements Serializable {
-
- /**
- * Serialization id.
- */
- private static final long serialVersionUID = -4449711060885719079L;
-
-
- private String distributionId = null;
- private String distributionIdStatus = null;
- private Timestamp createTime = null;
- private Timestamp modifyTime = null;
-
-
- public String getDistributionId() {
- return distributionId;
- }
-
- public void setDistributionId(String distributionId) {
- this.distributionId = distributionId;
- }
-
- public String getDistributionIdStatus() {
- return distributionIdStatus;
- }
-
- public void setDistributionIdStatus(String distributionIdStatus) {
- this.distributionIdStatus = distributionIdStatus;
- }
-
- public Timestamp getCreateTime() {
- return createTime;
- }
- public void setCreateTime(Timestamp createTime) {
- this.createTime = createTime;
- }
-
- public Timestamp getModifyTime() {
- return modifyTime;
- }
-
- public void setModifyTime(Timestamp modifyTime) {
- this.modifyTime = modifyTime;
- }
-
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusDb.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusDb.java
deleted file mode 100644
index f1fab18df0..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogDistributionStatusDb.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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 java.sql.Timestamp;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-public class WatchdogDistributionStatusDb {
-
- protected final AbstractSessionFactoryManager sessionFactoryRequestDB;
-
- protected static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
-
-
- protected static final String DISTRIBUTION_ID = "distributionId";
- protected static final String DISTRIBUTION_ID_STATUS = "distributionIdStatus";
- protected static final String CREATE_TIME = "startTime";
- protected static final String MODIFY_TIME = "modifyTime";
-
-
- public static WatchdogDistributionStatusDb getInstance() {
- return new WatchdogDistributionStatusDb(new RequestsDbSessionFactoryManager ());
- }
-
- protected WatchdogDistributionStatusDb (AbstractSessionFactoryManager sessionFactoryRequest) {
- sessionFactoryRequestDB = sessionFactoryRequest;
- }
-
-
- /**
- * Insert into WATCHDOG_DISTRIBUTIONID_STATUS.
- *
- * @param distributionId
- * @return void
- */
- public void insertWatchdogDistributionId(String distributionId ) {
- long startTime = System.currentTimeMillis ();
- Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
- msoLogger.debug ("Insert into WatchdogDistributionStatus - DistributionId: " + distributionId);
-
- if(getWatchdogDistributionId(distributionId) == null){
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- WatchdogDistributionStatus wds = new WatchdogDistributionStatus ();
-
- try {
- session.beginTransaction ();
-
- wds.setDistributionId (distributionId);
- wds.setCreateTime (startTimeStamp);
- Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- wds.setModifyTime (modifyTimeStamp);
-
- msoLogger.debug ("About to insert a record into WatchdogDistributionStatus ");
-
- session.save (wds);
- session.getTransaction ().commit ();
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in insertWatchdogDistributionId", e);
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, e.getMessage (), "WatchdogDistributionStatusDB", "saveRequest", null);
- if (session != null) {
- session.close ();
- }
- // throw an Exception in the event of a DB insert failure so that the calling routine can exit
- throw e;
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "WatchdogDistributionStatusDB", "insertWatchdogDistributionId", null);
- }
-
- }
-
- }
-
-
- /**
- * Update WATCHDOG_DISTRIBUTIONID_STATUS with new status for a given distributionid.
- *
- * @param distributionId
- * @param distributionStatus
- * @return void
- */
- public void updateWatchdogDistributionIdStatus(String distributionId, String distributionIdStatus ) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Update WatchdogDistributionStatus status with distributionId: " + distributionId + " and distributionStatus: " + distributionIdStatus );
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
-
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("update WatchdogDistributionStatus set distributionIdStatus = :distributionIdStatus where "
- + "distributionId = :distributionId ");
-
- query.setParameter ("distributionId", distributionId);
- query.setParameter ("distributionIdStatus", distributionIdStatus);
-
- //Timestamp modifyTimeStamp = new Timestamp (System.currentTimeMillis());
- //query.setParameter ("modifyTime", modifyTimeStamp);
- query.executeUpdate ();
- session.getTransaction ().commit ();
-
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in updateWatchdogDistributionStatus", e);
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, e.getMessage (), "WatchdogDistributionStatusDB", "saveRequest", null);
- if (session != null) {
- session.close ();
- }
- // throw an Exception in the event of a DB insert failure so that the calling routine can exit
- throw e;
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "WatchdogDistributionStatusDB", "insertWatchdogDistributionStatus", null);
- }
- }
-
- /**
- * Retrieve records from WatchdogDistributionIdStatus.
- *
- * @param distributionId
- * @return WatchdogDistributionIdStatus
- */
- public String getWatchdogDistributionIdStatus(String distributionId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Retrieve records from WatchdogDistributionStatus for distributionId : " + distributionId );
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- String distributionStatus = null;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("SELECT distributionIdStatus FROM WatchdogDistributionStatus WHERE distributionId = :distributionId ");
- query.setParameter ("distributionId", distributionId);
- distributionStatus = (String) query.uniqueResult();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "WatchdogDistributionStatusDB", "getWatchdogDistributionIdStatus", null);
- }
- return distributionStatus;
- }
-
- /**
- * Retrieve records from WatchdogDistributionId.
- *
- * @param distributionId
- * @return WatchdogDistributionIdStatus
- */
- public String getWatchdogDistributionId(String distributionId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Retrieve distributionId from WatchdogDistributionStatus for distributionId : " + distributionId );
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- String existingDistributionId = null;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("SELECT distributionId FROM WatchdogDistributionStatus WHERE distributionId = :distributionId ");
- query.setParameter ("distributionId", distributionId);
- existingDistributionId = (String) query.uniqueResult();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "WatchdogDistributionStatusDB", "getWatchdogDistributionIdStatus", null);
- }
- return existingDistributionId;
- }
-}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupDb.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupDb.java
deleted file mode 100644
index f081bbf55c..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/WatchdogServiceModVerIdLookupDb.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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 java.sql.Timestamp;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-public class WatchdogServiceModVerIdLookupDb {
-
- protected final AbstractSessionFactoryManager sessionFactoryRequestDB;
-
- protected static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
-
- protected static final String DISTRIBUTION_ID = "distributionId";
- protected static final String SERVICE_MODEL_VERSION_ID = "serviceModelVersionId";
- protected static final String CREATE_TIME = "startTime";
-
-
- public static WatchdogServiceModVerIdLookupDb getInstance() {
- return new WatchdogServiceModVerIdLookupDb(new RequestsDbSessionFactoryManager ());
- }
-
- protected WatchdogServiceModVerIdLookupDb (AbstractSessionFactoryManager sessionFactoryRequest) {
- sessionFactoryRequestDB = sessionFactoryRequest;
- }
-
-
- /**
- * Insert into WATCHDOG_SERVICE_MOD_VER_ID_LOOKUP.
- *
- * @param distributionId
- * @param serviceModelVersionId
- * @return void
- */
- public void insertWatchdogServiceModVerIdLookup(String distributionId, String serviceModelVersionId ) {
- long startTime = System.currentTimeMillis ();
- Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
- msoLogger.debug ("Insert into WatchdogServiceModVerIdLookup for DistributionId: " + distributionId + " and ServiceModelVersionId: " + serviceModelVersionId );
-
- if(getWatchdogServiceModVerId(distributionId) == null){
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- WatchdogServiceModVerIdLookup wdsm = new WatchdogServiceModVerIdLookup ();
-
- try {
- session.beginTransaction ();
-
- wdsm.setDistributionId (distributionId);
- wdsm.setServiceModelVersionId (serviceModelVersionId);
- wdsm.setCreateTime (startTimeStamp);
-
- msoLogger.debug ("About to insert a record into WatchdogServiceModVerIdLookup");
-
- session.save (wdsm);
- session.getTransaction ().commit ();
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in insertWatchdogServiceModVerIdLookup", e);
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, e.getMessage (), "WatchdogServiceModVerIdLookupDB", "saveRequest", null);
- if (session != null) {
- session.close ();
- }
- // throw an Exception in the event of a DB insert failure so that the calling routine can exit
- throw e;
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "WatchdogServiceModVerIdLookupDB", "insertWatchdogServiceModVerIdLookup", null);
- }
- }
-
- }
-
- /**
- * Retrieve from WATCHDOG_SERVICE_MOD_VER_ID_LOOKUP.
- *
- * @param distributionId
- * @return WatchdogServiceModVerIdLookup
- */
- public String getWatchdogServiceModVerId(String distributionId) {
- long startTime = System.currentTimeMillis ();
- msoLogger.debug ("Retrieve WatchdogServiceModVerIdLookup with distributionId: " + distributionId );
-
- Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
- String serviceModelVersionId = null;
- try {
- session.beginTransaction ();
- Query query = session.createQuery ("Select serviceModelVersionId FROM WatchdogServiceModVerIdLookup WHERE distributionId = :distributionId ");
- query.setParameter ("distributionId", distributionId);
- serviceModelVersionId = (String) query.uniqueResult();
- } finally {
- if (session != null && session.isOpen ()) {
- session.close ();
- }
- msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully", "WatchdogServiceModVerIdLookupDB", "getWatchdogServiceModVerId", null);
- }
- return serviceModelVersionId;
- }
-}
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
deleted file mode 100644
index 79ead1de15..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml
+++ /dev/null
@@ -1,161 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP 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=========================================================
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
-<!-- Generated Jul 27, 2015 3:05:00 PM by Hibernate Tools 3.4.0.CR1 -->
-<hibernate-mapping>
- <class name="org.openecomp.mso.requestsdb.InfraActiveRequests" table="INFRA_ACTIVE_REQUESTS">
- <id name="requestId" type="string">
- <column name="REQUEST_ID" length="45"/>
- <generator class="assigned"/>
- </id>
- <property name="clientRequestId" type="string" unique="true">
- <column name="CLIENT_REQUEST_ID" length="45" unique="true"/>
- </property>
- <property name="action" type="string">
- <column name="ACTION" length="45" not-null="true"/>
- </property>
- <property name="requestStatus" type="string">
- <column name="REQUEST_STATUS" length="20"/>
- </property>
- <property name="statusMessage" type="string">
- <column name="STATUS_MESSAGE" length="2000"/>
- </property>
- <property name="progress" type="java.lang.Long">
- <column name="PROGRESS" precision="11" scale="0"/>
- </property>
- <property name="startTime" type="timestamp">
- <column name="START_TIME"/>
- </property>
- <property name="endTime" type="timestamp">
- <column name="END_TIME"/>
- </property>
- <property name="source" type="string">
- <column name="SOURCE" length="45"/>
- </property>
- <property name="vnfId" type="string">
- <column name="VNF_ID" length="45"/>
- </property>
- <property name="vnfName" type="string">
- <column name="VNF_NAME" length="80"/>
- </property>
- <property name="vnfType" type="string">
- <column name="VNF_TYPE" length="200"/>
- </property>
- <property name="serviceType" type="string">
- <column name="SERVICE_TYPE" length="45"/>
- </property>
- <property name="aicNodeClli" type="string">
- <column name="AIC_NODE_CLLI" length="11"/>
- </property>
- <property name="tenantId" type="string">
- <column name="TENANT_ID" length="45"/>
- </property>
- <property name="provStatus" type="string">
- <column name="PROV_STATUS" length="20"/>
- </property>
- <property name="vnfParams" type="text">
- <column name="VNF_PARAMS"/>
- </property>
- <property name="vnfOutputs" type="text">
- <column name="VNF_OUTPUTS"/>
- </property>
- <property name="requestBody" type="text">
- <column name="REQUEST_BODY"/>
- </property>
- <property name="responseBody" type="text">
- <column name="RESPONSE_BODY"/>
- </property>
- <property name="lastModifiedBy" type="string">
- <column name="LAST_MODIFIED_BY" length="50"/>
- </property>
- <property name="modifyTime" type="timestamp">
- <column name="MODIFY_TIME"/>
- </property>
- <property name="requestType" type="string">
- <column name="REQUEST_TYPE" length="20"/>
- </property>
- <property name="volumeGroupId" type="string">
- <column name="VOLUME_GROUP_ID" length="45"/>
- </property>
- <property name="volumeGroupName" type="string">
- <column name="VOLUME_GROUP_NAME" length="45"/>
- </property>
- <property name="vfModuleId" type="string">
- <column name="VF_MODULE_ID" length="45"/>
- </property>
- <property name="vfModuleName" type="string">
- <column name="VF_MODULE_NAME" length="200"/>
- </property>
- <property name="vfModuleModelName" type="string">
- <column name="VF_MODULE_MODEL_NAME" length="200"/>
- </property>
- <property name="aaiServiceId" type="string">
- <column name="AAI_SERVICE_ID" length="50"/>
- </property>
- <property name="aicCloudRegion" type="string">
- <column name="AIC_CLOUD_REGION" length="200"/>
- </property>
- <property name="callBackUrl" type="string">
- <column name="CALLBACK_URL" length="200"/>
- </property>
- <property name="correlator" type="string">
- <column name="CORRELATOR" length="80"/>
- </property>
- <property name="serviceInstanceId" type="string">
- <column name="SERVICE_INSTANCE_ID" length="45"/>
- </property>
- <property name="serviceInstanceName" type="string">
- <column name="SERVICE_INSTANCE_NAME" length="80"/>
- </property>
- <property name="requestScope" type="string">
- <column name="REQUEST_SCOPE" length="45"/>
- </property>
- <property name="requestAction" type="string">
- <column name="REQUEST_ACTION" length="45" not-null="true"/>
- </property>
- <property name="networkId" type="string">
- <column name="NETWORK_ID" length="45"/>
- </property>
- <property name="networkName" type="string">
- <column name="NETWORK_NAME" length="80"/>
- </property>
- <property name="networkType" type="string">
- <column name="NETWORK_TYPE" length="80"/>
- </property>
- <property name="requestorId" type="string">
- <column name="REQUESTOR_ID" length="80"/>
- </property>
- <property name="configurationId" type="string">
- <column name="CONFIGURATION_ID" length="45"/>
- </property>
- <property name="configurationName" type="string">
- <column name="CONFIGURATION_NAME" length="200"/>
- </property>
- <property name="operationalEnvId" type="string">
- <column name="OPERATIONAL_ENV_ID" length="45"/>
- </property>
- <property name="operationalEnvName" type="string">
- <column name="OPERATIONAL_ENV_NAME" length="200"/>
- </property>
- </class>
-</hibernate-mapping>
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
deleted file mode 100644
index 44094a1394..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/OperationStatus.hbm.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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=========================================================
- */
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.openecomp.mso.requestsdb">
- <class name="OperationStatus" table="OPERATION_STATUS">
- <meta attribute="class-description">
- This class describes a operation status
- </meta>
- <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="serviceName" column="SERVICE_NAME" type="string" length="256"/>
- <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"/>
- <property name="operationContent" column="OPERATION_CONTENT" type="string" length="256"/>
- <property name="progress" column="PROGRESS" type="string" length="256"/>
- <property name="reason" column="REASON" type="string" length="256"/>
- <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="always" insert="false" update="false"/>
- </class>
-</hibernate-mapping>
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvDistributionStatus.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvDistributionStatus.hbm.xml
deleted file mode 100644
index 08e60b2641..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvDistributionStatus.hbm.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP 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=========================================================
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Generated Jul 27, 2015 3:05:00 PM by Hibernate Tools 3.4.0.CR1 -->
-<hibernate-mapping>
- <class name="org.openecomp.mso.requestsdb.OperationalEnvDistributionStatus" table="ACTIVATE_OPERATIONAL_ENV_PER_DISTRIBUTIONID_STATUS">
-
- <id name="distributionId" type="string">
- <column name="DISTRIBUTION_ID" length="45"/>
- <generator class="assigned"/>
- </id>
-
- <property name="operationalEnvId" type="string">
- <column name="OPERATIONAL_ENV_ID" length="45"/>
- </property>
- <property name="serviceModelVersionId" type="string">
- <column name="SERVICE_MODEL_VERSION_ID" length="45"/>
- </property>
- <property name="distributionIdStatus" type="string">
- <column name="DISTRIBUTION_ID_STATUS" length="45" />
- </property>
- <property name="distributionIdErrorReason" type="string">
- <column name="DISTRIBUTION_ID_ERROR_REASON" length="250" />
- </property>
- <property name="requestId" type="string">
- <column name="REQUEST_ID" length="45" />
- </property>
- <property name="createTime" type="timestamp">
- <column name="CREATE_TIME"/>
- </property>
- <property name="modifyTime" type="timestamp">
- <column name="MODIFY_TIME"/>
- </property>
-
- </class>
-</hibernate-mapping> \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvServiceModelStatus.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvServiceModelStatus.hbm.xml
deleted file mode 100644
index 99a6232e0e..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/OperationalEnvServiceModelStatus.hbm.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP 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=========================================================
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Generated Jul 27, 2015 3:05:00 PM by Hibernate Tools 3.4.0.CR1 -->
-<hibernate-mapping>
- <class name="org.openecomp.mso.requestsdb.OperationalEnvServiceModelStatus" table="ACTIVATE_OPERATIONAL_ENV_SERVICE_MODEL_DISTRIBUTION_STATUS">
-
- <composite-id>
- <key-property name="operationalEnvId" column="OPERATIONAL_ENV_ID" type="string" length="45" />
- <key-property name="serviceModelVersionId" column="SERVICE_MODEL_VERSION_ID" type="string" length="45"/>
- <key-property name="requestId" column="REQUEST_ID" type="string" length="45"/>
- </composite-id>
-
- <property name="serviceModelVersionDistrStatus" type="string">
- <column name="SERVICE_MOD_VER_FINAL_DISTR_STATUS" length="45"/>
- </property>
- <property name="recoveryAction" type="string">
- <column name="RECOVERY_ACTION" length="30" />
- </property>
- <property name="retryCount" type="integer">
- <column name="RETRY_COUNT_LEFT"/>
- </property>
- <property name="workloadContext" type="string">
- <column name="WORKLOAD_CONTEXT" length="80" />
- </property>
- <property name="createTime" type="timestamp">
- <column name="CREATE_TIME"/>
- </property>
- <property name="modifyTime" type="timestamp">
- <column name="MODIFY_TIME"/>
- </property>
-
- </class>
-</hibernate-mapping> \ No newline at end of file
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
deleted file mode 100644
index 22d147402d..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/ResourceOperationStatus.hbm.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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=========================================================
- */
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.openecomp.mso.requestsdb">
- <class name="ResourceOperationStatus" table="RESOURCE_OPERATION_STATUS">
- <meta attribute="class-description">
- This class describes a progress status
- </meta>
- <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"/>
- <property name="status" column="STATUS" type="string" length="256"/>
- <property name="progress" column="PROGRESS" type="string" length="256"/>
- <property name="errorCode" column="ERROR_CODE" type="string" length="256"/>
- <property name="statusDescription" column="STATUS_DESCRIPOTION" type="string" length="256"/>
- </class>
-</hibernate-mapping>
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/SiteStatus.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/SiteStatus.hbm.xml
deleted file mode 100644
index f755ad0b0b..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/SiteStatus.hbm.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP 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=========================================================
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.openecomp.mso.requestsdb">
- <class name="SiteStatus" table="SITE_STATUS">
- <meta attribute="class-description">
- This class describes a Site Status
- </meta>
-
- <id name="siteName" type="string" column="SITE_NAME"/>
-
- <property name="status" column="STATUS" type="boolean" length="256"/>
- <property name="created" type="timestamp" generated="insert" insert="false" update="false" not-null="true">
- <column name="CREATION_TIMESTAMP" default="CURRENT_TIMESTAMP"/>
- </property>
- </class>
-</hibernate-mapping>
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogComponentDistributionStatus.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogComponentDistributionStatus.hbm.xml
deleted file mode 100644
index ea66153157..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogComponentDistributionStatus.hbm.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP 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=========================================================
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Generated Jul 27, 2015 3:05:00 PM by Hibernate Tools 3.4.0.CR1 -->
-<hibernate-mapping>
- <class name="org.openecomp.mso.requestsdb.WatchdogComponentDistributionStatus" table="WATCHDOG_PER_COMPONENT_DISTRIBUTION_STATUS">
-
- <composite-id>
- <key-property name="distributionId" column="DISTRIBUTION_ID" type="string" length="45" />
- <key-property name="componentName" column="COMPONENT_NAME" type="string" length="45"/>
- </composite-id>
-
- <property name="componentDistributionStatus" type="string">
- <column name="COMPONENT_DISTRIBUTION_STATUS" length="45" />
- </property>
-
- <property name="createTime" type="timestamp">
- <column name="CREATE_TIME"/>
- </property>
-
- <property name="modifyTime" type="timestamp">
- <column name="MODIFY_TIME"/>
- </property>
-
- </class>
-</hibernate-mapping> \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogDistributionStatus.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogDistributionStatus.hbm.xml
deleted file mode 100644
index 2da3071c71..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogDistributionStatus.hbm.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP 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=========================================================
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Generated Jul 27, 2015 3:05:00 PM by Hibernate Tools 3.4.0.CR1 -->
-<hibernate-mapping>
- <class name="org.openecomp.mso.requestsdb.WatchdogDistributionStatus" table="WATCHDOG_DISTRIBUTIONID_STATUS">
-
- <id name="distributionId" type="string">
- <column name="DISTRIBUTION_ID" length="45"/>
- <generator class="assigned"/>
- </id>
-
- <property name="distributionIdStatus" type="string">
- <column name="DISTRIBUTION_ID_STATUS" length="45" />
- </property>
-
- <property name="createTime" type="timestamp">
- <column name="CREATE_TIME"/>
- </property>
-
- <property name="modifyTime" type="timestamp">
- <column name="MODIFY_TIME"/>
- </property>
-
- </class>
-</hibernate-mapping> \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogServiceModVerIdLookup.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogServiceModVerIdLookup.hbm.xml
deleted file mode 100644
index b6b1d9bf58..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/WatchdogServiceModVerIdLookup.hbm.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP 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=========================================================
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Generated Jul 27, 2015 3:05:00 PM by Hibernate Tools 3.4.0.CR1 -->
-<hibernate-mapping>
- <class name="org.openecomp.mso.requestsdb.WatchdogServiceModVerIdLookup" table="WATCHDOG_SERVICE_MOD_VER_ID_LOOKUP">
-
- <composite-id>
- <key-property name="distributionId" column="DISTRIBUTION_ID" type="string" length="45" />
- <key-property name="serviceModelVersionId" column="SERVICE_MODEL_VERSION_ID" type="string" length="45"/>
- </composite-id>
-
- <property name="createTime" type="timestamp">
- <column name="CREATE_TIME"/>
- </property>
-
- </class>
-</hibernate-mapping> \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/beans.xml b/mso-api-handlers/mso-requests-db/src/main/resources/beans.xml
new file mode 100644
index 0000000000..cd1bc8b7d7
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/resources/beans.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jpa="http://www.springframework.org/schema/data/jpa"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/data/jpa
+ http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
+
+ <jpa:repositories base-package="org.onap.so.db.request.data.repository" />
+
+</beans> \ No newline at end of file
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
deleted file mode 100644
index 1305dfb97b..0000000000
--- a/mso-api-handlers/mso-requests-db/src/main/resources/hibernate-requests-core-mysql.cfg.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP 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=========================================================
- -->
-
-<!DOCTYPE hibernate-configuration PUBLIC
- "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
-<hibernate-configuration>
- <session-factory>
- <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
- <property name="hibernate.show_sql">false</property>
- <property name="hibernate.format_sql">true</property>
- <property name="connection.datasource">java:jboss/datasources/mso-requests</property>
-
-<!-- <property name="hibernate.hbm2ddl.auto">create</property> -->
-
- <mapping resource="InfraActiveRequests.hbm.xml"></mapping>
- <mapping resource="OperationalEnvServiceModelStatus.hbm.xml"></mapping>
- <mapping resource="OperationalEnvDistributionStatus.hbm.xml"></mapping>
- <mapping resource="OperationStatus.hbm.xml"></mapping>
- <mapping resource="ResourceOperationStatus.hbm.xml"></mapping>
- <mapping resource="SiteStatus.hbm.xml"></mapping>
- <mapping resource="WatchdogDistributionStatus.hbm.xml"></mapping>
- <mapping resource="WatchdogComponentDistributionStatus.hbm.xml"></mapping>
- <mapping resource="WatchdogServiceModVerIdLookup.hbm.xml"></mapping>
- </session-factory>
-</hibernate-configuration>