summaryrefslogtreecommitdiffstats
path: root/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@est.tech>2023-01-20 15:13:37 +0000
committerwaqas.ikram <waqas.ikram@est.tech>2023-01-20 15:17:06 +0000
commit80d8598e1013ddee747957adf7d96ec7fb901f0b (patch)
tree22abb6785bff62898b596012decb777d467377bc /so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java
parent636794685ae4ff2a5f802fbffdffabbe6bcae164 (diff)
Adding so cnfm database module
Change-Id: I2eebd5ed356b879f485aad4dd5e6bf46df3ed69b Issue-ID: SO-4068 Signed-off-by: waqas.ikram <waqas.ikram@est.tech>
Diffstat (limited to 'so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java')
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsDeploymentItem.java277
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsInst.java381
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsLcmOpOcc.java250
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsLcmOpType.java28
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsLifecycleParam.java134
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/CancelModeType.java29
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/Job.java262
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/JobAction.java29
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/JobStatus.java155
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/JobStatusEnum.java29
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/OperationStateEnum.java29
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/State.java29
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/utils/Utils.java59
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/config/CnfmDatabaseConfiguration.java95
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/AsDeploymentItemRepository.java50
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/AsInstRepository.java46
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/AsLcmOpOccRepository.java43
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/AsLifecycleParamRepository.java38
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/JobRepository.java35
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/JobStatusRepository.java30
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/RefreshableRepository.java30
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/RefreshableRepositoryImpl.java42
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/service/DatabaseServiceProvider.java201
23 files changed, 2301 insertions, 0 deletions
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsDeploymentItem.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsDeploymentItem.java
new file mode 100644
index 0000000..c27aaad
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsDeploymentItem.java
@@ -0,0 +1,277 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.beans;
+
+import static org.onap.so.cnfm.lcm.database.beans.utils.Utils.toIndentedString;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.UUID;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+
+/**
+ *
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+@Entity
+@Table(name = "AS_DEPLOYMENT_ITEM")
+public class AsDeploymentItem {
+
+ @Id
+ @Column(name = "AS_DEP_ITEM_INST_ID", nullable = false)
+ private String asDeploymentItemInstId;
+
+ @Column(name = "NAME")
+ private String name;
+
+ @Column(name = "ITEM_ID")
+ private String itemId;
+
+ @Column(name = "DEPLOYMENT_ORDER")
+ private Integer deploymentOrder;
+
+ @Column(name = "ARTIFACT_FILE_PATH")
+ private String artifactFilePath;
+
+ @Enumerated(EnumType.STRING)
+ @Column(name = "STATUS", nullable = false)
+ private State status;
+
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "AS_INST_ID", nullable = false)
+ private AsInst asInst;
+
+ @Column(name = "CREATE_TIME")
+ private LocalDateTime createTime;
+
+ @Column(name = "LAST_UPDATE_TIME")
+ private LocalDateTime lastUpdateTime;
+
+ @Column(name = "RELEASE_NAME", nullable = false)
+ private String releaseName;
+
+ @OneToMany(mappedBy = "asDeploymentItemInst", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ private List<AsLifecycleParam> asLifecycleParams = new ArrayList<>();
+
+ public AsDeploymentItem() {
+ this.asDeploymentItemInstId = UUID.randomUUID().toString();
+ }
+
+ public String getAsDeploymentItemInstId() {
+ return asDeploymentItemInstId;
+ }
+
+ public void setAsDeploymentItemInstId(final String asDeploymentItemInstId) {
+ this.asDeploymentItemInstId = asDeploymentItemInstId;
+ }
+
+ public AsDeploymentItem asDeploymentItemInstId(final String asDeploymentItemInstId) {
+ this.asDeploymentItemInstId = asDeploymentItemInstId;
+ return this;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public AsDeploymentItem name(final String name) {
+ this.name = name;
+ return this;
+ }
+
+ public String getItemId() {
+ return itemId;
+ }
+
+ public void setItemId(final String itemId) {
+ this.itemId = itemId;
+ }
+
+ public AsDeploymentItem itemId(final String itemId) {
+ this.itemId = itemId;
+ return this;
+ }
+
+ public Integer getDeploymentOrder() {
+ return deploymentOrder;
+ }
+
+ public void setDeploymentOrder(final Integer deploymentOrder) {
+ this.deploymentOrder = deploymentOrder;
+ }
+
+ public AsDeploymentItem deploymentOrder(final Integer deploymentOrder) {
+ this.deploymentOrder = deploymentOrder;
+ return this;
+ }
+
+ public String getArtifactFilePath() {
+ return artifactFilePath;
+ }
+
+ public void setArtifactFilePath(final String artifactFilePath) {
+ this.artifactFilePath = artifactFilePath;
+ }
+
+ public AsDeploymentItem artifactFilePath(final String artifactFilePath) {
+ this.artifactFilePath = artifactFilePath;
+ return this;
+ }
+
+ public State getStatus() {
+ return status;
+ }
+
+ public void setStatus(final State status) {
+ this.status = status;
+ }
+
+ public AsDeploymentItem status(final State status) {
+ this.status = status;
+ return this;
+ }
+
+
+ public AsInst getAsInst() {
+ return asInst;
+ }
+
+ public void setAsInst(final AsInst asInst) {
+ this.asInst = asInst;
+ }
+
+ public AsDeploymentItem asInst(final AsInst asInst) {
+ this.asInst = asInst;
+ return this;
+ }
+
+ public LocalDateTime getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(final LocalDateTime createTime) {
+ this.createTime = createTime;
+ }
+
+ public AsDeploymentItem createTime(final LocalDateTime createTime) {
+ this.createTime = createTime;
+ return this;
+ }
+
+ public LocalDateTime getLastUpdateTime() {
+ return lastUpdateTime;
+ }
+
+ public void setLastUpdateTime(final LocalDateTime lastUpdateTime) {
+ this.lastUpdateTime = lastUpdateTime;
+ }
+
+ public AsDeploymentItem lastUpdateTime(final LocalDateTime lastUpdateTime) {
+ this.lastUpdateTime = lastUpdateTime;
+ return this;
+ }
+
+ public String getReleaseName() {
+ return releaseName;
+ }
+
+ public void setReleaseName(final String releaseName) {
+ this.releaseName = releaseName;
+ }
+
+ public AsDeploymentItem releaseName(final String releaseName) {
+ this.releaseName = releaseName;
+ return this;
+ }
+
+ public List<AsLifecycleParam> getAsLifecycleParams() {
+ return asLifecycleParams;
+ }
+
+ public void setAsLifecycleParams(final List<AsLifecycleParam> asLifecycleParams) {
+ this.asLifecycleParams = asLifecycleParams;
+ }
+
+ public AsDeploymentItem asLifecycleParams(final AsLifecycleParam asLifecycleParam) {
+ asLifecycleParam.asDeploymentItemInst(this);
+ this.asLifecycleParams.add(asLifecycleParam);
+ return this;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ final AsDeploymentItem that = (AsDeploymentItem) o;
+ return Objects.equals(asDeploymentItemInstId, that.asDeploymentItemInstId) && Objects.equals(name, that.name)
+ && Objects.equals(itemId, that.itemId) && Objects.equals(deploymentOrder, that.deploymentOrder)
+ && Objects.equals(artifactFilePath, that.artifactFilePath)
+ && (asInst == null ? that.asInst == null : that.asInst != null && Objects.equals(asInst, that.asInst))
+ && Objects.equals(status, that.status) && Objects.equals(createTime, that.createTime)
+ && Objects.equals(lastUpdateTime, that.lastUpdateTime) && Objects.equals(releaseName, that.releaseName)
+ && Objects.equals(asLifecycleParams, that.asLifecycleParams);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(asDeploymentItemInstId, name, itemId, deploymentOrder, artifactFilePath, status, asInst,
+ createTime, lastUpdateTime, releaseName, asLifecycleParams);
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class AsdeploymentItem {\n");
+ sb.append(" asDeploymentItemInstId: ").append(toIndentedString(asDeploymentItemInstId)).append("\n");
+ sb.append(" name: ").append(toIndentedString(name)).append("\n");
+ sb.append(" itemId: ").append(toIndentedString(itemId)).append("\n");
+ sb.append(" deploymentOrder: ").append(toIndentedString(deploymentOrder)).append("\n");
+ sb.append(" artifactFilePath: ").append(toIndentedString(artifactFilePath)).append("\n");
+ sb.append(" asInst: ").append(asInst != null ? toIndentedString(asInst.getAsInstId()) : null).append("\n");
+ sb.append(" status: ").append(toIndentedString(status)).append("\n");
+ sb.append(" createTime: ").append(toIndentedString(createTime)).append("\n");
+ sb.append(" lastUpdateTime: ").append(toIndentedString(lastUpdateTime)).append("\n");
+ sb.append(" releaseName: ").append(toIndentedString(releaseName)).append("\n");
+ sb.append(" asLifecycleParams").append(toIndentedString(asLifecycleParams)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsInst.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsInst.java
new file mode 100644
index 0000000..e6538bc
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsInst.java
@@ -0,0 +1,381 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.beans;
+
+import static org.onap.so.cnfm.lcm.database.beans.utils.Utils.toIndentedString;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.UUID;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+@Entity
+@Table(name = "AS_INST")
+public class AsInst {
+
+ @Id
+ @Column(name = "AS_INST_ID", nullable = false)
+ private String asInstId;
+
+ @Column(name = "NAME", nullable = false)
+ private String name;
+
+ @Column(name = "DESCRIPTION", columnDefinition = "LONGTEXT")
+ private String description;
+
+ @Column(name = "AS_PACKAGE_ID")
+ private String asPackageId;
+
+ @Column(name = "ASD_ID", nullable = false)
+ private String asdId;
+
+ @Column(name = "ASD_INVARIANT_ID", nullable = false)
+ private String asdInvariantId;
+
+ @Column(name = "AS_PROVIDER", nullable = false)
+ private String asProvider;
+
+ @Column(name = "AS_APPLICATION_NAME", nullable = false)
+ private String asApplicationName;
+
+ @Column(name = "AS_APPLICATION_VERSION", nullable = false)
+ private String asApplicationVersion;
+
+ @Column(name = "SERVICE_INSTANCE_ID", nullable = false)
+ private String serviceInstanceId;
+
+ @Column(name = "SERVICE_INSTANCE_NAME", nullable = false)
+ private String serviceInstanceName;
+
+ @Column(name = "CLOUD_OWNER", nullable = false)
+ private String cloudOwner;
+
+ @Column(name = "CLOUD_REGION", nullable = false)
+ private String cloudRegion;
+
+ @Column(name = "TENANT_ID", nullable = false)
+ private String tenantId;
+
+ @Enumerated(EnumType.STRING)
+ @Column(name = "STATUS", nullable = false)
+ private State status;
+
+ @Column(name = "STATUS_UPDATED_TIME", nullable = false)
+ private LocalDateTime statusUpdatedTime;
+
+ @OneToMany(mappedBy = "asInst", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ private List<AsDeploymentItem> asdeploymentItems = new ArrayList<>();
+
+ public AsInst() {
+ this.asInstId = UUID.randomUUID().toString();
+ }
+
+ public String getAsInstId() {
+ return asInstId;
+ }
+
+ public void setAsInstId(final String asInstId) {
+ this.asInstId = asInstId;
+ }
+
+ public AsInst asInstId(final String asInstId) {
+ this.asInstId = asInstId;
+ return this;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public AsInst name(final String name) {
+ this.name = name;
+ return this;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(final String description) {
+ this.description = description;
+ }
+
+ public AsInst description(final String description) {
+ this.description = description;
+ return this;
+ }
+
+ public String getAsPackageId() {
+ return asPackageId;
+ }
+
+ public void setAsPackageId(final String asPackageId) {
+ this.asPackageId = asPackageId;
+ }
+
+ public AsInst asPackageId(final String asPackageId) {
+ this.asPackageId = asPackageId;
+ return this;
+ }
+
+ public String getAsdId() {
+ return asdId;
+ }
+
+ public void setAsdId(final String asdId) {
+ this.asdId = asdId;
+ }
+
+ public AsInst asdId(final String asdId) {
+ this.asdId = asdId;
+ return this;
+ }
+
+ public String getAsdInvariantId() {
+ return asdInvariantId;
+ }
+
+ public void setAsdInvariantId(final String asdInvariantId) {
+ this.asdInvariantId = asdInvariantId;
+ }
+
+ public AsInst asdInvariantId(final String nsdInvariantId) {
+ this.asdInvariantId = nsdInvariantId;
+ return this;
+ }
+
+ public String getAsProvider() {
+ return asProvider;
+ }
+
+ public void setAsProvider(final String asProvider) {
+ this.asProvider = asProvider;
+ }
+
+ public AsInst asProvider(final String asProvider) {
+ this.asProvider = asProvider;
+ return this;
+ }
+
+ public String getAsApplicationName() {
+ return asApplicationName;
+ }
+
+ public void setAsApplicationName(final String asApplicationName) {
+ this.asApplicationName = asApplicationName;
+ }
+
+ public AsInst asApplicationName(final String asApplicationName) {
+ this.asApplicationName = asApplicationName;
+ return this;
+ }
+
+ public String getAsApplicationVersion() {
+ return asApplicationVersion;
+ }
+
+ public void setAsApplicationVersion(final String asApplicationVersion) {
+ this.asApplicationVersion = asApplicationVersion;
+ }
+
+ public AsInst asApplicationVersion(final String asApplicationVersion) {
+ this.asApplicationVersion = asApplicationVersion;
+ return this;
+ }
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(final String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public AsInst serviceInstanceId(final String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ return this;
+ }
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public void setServiceInstanceName(final String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+
+ public AsInst serviceInstanceName(final String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ return this;
+ }
+
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(final String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
+ public AsInst cloudOwner(final String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ return this;
+ }
+
+ public String getCloudRegion() {
+ return cloudRegion;
+ }
+
+ public void setCloudRegion(final String cloudRegion) {
+ this.cloudRegion = cloudRegion;
+ }
+
+ public AsInst cloudRegion(final String cloudRegion) {
+ this.cloudRegion = cloudRegion;
+ return this;
+ }
+
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ public void setTenantId(final String tenantId) {
+ this.tenantId = tenantId;
+ }
+
+ public AsInst tenantId(final String tenantId) {
+ this.tenantId = tenantId;
+ return this;
+ }
+
+ public State getStatus() {
+ return status;
+ }
+
+ public void setStatus(final State status) {
+ this.status = status;
+ }
+
+ public AsInst status(final State status) {
+ this.status = status;
+ return this;
+ }
+
+ public LocalDateTime getStatusUpdatedTime() {
+ return statusUpdatedTime;
+ }
+
+ public void setStatusUpdatedTime(final LocalDateTime statusUpdatedTime) {
+ this.statusUpdatedTime = statusUpdatedTime;
+ }
+
+ public AsInst statusUpdatedTime(final LocalDateTime statusUpdatedTime) {
+ this.statusUpdatedTime = statusUpdatedTime;
+ return this;
+ }
+
+ public List<AsDeploymentItem> getAsdeploymentItems() {
+ return asdeploymentItems;
+ }
+
+ public void setAsdeploymentItems(final List<AsDeploymentItem> asdeploymentItems) {
+ this.asdeploymentItems = asdeploymentItems;
+ }
+
+ public AsInst asdeploymentItems(final AsDeploymentItem asdeploymentItem) {
+ asdeploymentItem.asInst(this);
+ this.asdeploymentItems.add(asdeploymentItem);
+ return this;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(asInstId, name, description, asPackageId, asdId, asdInvariantId, asProvider,
+ asApplicationName, asApplicationVersion, serviceInstanceId, serviceInstanceName, cloudOwner,
+ cloudRegion, tenantId, status, statusUpdatedTime, asdeploymentItems);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null || getClass() != obj.getClass())
+ return false;
+ if (obj instanceof AsInst) {
+ final AsInst other = (AsInst) obj;
+ return Objects.equals(asInstId, other.asInstId) && Objects.equals(name, other.name)
+ && Objects.equals(description, other.description) && Objects.equals(asPackageId, other.asPackageId)
+ && Objects.equals(asdId, other.asdId) && Objects.equals(asdInvariantId, other.asdInvariantId)
+ && Objects.equals(asProvider, other.asProvider)
+ && Objects.equals(asApplicationName, other.asApplicationName)
+ && Objects.equals(asApplicationVersion, other.asApplicationVersion)
+ && Objects.equals(serviceInstanceId, other.serviceInstanceId)
+ && Objects.equals(serviceInstanceName, other.serviceInstanceName)
+ && Objects.equals(cloudOwner, other.cloudOwner) && Objects.equals(cloudRegion, other.cloudRegion)
+ && Objects.equals(tenantId, other.tenantId) && Objects.equals(status, other.status)
+ && Objects.equals(statusUpdatedTime, other.statusUpdatedTime)
+ && Objects.equals(asdeploymentItems, other.asdeploymentItems);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class AsInst {\n");
+ sb.append(" asInstId: ").append(toIndentedString(asInstId)).append("\n");
+ sb.append(" name: ").append(toIndentedString(name)).append("\n");
+ sb.append(" description: ").append(toIndentedString(description)).append("\n");
+ sb.append(" asPackageId: ").append(toIndentedString(asPackageId)).append("\n");
+ sb.append(" asdId: ").append(toIndentedString(asdId)).append("\n");
+ sb.append(" asProvider: ").append(toIndentedString(asProvider)).append("\n");
+ sb.append(" asApplicationName: ").append(toIndentedString(asApplicationName)).append("\n");
+ sb.append(" asApplicationVersion: ").append(toIndentedString(asApplicationVersion)).append("\n");
+ sb.append(" serviceInstanceId: ").append(toIndentedString(serviceInstanceId)).append("\n");
+ sb.append(" serviceInstanceName: ").append(toIndentedString(serviceInstanceName)).append("\n");
+ sb.append(" cloudOwner: ").append(toIndentedString(cloudOwner)).append("\n");
+ sb.append(" cloudRegion: ").append(toIndentedString(cloudRegion)).append("\n");
+ sb.append(" tenantId: ").append(toIndentedString(tenantId)).append("\n");
+ sb.append(" status: ").append(toIndentedString(status)).append("\n");
+ sb.append(" statusUpdatedTime: ").append(toIndentedString(statusUpdatedTime)).append("\n");
+ sb.append(" asdeploymentItems: ").append(toIndentedString(asdeploymentItems)).append("\n");
+
+ sb.append("}");
+ return sb.toString();
+ }
+
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsLcmOpOcc.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsLcmOpOcc.java
new file mode 100644
index 0000000..b064170
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsLcmOpOcc.java
@@ -0,0 +1,250 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.beans;
+
+import static org.onap.so.cnfm.lcm.database.beans.utils.Utils.toIndentedString;
+import java.time.LocalDateTime;
+import java.util.Objects;
+import java.util.UUID;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ */
+@Entity
+@Table(name = "AS_LCM_OP_OCCS")
+public class AsLcmOpOcc {
+
+ @Id
+ @Column(name = "ID", nullable = false)
+ private String id;
+
+ @Enumerated(EnumType.STRING)
+ @Column(name = "OPERATION_STATE", nullable = false)
+ private OperationStateEnum operationState;
+
+ @Column(name = "STATE_ENTERED_TIME")
+ private LocalDateTime stateEnteredTime;
+
+ @Column(name = "START_TIME")
+ private LocalDateTime startTime;
+
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "AS_INST_ID", nullable = false)
+ private AsInst asInst;
+
+ @Enumerated(EnumType.STRING)
+ @Column(name = "OPERATION", nullable = false)
+ private AsLcmOpType operation;
+
+ @Column(name = "IS_AUTO_INVOCATION", nullable = false)
+ private boolean isAutoInvocation;
+
+ @Column(name = "OPERATION_PARAMS", columnDefinition = "LONGTEXT", nullable = false)
+ private String operationParams;
+
+ @Column(name = "IS_CANCEL_PENDING", nullable = false)
+ private boolean isCancelPending;
+
+ @Enumerated(EnumType.STRING)
+ @Column(name = "CANCEL_MODE")
+ private CancelModeType cancelMode;
+
+ public AsLcmOpOcc() {
+ this.id = UUID.randomUUID().toString();
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(final String id) {
+ this.id = id;
+ }
+
+ public AsLcmOpOcc id(final String id) {
+ this.id = id;
+ return this;
+ }
+
+ public OperationStateEnum getOperationState() {
+ return operationState;
+ }
+
+ public void setOperationState(final OperationStateEnum operationState) {
+ this.operationState = operationState;
+ }
+
+ public AsLcmOpOcc operationState(final OperationStateEnum operationState) {
+ this.operationState = operationState;
+ return this;
+ }
+
+ public LocalDateTime getStateEnteredTime() {
+ return stateEnteredTime;
+ }
+
+ public void setStateEnteredTime(final LocalDateTime stateEnteredTime) {
+ this.stateEnteredTime = stateEnteredTime;
+ }
+
+ public AsLcmOpOcc stateEnteredTime(final LocalDateTime stateEnteredTime) {
+ this.stateEnteredTime = stateEnteredTime;
+ return this;
+ }
+
+ public LocalDateTime getStartTime() {
+ return startTime;
+ }
+
+ public void setStartTime(final LocalDateTime startTime) {
+ this.startTime = startTime;
+ }
+
+ public AsLcmOpOcc startTime(final LocalDateTime startTime) {
+ this.startTime = startTime;
+ return this;
+ }
+
+ public AsInst getAsInst() {
+ return asInst;
+ }
+
+ public void setAsInst(final AsInst asInst) {
+ this.asInst = asInst;
+ }
+
+ public AsLcmOpOcc asInst(final AsInst asInst) {
+ this.asInst = asInst;
+ return this;
+ }
+
+ public AsLcmOpType getOperation() {
+ return operation;
+ }
+
+ public void setOperation(final AsLcmOpType operation) {
+ this.operation = operation;
+ }
+
+ public AsLcmOpOcc operation(final AsLcmOpType operation) {
+ this.operation = operation;
+ return this;
+ }
+
+ public boolean getIsAutoInvocation() {
+ return isAutoInvocation;
+ }
+
+ public void setIsAutoInvocation(final boolean isAutoInvocation) {
+ this.isAutoInvocation = isAutoInvocation;
+ }
+
+ public AsLcmOpOcc isAutoInvocation(final boolean isAutoInvocation) {
+ this.isAutoInvocation = isAutoInvocation;
+ return this;
+ }
+
+ public CancelModeType getCancelMode() {
+ return cancelMode;
+ }
+
+ public void setCancelMode(final CancelModeType cancelMode) {
+ this.cancelMode = cancelMode;
+ }
+
+ public AsLcmOpOcc cancelMode(final CancelModeType cancelMode) {
+ this.cancelMode = cancelMode;
+ return this;
+ }
+
+ public String getOperationParams() {
+ return operationParams;
+ }
+
+ public void setOperationParams(final String operationParams) {
+ this.operationParams = operationParams;
+ }
+
+ public AsLcmOpOcc operationParams(final String operationParams) {
+ this.operationParams = operationParams;
+ return this;
+ }
+
+ public boolean getIsCancelPending() {
+ return isCancelPending;
+ }
+
+ public void setIsCancelPending(final boolean isCancelPending) {
+ this.isCancelPending = isCancelPending;
+ }
+
+ public AsLcmOpOcc isCancelPending(final boolean isCancelPending) {
+ this.isCancelPending = isCancelPending;
+ return this;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null || getClass() != obj.getClass())
+ return false;
+ final AsLcmOpOcc that = (AsLcmOpOcc) obj;
+ return Objects.equals(id, that.id) && Objects.equals(operationState, that.operationState)
+ && Objects.equals(stateEnteredTime, that.stateEnteredTime) && Objects.equals(startTime, that.startTime)
+ && (asInst == null ? that.asInst == null : that.asInst != null && Objects.equals(asInst, that.asInst))
+ && Objects.equals(operation, that.operation) && Objects.equals(isAutoInvocation, that.isAutoInvocation)
+ && Objects.equals(operationParams, that.operationParams)
+ && Objects.equals(isCancelPending, that.isCancelPending) && Objects.equals(cancelMode, that.cancelMode);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, operationState, stateEnteredTime, startTime, asInst != null ? asInst.getAsInstId() : 0,
+ operation, isAutoInvocation, operationParams, isCancelPending, cancelMode);
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class NsLcmOpOcc {\n");
+ sb.append(" id: ").append(toIndentedString(id)).append("\n");
+ sb.append(" operationState: ").append(toIndentedString(operationState)).append("\n");
+ sb.append(" stateEnteredTime: ").append(toIndentedString(stateEnteredTime)).append("\n");
+ sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n");
+ sb.append(" asInstId: ").append(asInst != null ? toIndentedString(asInst.getAsInstId()) : null).append("\n");
+ sb.append(" operation: ").append(toIndentedString(operation)).append("\n");
+ sb.append(" isAutoInvocation: ").append(toIndentedString(isAutoInvocation)).append("\n");
+ sb.append(" operationParams: ").append(toIndentedString(operationParams)).append("\n");
+ sb.append(" isCancelPending: ").append(toIndentedString(isCancelPending)).append("\n");
+ sb.append(" cancelMode: ").append(toIndentedString(cancelMode)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsLcmOpType.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsLcmOpType.java
new file mode 100644
index 0000000..2d242bb
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsLcmOpType.java
@@ -0,0 +1,28 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.beans;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public enum AsLcmOpType {
+ INSTANTIATE, TERMINATE, OPERATE;
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsLifecycleParam.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsLifecycleParam.java
new file mode 100644
index 0000000..607886c
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsLifecycleParam.java
@@ -0,0 +1,134 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.cnfm.lcm.database.beans;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import java.util.Objects;
+import static org.onap.so.cnfm.lcm.database.beans.utils.Utils.toIndentedString;
+
+/**
+ *
+ * @author Gerard Nugent (gerard.nugent@est.tech)
+ *
+ */
+@Entity
+@Table(name = "AS_LIFECYCLE_PARAM")
+public class AsLifecycleParam {
+
+ @Id
+ @Column(name = "AS_LCP_ID", nullable = false)
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Integer asLifecycleParamId;
+
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "AS_DEP_ITEM_INST_ID", nullable = false)
+ private AsDeploymentItem asDeploymentItemInst;
+
+ @Column(name = "LIFECYCLE_PARAM")
+ private String lifecycleParam;
+
+ public AsLifecycleParam() {
+
+ }
+
+ public void setAsLifecycleParamId(final Integer asLifecycleParamId) {
+ this.asLifecycleParamId = asLifecycleParamId;
+ }
+
+ public Integer getAsLifecycleParamId() {
+ return asLifecycleParamId;
+ }
+
+ public AsLifecycleParam asLifecycleParamId(final Integer asLifecycleParamId) {
+ this.asLifecycleParamId = asLifecycleParamId;
+ return this;
+ }
+
+ public AsDeploymentItem getAsDeploymentItemInst() {
+ return asDeploymentItemInst;
+ }
+
+ public void setAsDeploymentItemInst(final AsDeploymentItem asDeploymentItemInst) {
+ this.asDeploymentItemInst = asDeploymentItemInst;
+ }
+
+ public AsLifecycleParam asDeploymentItemInst(final AsDeploymentItem asDeploymentItemInst) {
+ this.asDeploymentItemInst = asDeploymentItemInst;
+ return this;
+ }
+
+ public String getLifecycleParam() {
+ return lifecycleParam;
+ }
+
+ public void setLifecycleParam(final String lifecycleParam) {
+ this.lifecycleParam = lifecycleParam;
+ }
+
+ public AsLifecycleParam asLifecycleParam(final String lifecycleParam) {
+ this.lifecycleParam = lifecycleParam;
+ return this;
+ }
+
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class AslifecycleParam {\n");
+ sb.append(" asLifecycleParamId: ").append(toIndentedString(asLifecycleParamId)).append("\n");
+ sb.append(" asDeploymentItemInstId: ")
+ .append(asDeploymentItemInst != null
+ ? toIndentedString(asDeploymentItemInst.getAsDeploymentItemInstId())
+ : null)
+ .append("\n");
+ sb.append(" lifecycleParam: ").append(toIndentedString(lifecycleParam)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ final AsLifecycleParam that = (AsLifecycleParam) o;
+ return Objects.equals(asLifecycleParamId, that.asLifecycleParamId)
+ && Objects.equals(asDeploymentItemInst, that.asDeploymentItemInst)
+ && Objects.equals(lifecycleParam, that.lifecycleParam);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(asLifecycleParamId, asDeploymentItemInst, lifecycleParam);
+ }
+
+
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/CancelModeType.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/CancelModeType.java
new file mode 100644
index 0000000..2ada1af
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/CancelModeType.java
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.beans;
+
+/**
+ *
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public enum CancelModeType {
+ GRACEFUL, FORCEFUL;
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/Job.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/Job.java
new file mode 100644
index 0000000..5be8711
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/Job.java
@@ -0,0 +1,262 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.beans;
+
+import static org.onap.so.cnfm.lcm.database.beans.utils.Utils.isEquals;
+import static org.onap.so.cnfm.lcm.database.beans.utils.Utils.toIndentedString;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.UUID;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+@Entity
+@Table(name = "JOB")
+public class Job {
+
+ @Id
+ @Column(name = "JOB_ID", nullable = false)
+ private String jobId;
+
+ @Column(name = "JOB_TYPE", nullable = false)
+ private String jobType;
+
+ @Enumerated(EnumType.STRING)
+ @Column(name = "JOB_ACTION", nullable = false)
+ private JobAction jobAction;
+
+ @Column(name = "RESOURCE_ID", nullable = false)
+ private String resourceId;
+
+ @Column(name = "RESOURCE_NAME")
+ private String resourceName;
+
+ @Enumerated(EnumType.STRING)
+ @Column(name = "STATUS", nullable = false)
+ private JobStatusEnum status;
+
+ @Column(name = "START_TIME")
+ private LocalDateTime startTime;
+
+ @Column(name = "END_TIME")
+ private LocalDateTime endTime;
+
+ @Column(name = "PROCESS_INSTANCE_ID")
+ private String processInstanceId;
+
+ @OneToMany(mappedBy = "job", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
+ private List<JobStatus> jobStatuses = new ArrayList<>();
+
+ public Job() {
+ this.jobId = UUID.randomUUID().toString();
+ }
+
+ public void setJobId(final String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public Job jobId(final String jobId) {
+ this.jobId = jobId;
+ return this;
+ }
+
+ public String getJobType() {
+ return jobType;
+ }
+
+ public void setJobType(final String jobType) {
+ this.jobType = jobType;
+ }
+
+ public Job jobType(final String jobType) {
+ this.jobType = jobType;
+ return this;
+ }
+
+ public JobAction getJobAction() {
+ return jobAction;
+ }
+
+ public void setJobAction(final JobAction jobAction) {
+ this.jobAction = jobAction;
+ }
+
+ public Job jobAction(final JobAction jobAction) {
+ this.jobAction = jobAction;
+ return this;
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public void setResourceId(final String resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ public Job resourceId(final String resourceId) {
+ this.resourceId = resourceId;
+ return this;
+ }
+
+ public JobStatusEnum getStatus() {
+ return status;
+ }
+
+ public void setStatus(final JobStatusEnum status) {
+ this.status = status;
+ }
+
+ public Job status(final JobStatusEnum status) {
+ this.status = status;
+ return this;
+ }
+
+ public LocalDateTime getStartTime() {
+ return startTime;
+ }
+
+ public void setStartTime(final LocalDateTime startTime) {
+ this.startTime = startTime;
+ }
+
+ public Job startTime(final LocalDateTime startTime) {
+ this.startTime = startTime;
+ return this;
+ }
+
+ public LocalDateTime getEndTime() {
+ return endTime;
+ }
+
+ public void setEndTime(final LocalDateTime endTime) {
+ this.endTime = endTime;
+ }
+
+ public Job endTime(final LocalDateTime endTime) {
+ this.endTime = endTime;
+ return this;
+ }
+
+ public String getProcessInstanceId() {
+ return processInstanceId;
+ }
+
+ public void setProcessInstanceId(final String processInstanceId) {
+ this.processInstanceId = processInstanceId;
+ }
+
+ public Job processInstanceId(final String processInstanceId) {
+ this.processInstanceId = processInstanceId;
+ return this;
+ }
+
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ public void setResourceName(final String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ public Job resourceName(final String resourceName) {
+ this.resourceName = resourceName;
+ return this;
+ }
+
+ public List<JobStatus> getJobStatuses() {
+ return jobStatuses;
+ }
+
+ public void setJobStatuses(final List<JobStatus> jobStatuses) {
+ this.jobStatuses = jobStatuses;
+ }
+
+ public Job jobStatuses(final List<JobStatus> jobStatuses) {
+ this.jobStatuses = jobStatuses;
+ return this;
+ }
+
+ public Job jobStatus(final JobStatus jobStatus) {
+ jobStatus.setJob(this);
+ this.jobStatuses.add(jobStatus);
+ return this;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(jobId, processInstanceId, jobType, jobAction, startTime, endTime, status, resourceId,
+ resourceName, jobStatuses);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null || getClass() != obj.getClass())
+ return false;
+ if (obj instanceof Job) {
+ final Job other = (Job) obj;
+ return Objects.equals(jobId, other.jobId) && Objects.equals(processInstanceId, other.processInstanceId)
+ && Objects.equals(jobType, other.jobType) && Objects.equals(jobAction, other.jobAction)
+ && Objects.equals(status, other.status) && Objects.equals(startTime, other.startTime)
+ && Objects.equals(endTime, other.endTime) && Objects.equals(resourceId, other.resourceId)
+ && Objects.equals(resourceName, other.resourceName) && isEquals(jobStatuses, other.jobStatuses);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class Job {\n");
+ sb.append(" jobId: ").append(toIndentedString(jobId)).append("\n");
+ sb.append(" processInstanceId: ").append(toIndentedString(processInstanceId)).append("\n");
+ sb.append(" jobType: ").append(toIndentedString(jobType)).append("\n");
+ sb.append(" jobAction: ").append(toIndentedString(jobAction)).append("\n");
+ sb.append(" status: ").append(toIndentedString(status)).append("\n");
+ sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n");
+ sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n");
+ sb.append(" resId: ").append(toIndentedString(resourceId)).append("\n");
+ sb.append(" resName: ").append(toIndentedString(resourceName)).append("\n");
+ sb.append(" jobStatuses: ").append(toIndentedString(jobStatuses)).append("\n");
+
+ sb.append("}");
+ return sb.toString();
+ }
+
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/JobAction.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/JobAction.java
new file mode 100644
index 0000000..caa4b86
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/JobAction.java
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.beans;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public enum JobAction {
+ CREATE, INSTANTIATE, TERMINATE, DELETE;
+
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/JobStatus.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/JobStatus.java
new file mode 100644
index 0000000..c3b78d7
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/JobStatus.java
@@ -0,0 +1,155 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.beans;
+
+import static org.onap.so.cnfm.lcm.database.beans.utils.Utils.toIndentedString;
+import java.time.LocalDateTime;
+import java.util.Objects;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+@Entity
+@Table(name = "JOB_STATUS")
+public class JobStatus {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "ID")
+ private int id;
+
+ @Enumerated(EnumType.STRING)
+ @Column(name = "STATUS", nullable = false)
+ private JobStatusEnum status;
+
+ @Column(name = "DESCRIPTION", columnDefinition = "LONGTEXT")
+ private String description;
+
+ @Column(name = "UPDATED_TIME", nullable = false)
+ private LocalDateTime updatedTime;
+
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "JOB_ID", nullable = false)
+ private Job job;
+
+ public int getId() {
+ return id;
+ }
+
+ public JobStatusEnum getStatus() {
+ return status;
+ }
+
+ public void setStatus(final JobStatusEnum status) {
+ this.status = status;
+ }
+
+ public JobStatus status(final JobStatusEnum status) {
+ this.status = status;
+ return this;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(final String description) {
+ this.description = description;
+ }
+
+ public JobStatus description(final String description) {
+ this.description = description;
+ return this;
+ }
+
+ public LocalDateTime getUpdatedTime() {
+ return updatedTime;
+ }
+
+ public void setUpdatedTime(final LocalDateTime updatedTime) {
+ this.updatedTime = updatedTime;
+ }
+
+ public JobStatus updatedTime(final LocalDateTime addTime) {
+ this.updatedTime = addTime;
+ return this;
+ }
+
+ public Job getJob() {
+ return job;
+ }
+
+ public void setJob(final Job job) {
+ this.job = job;
+ }
+
+ public JobStatus job(final Job job) {
+ this.job = job;
+ return this;
+ }
+
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, status, updatedTime, description, job != null ? job.getJobId() : 0);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null || getClass() != obj.getClass())
+ return false;
+ if (obj instanceof JobStatus) {
+ final JobStatus other = (JobStatus) obj;
+ return Objects.equals(id, other.id) && Objects.equals(status, other.status)
+ && Objects.equals(updatedTime, other.updatedTime) && Objects.equals(description, other.description)
+ && (job == null ? other.job == null
+ : other.job != null && Objects.equals(job.getJobId(), other.job.getJobId()));
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class JobStatus {\n");
+ sb.append(" Id: ").append(toIndentedString(id)).append("\n");
+ sb.append(" status: ").append(toIndentedString(status)).append("\n");
+ sb.append(" descp: ").append(toIndentedString(description)).append("\n");
+ sb.append(" updatedTime: ").append(toIndentedString(updatedTime)).append("\n");
+ sb.append(" jobId: ").append(job != null ? toIndentedString(job.getJobId()) : "").append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/JobStatusEnum.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/JobStatusEnum.java
new file mode 100644
index 0000000..38fefb4
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/JobStatusEnum.java
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.beans;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public enum JobStatusEnum {
+ STARTING, STARTED, IN_PROGRESS, ERROR, FINISHED, FINISHED_WITH_ERROR;
+
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/OperationStateEnum.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/OperationStateEnum.java
new file mode 100644
index 0000000..0e8f6b1
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/OperationStateEnum.java
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.beans;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public enum OperationStateEnum {
+ PROCESSING, COMPLETED, PARTIALLY_COMPLETED, FAILED_TEMP, FAILED, ROLLING_BACK, ROLLED_BACK;
+
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/State.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/State.java
new file mode 100644
index 0000000..c49544e
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/State.java
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.beans;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public enum State {
+ NOT_INSTANTIATED, INSTANTIATING, INSTANTIATED, FAILED, TERMINATING;
+
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/utils/Utils.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/utils/Utils.java
new file mode 100644
index 0000000..4d40087
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/utils/Utils.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.beans.utils;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public class Utils {
+
+ private Utils() {}
+
+ public static final String toIndentedString(final Object object) {
+ return object == null ? "null" : object.toString().replace("\n", "\n ");
+ }
+
+
+ public static boolean isEquals(final List<?> first, final List<?> second) {
+ if (first == null) {
+ return second == null;
+ }
+
+ if (first.isEmpty()) {
+ return second.isEmpty();
+ }
+ if ((first != null && second != null) && (first.size() == second.size())) {
+ for (int index = 0; index < first.size(); index++) {
+ if (!Objects.equals(first.get(index), second.get(index))) {
+ return false;
+ }
+ }
+ return true;
+
+ }
+ return false;
+ }
+
+
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/config/CnfmDatabaseConfiguration.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/config/CnfmDatabaseConfiguration.java
new file mode 100644
index 0000000..62a90f8
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/config/CnfmDatabaseConfiguration.java
@@ -0,0 +1,95 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.config;
+
+import static org.slf4j.LoggerFactory.getLogger;
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+import org.onap.so.cnfm.lcm.database.beans.Job;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.autoconfigure.flyway.FlywayDataSource;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.jmx.export.MBeanExporter;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+@Configuration
+@EnableTransactionManagement
+@EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactory",
+ basePackages = {"org.onap.so.cnfm.lcm.database.repository"})
+public class CnfmDatabaseConfiguration {
+ private static final Logger logger = getLogger(CnfmDatabaseConfiguration.class);
+
+ private static final String PERSISTENCE_UNIT = "cnfm";
+ private static final String CNFM_DATA_SOURCE_QUALIFIER = "cnfmDataSource";
+
+ @Autowired(required = false)
+ private MBeanExporter mBeanExporter;
+
+ @Bean
+ @ConfigurationProperties(prefix = "spring.datasource.hikari.cnfm")
+ public HikariConfig cnfmDbConfig() {
+ logger.debug("Creating CNFM HikariConfig bean ... ");
+ return new HikariConfig();
+ }
+
+ @Primary
+ @FlywayDataSource
+ @Bean(name = CNFM_DATA_SOURCE_QUALIFIER)
+ public DataSource dataSource() {
+ if (mBeanExporter != null) {
+ mBeanExporter.addExcludedBean(CNFM_DATA_SOURCE_QUALIFIER);
+ }
+ logger.debug("Creating CNFM HikariDataSource bean ... ");
+ final HikariConfig hikariConfig = this.cnfmDbConfig();
+ return new HikariDataSource(hikariConfig);
+ }
+
+ @Primary
+ @Bean(name = "entityManagerFactory")
+ public LocalContainerEntityManagerFactoryBean entityManagerFactory(final EntityManagerFactoryBuilder builder,
+ @Qualifier(CNFM_DATA_SOURCE_QUALIFIER) final DataSource dataSource) {
+ return builder.dataSource(dataSource).packages(Job.class.getPackage().getName())
+ .persistenceUnit(PERSISTENCE_UNIT).build();
+ }
+
+ @Primary
+ @Bean(name = "transactionManager")
+ public PlatformTransactionManager transactionManager(
+ @Qualifier("entityManagerFactory") final EntityManagerFactory entityManagerFactory) {
+ return new JpaTransactionManager(entityManagerFactory);
+ }
+
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/AsDeploymentItemRepository.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/AsDeploymentItemRepository.java
new file mode 100644
index 0000000..8fa88b5
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/AsDeploymentItemRepository.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.repository;
+
+import java.util.List;
+import java.util.Optional;
+import org.onap.so.cnfm.lcm.database.beans.AsDeploymentItem;
+import org.onap.so.cnfm.lcm.database.beans.State;
+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;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ */
+public interface AsDeploymentItemRepository extends JpaRepository<AsDeploymentItem, String> {
+
+ Optional<AsDeploymentItem> findByAsDeploymentItemInstId(final String asDeploymentItemInstId);
+
+ List<AsDeploymentItem> findByAsInstAsInstId(final String asInstId);
+
+ List<AsDeploymentItem> findByAsInstAsInstIdAndName(final String asInstId, final String name);
+
+ @Modifying(clearAutomatically = true)
+ @Query("UPDATE AsDeploymentItem SET status = (:state) WHERE asDeploymentItemInstId = (:asDeploymentItemInstId)")
+ int updateAsDeploymentItemState(@Param("asDeploymentItemInstId") final String asInstId,
+ @Param("state") final State state);
+
+ @Modifying(clearAutomatically = true)
+ @Query("DELETE FROM AsDeploymentItem WHERE nfInstId = (:asInstId)")
+ void deleteAsDeploymentItemUsingAsInstId(@Param("asInstId") final String asInstId);
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/AsInstRepository.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/AsInstRepository.java
new file mode 100644
index 0000000..92e6ffd
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/AsInstRepository.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.repository;
+
+import java.util.Optional;
+import org.onap.so.cnfm.lcm.database.beans.AsInst;
+import org.onap.so.cnfm.lcm.database.beans.State;
+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;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public interface AsInstRepository extends JpaRepository<AsInst, String> {
+
+ Optional<AsInst> findByName(final String name);
+
+ Optional<AsInst> findByAsInstId(final String asInstId);
+
+ boolean existsAsInstByName(final String name);
+
+ @Modifying(clearAutomatically = true)
+ @Query("UPDATE AsInst SET status = (:state) WHERE asInstId = (:asInstId)")
+ int updateAsInstState(@Param("asInstId") final String asInstId, @Param("state") final State state);
+
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/AsLcmOpOccRepository.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/AsLcmOpOccRepository.java
new file mode 100644
index 0000000..62db0c8
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/AsLcmOpOccRepository.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.repository;
+
+import java.util.Optional;
+import org.onap.so.cnfm.lcm.database.beans.AsLcmOpOcc;
+import org.onap.so.cnfm.lcm.database.beans.OperationStateEnum;
+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;
+
+/**
+ *
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public interface AsLcmOpOccRepository extends JpaRepository<AsLcmOpOcc, String> {
+
+ Optional<AsLcmOpOcc> findById(final String id);
+
+ @Modifying(clearAutomatically = true)
+ @Query("UPDATE AsLcmOpOcc SET operationState = (:operationState) WHERE id = (:id)")
+ int updateAsLcmOpOccOperationState(@Param("id") final String id,
+ @Param("operationState") final OperationStateEnum operationState);
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/AsLifecycleParamRepository.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/AsLifecycleParamRepository.java
new file mode 100644
index 0000000..b63343e
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/AsLifecycleParamRepository.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.repository;
+
+import org.onap.so.cnfm.lcm.database.beans.AsLifecycleParam;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+import java.util.List;
+import java.util.Optional;
+
+/**
+ *
+ * @author Gerard Nugent (gerard.nugent@est.tech)
+ *
+ */
+public interface AsLifecycleParamRepository extends JpaRepository<AsLifecycleParam, Integer> {
+
+ List<AsLifecycleParam> findByAsDeploymentItemInstAsDeploymentItemInstId(final String asDeploymentItemId);
+
+ Optional<AsLifecycleParam> findByAsLifecycleParamId(final Integer asLifecycleParamId);
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/JobRepository.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/JobRepository.java
new file mode 100644
index 0000000..4e254ce
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/JobRepository.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.repository;
+
+import java.util.Optional;
+import org.onap.so.cnfm.lcm.database.beans.Job;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public interface JobRepository extends JpaRepository<Job, String>, RefreshableRepository<Job> {
+
+ Optional<Job> findByResourceId(final String resourceId);
+
+
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/JobStatusRepository.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/JobStatusRepository.java
new file mode 100644
index 0000000..5b9be56
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/JobStatusRepository.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.repository;
+
+import org.onap.so.cnfm.lcm.database.beans.JobStatus;
+import org.springframework.data.repository.CrudRepository;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public interface JobStatusRepository extends CrudRepository<JobStatus, Integer> {
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/RefreshableRepository.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/RefreshableRepository.java
new file mode 100644
index 0000000..7bc4ac7
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/RefreshableRepository.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.repository;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public interface RefreshableRepository<T> {
+
+ void refreshEntity(T entity);
+
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/RefreshableRepositoryImpl.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/RefreshableRepositoryImpl.java
new file mode 100644
index 0000000..866cb1e
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/repository/RefreshableRepositoryImpl.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.repository;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+@Repository
+public class RefreshableRepositoryImpl<T> implements RefreshableRepository<T> {
+
+ @PersistenceContext
+ private EntityManager entityManager;
+
+ @Override
+ public void refreshEntity(final T entity) {
+ entityManager.refresh(entity);
+
+ }
+
+}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/service/DatabaseServiceProvider.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/service/DatabaseServiceProvider.java
new file mode 100644
index 0000000..cfe14e8
--- /dev/null
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/service/DatabaseServiceProvider.java
@@ -0,0 +1,201 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.cnfm.lcm.database.service;
+
+import org.onap.so.cnfm.lcm.database.beans.AsDeploymentItem;
+import org.onap.so.cnfm.lcm.database.beans.AsInst;
+import org.onap.so.cnfm.lcm.database.beans.AsLcmOpOcc;
+import org.onap.so.cnfm.lcm.database.beans.AsLifecycleParam;
+import org.onap.so.cnfm.lcm.database.beans.Job;
+import org.onap.so.cnfm.lcm.database.beans.OperationStateEnum;
+import org.onap.so.cnfm.lcm.database.beans.State;
+import org.onap.so.cnfm.lcm.database.repository.AsDeploymentItemRepository;
+import org.onap.so.cnfm.lcm.database.repository.AsInstRepository;
+import org.onap.so.cnfm.lcm.database.repository.AsLcmOpOccRepository;
+import org.onap.so.cnfm.lcm.database.repository.AsLifecycleParamRepository;
+import org.onap.so.cnfm.lcm.database.repository.JobRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+
+@Service
+public class DatabaseServiceProvider {
+ private static final Logger logger = LoggerFactory.getLogger(DatabaseServiceProvider.class);
+
+ private final JobRepository jobRepository;
+
+ private final AsInstRepository asInstRepository;
+
+ private final AsDeploymentItemRepository asdeploymentItemRepository;
+
+ private final AsLifecycleParamRepository aslifecyleParamRepository;
+
+ private final AsLcmOpOccRepository asLcmOpOccRepository;
+
+ @Autowired
+ public DatabaseServiceProvider(final JobRepository jobRepository, final AsInstRepository asInstRepository,
+ final AsDeploymentItemRepository asdeploymentItemRepository,
+ final AsLifecycleParamRepository aslifecyleParamRepository,
+ final AsLcmOpOccRepository asLcmOpOccRepository) {
+ this.jobRepository = jobRepository;
+ this.asInstRepository = asInstRepository;
+ this.asdeploymentItemRepository = asdeploymentItemRepository;
+ this.aslifecyleParamRepository = aslifecyleParamRepository;
+ this.asLcmOpOccRepository = asLcmOpOccRepository;
+ }
+
+ public boolean addJob(final Job job) {
+ logger.info("Adding Job: {} to database", job);
+ return jobRepository.saveAndFlush(job) != null;
+ }
+
+ public Optional<Job> getJob(final String jobId) {
+ logger.info("Querying database for Job using jobId: {}", jobId);
+ return jobRepository.findById(jobId);
+ }
+
+ @Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.REPEATABLE_READ, readOnly = true)
+ public Optional<Job> getRefreshedJob(final String jobId) {
+ logger.info("Querying database for Job using jobId: {}", jobId);
+ final Optional<Job> optional = getJob(jobId);
+ if (optional.isPresent()) {
+ jobRepository.refreshEntity(optional.get());
+ }
+ return optional;
+ }
+
+ public Optional<Job> getJobByResourceId(final String resourceId) {
+ logger.info("Querying database for Job using resourceId: {}", resourceId);
+ return jobRepository.findByResourceId(resourceId);
+ }
+
+ public boolean isAsInstExists(final String name) {
+ logger.info("Checking if AsInst entry exists in database using name: {}", name);
+ return asInstRepository.existsAsInstByName(name);
+ }
+
+ public boolean saveAsInst(final AsInst asInstance) {
+ logger.info("Saving AsInst: {} to database", asInstance);
+ return asInstRepository.saveAndFlush(asInstance) != null;
+ }
+
+ @Transactional(propagation = Propagation.REQUIRES_NEW)
+ public boolean updateAsInstState(final String asInstId, final State state) {
+ logger.info("Updating AsInst: {} State to {}", asInstId, state);
+ return asInstRepository.updateAsInstState(asInstId, state) > 0;
+ }
+
+ public Optional<AsInst> getAsInst(final String asInstId) {
+ logger.info("Querying database for AsInst using nsInstId: {}", asInstId);
+ return asInstRepository.findById(asInstId);
+ }
+
+ public Optional<AsInst> getAsInstByName(final String name) {
+ logger.info("Querying database for AsInst using name: {}", name);
+ return asInstRepository.findByName(name);
+ }
+
+ public void deleteAsInst(final String asInstId) {
+ logger.info("Deleting AsInst with asInstId: {}", asInstId);
+ asInstRepository.deleteById(asInstId);
+ }
+
+ public boolean saveAsDeploymentItem(final AsDeploymentItem asdeploymentItem) {
+ logger.info("Saving AsDeploymentItem: {} to database", asdeploymentItem);
+ return asdeploymentItemRepository.saveAndFlush(asdeploymentItem) != null;
+ }
+
+ @Transactional(propagation = Propagation.REQUIRES_NEW)
+ public boolean updateAsDeploymentItemState(final String asDeploymentItemInstId, final State state) {
+ logger.info("Updating AsDeploymentItem: {} State to {}", asDeploymentItemInstId, state);
+ return asdeploymentItemRepository.updateAsDeploymentItemState(asDeploymentItemInstId, state) > 0;
+ }
+
+ public List<AsDeploymentItem> getAsDeploymentItemByAsInstId(final String asInstId) {
+ logger.info("Querying database for AsdeploymentItem using asInstId: {}", asInstId);
+ return asdeploymentItemRepository.findByAsInstAsInstId(asInstId);
+ }
+
+ public List<AsDeploymentItem> getAsDeploymentItemByAsInstIdAndName(final String asInstId, final String name) {
+ logger.info("Querying database for AsDeploymentItem using asInstId: {} and name : {} ", asInstId, name);
+ return asdeploymentItemRepository.findByAsInstAsInstIdAndName(asInstId, name);
+ }
+
+ public Optional<AsDeploymentItem> getAsDeploymentItem(final String asDeploymentItemInstId) {
+ logger.info("Querying database for AsdeploymentItem using asDeploymentItemInstId: {}", asDeploymentItemInstId);
+ return asdeploymentItemRepository.findByAsDeploymentItemInstId(asDeploymentItemInstId);
+ }
+
+ public boolean isAsDeploymentItemExists(final String asDeploymentItemInstId) {
+ logger.info("Checking if AsdeploymentItem entry exists in database using asDeploymentItemInstId: {}",
+ asDeploymentItemInstId);
+ return asdeploymentItemRepository.findByAsDeploymentItemInstId(asDeploymentItemInstId).isPresent();
+ }
+
+ @Transactional(propagation = Propagation.REQUIRES_NEW)
+ public void deleteAsDeploymentItem(final String asInstId) {
+ logger.info("Deleting AsdeploymentItem with asInstId: {} from database", asInstId);
+ asdeploymentItemRepository.deleteAsDeploymentItemUsingAsInstId(asInstId);
+ }
+
+ public boolean saveAsLifecycleParam(final AsLifecycleParam aslifecyleparam) {
+ logger.info("Saving AsLifecycleParam: {} to database", aslifecyleparam);
+ return aslifecyleParamRepository.saveAndFlush(aslifecyleparam) != null;
+ }
+
+ public List<AsLifecycleParam> getAsLifecycleParamByAsDeploymentItemId(final String asDeploymentItemId) {
+ logger.info("Querying database for Aslifecycleparam using asDeploymentItemId: {}", asDeploymentItemId);
+ // NEXT
+ return aslifecyleParamRepository.findByAsDeploymentItemInstAsDeploymentItemInstId(asDeploymentItemId);
+ }
+
+ public Optional<AsLifecycleParam> getAsLifecycleParam(final Integer asLifecycleParamId) {
+ logger.info("Querying database for Aslifecycleparam using AslifecycleParamId: {}", asLifecycleParamId);
+ return aslifecyleParamRepository.findByAsLifecycleParamId(asLifecycleParamId);
+ }
+
+ public boolean addAsLcmOpOcc(final AsLcmOpOcc asLcmOpOcc) {
+ logger.info("Adding AsLcmOpOcc: {} to database", asLcmOpOcc);
+ return asLcmOpOccRepository.saveAndFlush(asLcmOpOcc) != null;
+ }
+
+ @Transactional(propagation = Propagation.REQUIRES_NEW)
+ public boolean updateAsLcmOpOccOperationState(final String id, final OperationStateEnum operationState) {
+ logger.info("Updating AsLcmOpOcc: {} operationState to {}", id, operationState);
+ return asLcmOpOccRepository.updateAsLcmOpOccOperationState(id, operationState) > 0;
+ }
+
+ public Optional<AsLcmOpOcc> getAsLcmOpOcc(final String id) {
+ logger.info("Querying database for AsLcmOpOcc using id: {}", id);
+ return asLcmOpOccRepository.findById(id);
+ }
+}