diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-08 14:14:34 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-08 14:24:59 -0400 |
commit | f47919f1fe367b612fa9c96d34c59f01a541e882 (patch) | |
tree | 5b6aa2fc36747d868897e68ccbec0c6db0aee81c /mso-api-handlers/mso-requests-db/src | |
parent | 54452b80a1cf4d22ef750bc1377f8c1b05431d57 (diff) |
Replaced all tabs with spaces in java and pom.xml
Added in maven plugins to enforce coding style rules
Added in eclipse java formatting xml
Change-Id: I3727bbf4ce8dc66abfd8ad21b6cfd0890c5d3ff0
Issue-ID: SO-1765
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-api-handlers/mso-requests-db/src')
25 files changed, 1667 insertions, 1644 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 index aa7b79765b..2cf442406e 100644 --- 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 @@ -21,72 +21,68 @@ 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; + private static final long serialVersionUID = 7132783898142451603L; - public ArchivedInfraRequests() { - } + public ArchivedInfraRequests() {} - public ArchivedInfraRequests(String requestId, String action) { - setRequestId(requestId); - setAction(action); - } + public ArchivedInfraRequests(String requestId, String action) { + setRequestId(requestId); + setAction(action); + } - public ArchivedInfraRequests(String requestId) { - setRequestId(requestId); - } + 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 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 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()) - .append("requestUrl", getRequestUrl()).toString(); - } + @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()).append("requestUrl", getRequestUrl()).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 index 08aaeb9960..37fbfd023c 100644 --- 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 @@ -21,10 +21,8 @@ package org.onap.so.db.request.beans; import java.util.Objects; - import javax.persistence.Entity; import javax.persistence.Table; - import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.apache.commons.lang3.builder.ToStringBuilder; @@ -89,7 +87,6 @@ public class InfraActiveRequests extends InfraRequests { .append("networkName", getNetworkName()).append("networkType", getNetworkType()) .append("requestorId", getRequestorId()).append("configurationId", getConfigurationId()) .append("configurationName", getConfigurationName()).append("operationalEnvId", getOperationalEnvId()) - .append("operationalEnvName", getOperationalEnvName()) - .append("requestUrl", getRequestUrl()).toString(); + .append("operationalEnvName", getOperationalEnvName()).append("requestUrl", getRequestUrl()).toString(); } } diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java index 0959cf61d4..a1010a349c 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java @@ -24,7 +24,6 @@ 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; @@ -33,10 +32,8 @@ import javax.persistence.PreUpdate; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - import org.apache.commons.lang3.builder.ToStringBuilder; import org.onap.so.requestsdb.TimestampXMLAdapter; - import uk.co.blackpepper.bowman.annotation.ResourceId; @MappedSuperclass @@ -148,8 +145,8 @@ public abstract class InfraRequests implements java.io.Serializable { @Column(name = "INSTANCE_GROUP_NAME", length = 200) private String instanceGroupName; @Column(name = "REQUEST_URL", length = 500) - private String requestUrl; - + private String requestUrl; + @ResourceId public URI getRequestURI() { return URI.create(this.requestId); @@ -194,7 +191,7 @@ public abstract class InfraRequests implements java.io.Serializable { public void setStatusMessage(String statusMessage) { this.statusMessage = statusMessage; } - + public String getRollbackStatusMessage() { return this.rollbackStatusMessage; } @@ -202,7 +199,7 @@ public abstract class InfraRequests implements java.io.Serializable { public void setRollbackStatusMessage(String rollbackStatusMessage) { this.rollbackStatusMessage = rollbackStatusMessage; } - + public String getFlowStatus() { return this.flowStatus; } @@ -210,7 +207,7 @@ public abstract class InfraRequests implements java.io.Serializable { public void setFlowStatus(String flowStatus) { this.flowStatus = flowStatus; } - + public String getRetryStatusMessage() { return this.retryStatusMessage; } @@ -530,29 +527,29 @@ public abstract class InfraRequests implements java.io.Serializable { } public String getInstanceGroupId() { - return instanceGroupId; - } + return instanceGroupId; + } - public void setInstanceGroupId(String instanceGroupId) { - this.instanceGroupId = instanceGroupId; - } + public void setInstanceGroupId(String instanceGroupId) { + this.instanceGroupId = instanceGroupId; + } - public String getInstanceGroupName() { - return instanceGroupName; - } + public String getInstanceGroupName() { + return instanceGroupName; + } - public void setInstanceGroupName(String instanceGroupName) { - this.instanceGroupName = instanceGroupName; - } + public void setInstanceGroupName(String instanceGroupName) { + this.instanceGroupName = instanceGroupName; + } - public String getRequestUrl() { + public String getRequestUrl() { return this.requestUrl; } - + public void setRequestUrl(String requestUrl) { - this.requestUrl = requestUrl; - } - + this.requestUrl = requestUrl; + } + @PrePersist protected void onCreate() { if (requestScope == null) @@ -592,28 +589,28 @@ public abstract class InfraRequests implements java.io.Serializable { public String toString() { return new ToStringBuilder(this).append("requestId", getRequestId()) .append("clientRequestId", getClientRequestId()).append("action", getAction()) - .append("requestStatus", getRequestStatus()).append("statusMessage", getStatusMessage()).append("rollbackStatusMessage", getRollbackStatusMessage()) - .append("flowStatus", getFlowStatus()).append("retryStatusMessage", getRetryStatusMessage()) - .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("requestStatus", getRequestStatus()).append("statusMessage", getStatusMessage()) + .append("rollbackStatusMessage", getRollbackStatusMessage()).append("flowStatus", getFlowStatus()) + .append("retryStatusMessage", getRetryStatusMessage()).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()) - .append("instanceGroupId", getInstanceGroupId()).append("instanceGroupName", getInstanceGroupName()) - .append("requestUrl", getRequestUrl()).toString(); + .append("operationalEnvName", getOperationalEnvName()).append("instanceGroupId", getInstanceGroupId()) + .append("instanceGroupName", getInstanceGroupName()).append("requestUrl", getRequestUrl()).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 index dff9dd6687..ece9b5ab25 100644 --- 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 @@ -22,7 +22,6 @@ 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; @@ -36,204 +35,203 @@ import java.util.Objects; import org.apache.commons.lang3.builder.ToStringBuilder; /** - * The service operation status - * <br> + * The service operation status <br> * <p> * </p> * * @author - * @version ONAP Amsterdam Release 2017-08-28 + * @version ONAP Amsterdam Release 2017-08-28 */ @IdClass(OperationStatusId.class) @Entity @Table(name = "operation_status") -public class OperationStatus implements Serializable{ - +public class OperationStatus implements Serializable { + /** * */ private static final long serialVersionUID = 1L; @Id - @Column(name = "SERVICE_ID") + @Column(name = "SERVICE_ID") private String serviceId; @Id - @Column(name = "OPERATION_ID", length=256) + @Column(name = "OPERATION_ID", length = 256) private String operationId; - - @Column(name = "SERVICE_NAME", length=256) + + @Column(name = "SERVICE_NAME", length = 256) private String serviceName; - - @Column(name = "OPERATION_TYPE", length=256) + + @Column(name = "OPERATION_TYPE", length = 256) private String operation; - - @Column(name = "USER_ID", length=256) + + @Column(name = "USER_ID", length = 256) private String userId; - - @Column(name = "RESULT", length=256) + + @Column(name = "RESULT", length = 256) private String result; - - @Column(name = "OPERATION_CONTENT", length=256) + + @Column(name = "OPERATION_CONTENT", length = 256) private String operationContent; - - @Column(name = "PROGRESS", length=256) + + @Column(name = "PROGRESS", length = 256) private String progress = "0"; - - @Column(name = "REASON", length=256) + + @Column(name = "REASON", length = 256) private String reason; - @Column(name = "OPERATE_AT", length=256, updatable=false) + @Column(name = "OPERATE_AT", length = 256, updatable = false) @Temporal(TemporalType.TIMESTAMP) private Date operateAt; - - @Column(name = "FINISHED_AT", length=256) + + @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; + 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; - } + return serviceName; + } - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - } + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } - public String getUserId() { + 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(); + 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(); - } - - + 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 index d07788e55c..0e14b09edd 100644 --- 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 @@ -22,58 +22,65 @@ 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(); - } + 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 index a1e1278306..b50be2e8be 100644 --- 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 @@ -22,7 +22,6 @@ 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; @@ -37,8 +36,6 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import java.util.Objects; - - import org.apache.commons.lang3.builder.ToStringBuilder; @@ -46,132 +43,134 @@ import org.apache.commons.lang3.builder.ToStringBuilder; @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(); - } - + /** + * 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 index 79168f8f0b..2278c8cd9d 100644 --- 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 @@ -22,7 +22,6 @@ 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; @@ -45,157 +44,158 @@ import org.apache.commons.lang3.builder.ToStringBuilder; 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; - @Column(name = "VNF_OPERATIONAL_ENV_ID", length=45) - private String vnfOperationalEnvId; - - 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; - } - - public String getVnfOperationalEnvId() { - return vnfOperationalEnvId; - } - - public void setVnfOperationalEnvId(String vnfOperationalEnvId) { - this.vnfOperationalEnvId = vnfOperationalEnvId; - } - - @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()) - .append("vnfOperationalEnvId", getVnfOperationalEnvId()).toString(); - } - + * 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; + @Column(name = "VNF_OPERATIONAL_ENV_ID", length = 45) + private String vnfOperationalEnvId; + + 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; + } + + public String getVnfOperationalEnvId() { + return vnfOperationalEnvId; + } + + public void setVnfOperationalEnvId(String vnfOperationalEnvId) { + this.vnfOperationalEnvId = vnfOperationalEnvId; + } + + @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()).append("vnfOperationalEnvId", getVnfOperationalEnvId()) + .toString(); + } + } diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatusId.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatusId.java index 301e24f8ec..8979e3732e 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatusId.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatusId.java @@ -22,61 +22,68 @@ 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 OperationalEnvServiceModelStatusId implements Serializable { - private static final long serialVersionUID = 6885534735320068787L; - - @BusinessKey - private String requestId; - @BusinessKey - private String operationalEnvId; - @BusinessKey - private String 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; - } - @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(); - } + private static final long serialVersionUID = 6885534735320068787L; + + @BusinessKey + private String requestId; + @BusinessKey + private String operationalEnvId; + @BusinessKey + private String 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; + } + + @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(); + } } diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java index 0a74c1d7be..2a75c24c46 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java @@ -22,7 +22,6 @@ 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.GeneratedValue; @@ -32,140 +31,137 @@ import javax.persistence.PrePersist; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.openpojo.business.annotation.BusinessKey; /** - * persist the request identifiers created when MSO POSTs a request to PINC - * <br> + * persist the request identifiers created when MSO POSTs a request to PINC <br> * <p> * </p> * * @author - * @version + * @version */ @Entity @JsonInclude(Include.NON_NULL) @Table(name = "request_processing_data") -public class RequestProcessingData implements Serializable{ +public class RequestProcessingData implements Serializable { - /** + /** * */ - private static final long serialVersionUID = -3497593687393936143L; - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "ID") - private Integer id; - - @BusinessKey - @Column(name = "SO_REQUEST_ID", length=50, unique=true) - private String soRequestId; - - @BusinessKey - @Column(name = "GROUPING_ID", length=100, unique=true) - private String groupingId; - - @BusinessKey - @Column(name = "NAME", length=200) - private String name; - - @Column(name = "VALUE", columnDefinition = "LONGTEXT") - private String value; - - @BusinessKey - @Column(name = "TAG", length=200) - private String tag; - - @Column(name = "CREATE_TIME", insertable = false, updatable = false) - @Temporal(TemporalType.TIMESTAMP) - private Date created = null; - - @Override - public boolean equals(final Object other) { - if (!(other instanceof RequestProcessingData)) { - return false; - } - RequestProcessingData castOther = (RequestProcessingData) other; - return new EqualsBuilder().append(soRequestId, castOther.soRequestId).append(groupingId, castOther.groupingId) - .append(name, castOther.name).append(tag, castOther.tag).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(soRequestId).append(groupingId).append(name).append(tag).toHashCode(); - } - - @Override - public String toString() { - return new ToStringBuilder(this).append("id", id).append("soRequestId", soRequestId) - .append("groupingId", groupingId).append("name", name).append("value", value).append("tag", tag) - .toString(); - } - - @PrePersist - protected void createdAt() { - this.created = new Date(); - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getSoRequestId() { - return soRequestId; - } - - public void setSoRequestId(String soRequestId) { - this.soRequestId = soRequestId; - } - - public String getGroupingId() { - return groupingId; - } - - public void setGroupingId(String groupingId) { - this.groupingId = groupingId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public String getTag() { - return tag; - } - - public void setTag(String tag) { - this.tag = tag; - } - + private static final long serialVersionUID = -3497593687393936143L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "ID") + private Integer id; + + @BusinessKey + @Column(name = "SO_REQUEST_ID", length = 50, unique = true) + private String soRequestId; + + @BusinessKey + @Column(name = "GROUPING_ID", length = 100, unique = true) + private String groupingId; + + @BusinessKey + @Column(name = "NAME", length = 200) + private String name; + + @Column(name = "VALUE", columnDefinition = "LONGTEXT") + private String value; + + @BusinessKey + @Column(name = "TAG", length = 200) + private String tag; + + @Column(name = "CREATE_TIME", insertable = false, updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created = null; + + @Override + public boolean equals(final Object other) { + if (!(other instanceof RequestProcessingData)) { + return false; + } + RequestProcessingData castOther = (RequestProcessingData) other; + return new EqualsBuilder().append(soRequestId, castOther.soRequestId).append(groupingId, castOther.groupingId) + .append(name, castOther.name).append(tag, castOther.tag).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(soRequestId).append(groupingId).append(name).append(tag).toHashCode(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", id).append("soRequestId", soRequestId) + .append("groupingId", groupingId).append("name", name).append("value", value).append("tag", tag) + .toString(); + } + + @PrePersist + protected void createdAt() { + this.created = new Date(); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getSoRequestId() { + return soRequestId; + } + + public void setSoRequestId(String soRequestId) { + this.soRequestId = soRequestId; + } + + public String getGroupingId() { + return groupingId; + } + + public void setGroupingId(String groupingId) { + this.groupingId = groupingId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getTag() { + return tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + public Date getCreated() { - return created; - } -}
\ No newline at end of file + return created; + } +} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatus.java index 386daa6dbb..b415fc360f 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatus.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/ResourceOperationStatus.java @@ -21,7 +21,6 @@ package org.onap.so.db.request.beans; import java.io.Serializable; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -31,19 +30,18 @@ import java.util.Objects; import org.apache.commons.lang3.builder.ToStringBuilder; /** - * The Resource operation status - * <br> + * The Resource operation status <br> * <p> * </p> * * @author - * @version ONAP Amsterdam Release 2017-08-28 + * @version ONAP Amsterdam Release 2017-08-28 */ @IdClass(ResourceOperationStatusId.class) @Entity @Table(name = "resource_operation_status") -public class ResourceOperationStatus implements Serializable{ +public class ResourceOperationStatus implements Serializable { /** * @@ -51,173 +49,172 @@ public class ResourceOperationStatus implements Serializable{ private static final long serialVersionUID = 1L; @Id - @Column(name = "SERVICE_ID") + @Column(name = "SERVICE_ID") private String serviceId; @Id - @Column(name = "OPERATION_ID", length=256) + @Column(name = "OPERATION_ID", length = 256) private String operationId; @Id - @Column(name = "RESOURCE_TEMPLATE_UUID") + @Column(name = "RESOURCE_TEMPLATE_UUID") private String resourceTemplateUUID; - - @Column(name = "OPER_TYPE", length=256) + + @Column(name = "OPER_TYPE", length = 256) private String operType; - - @Column(name = "RESOURCE_INSTANCE_ID", length=256) + + @Column(name = "RESOURCE_INSTANCE_ID", length = 256) private String resourceInstanceID; - - @Column(name = "JOB_ID", length=256) + + @Column(name = "JOB_ID", length = 256) private String jobId; - - @Column(name = "STATUS", length=256) + + @Column(name = "STATUS", length = 256) private String status; - - @Column(name = "PROGRESS", length=256) + + @Column(name = "PROGRESS", length = 256) private String progress = "0"; - - @Column(name = "ERROR_CODE", length=256) + + @Column(name = "ERROR_CODE", length = 256) private String errorCode; - - @Column(name = "STATUS_DESCRIPOTION", length=256) + + @Column(name = "STATUS_DESCRIPOTION", length = 256) private String statusDescription; - public ResourceOperationStatus(){ - + public ResourceOperationStatus() { + } - - public ResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID) - { + + public ResourceOperationStatus(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; } - + public String getJobId() { return jobId; } - + public void setJobId(String jobId) { this.jobId = jobId; } - + public String getStatus() { return status; } - + public void setStatus(String status) { this.status = status; } - + public String getProgress() { return progress; } - + public void setProgress(String progress) { this.progress = progress; } - + public String getErrorCode() { return errorCode; } - + public void setErrorCode(String errorCode) { this.errorCode = errorCode; } - + public String getStatusDescription() { return statusDescription; } - + public void setStatusDescription(String statusDescription) { this.statusDescription = statusDescription; } - + public String getResourceInstanceID() { return resourceInstanceID; } - + public void setResourceInstanceID(String resourceInstanceID) { this.resourceInstanceID = resourceInstanceID; } - + public String getOperType() { return operType; } - + public void setOperType(String operType) { this.operType = operType; } - @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(); - } + @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 index 0f3656cd31..b35a277902 100644 --- 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 @@ -22,70 +22,78 @@ 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 static final long serialVersionUID = -7425019928845751157L; + + @BusinessKey + private String serviceId; + @BusinessKey private String operationId; - @BusinessKey + @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(); - } - - + + 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 index e7a0c39702..da426aecef 100644 --- 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 @@ -23,7 +23,6 @@ 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; @@ -31,31 +30,29 @@ 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; @Entity @Table(name = "site_status") public class SiteStatus { - - @Column(name = "STATUS") + + @Column(name = "STATUS") private boolean status; - @Id - @Column(name = "SITE_NAME") + @Id + @Column(name = "SITE_NAME") private String siteName; - @Column(name = "CREATION_TIMESTAMP", insertable = false, updatable = false) + @Column(name = "CREATION_TIMESTAMP", insertable = false, updatable = false) @Temporal(TemporalType.TIMESTAMP) private Date created; - public SiteStatus() { - } + public SiteStatus() {} public SiteStatus(String siteName) { - this.siteName = siteName; - } + this.siteName = siteName; + } - public Date getCreated() { + public Date getCreated() { return created; } @@ -77,28 +74,29 @@ public class SiteStatus { @PrePersist protected void createdAt() { - this.created = new Date(); + 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 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(); - } + 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 index f6ee5086c9..0ff894e96f 100644 --- 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 @@ -23,11 +23,11 @@ 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; + PENDING, INPROGRESS, COMPLETED, FAILED, TIMEOUT; - public boolean isFinished () { + public boolean isFinished() { switch (this) { case COMPLETED: case FAILED: @@ -37,4 +37,4 @@ public enum Status { 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 index f72a7b327a..7e8220e475 100644 --- 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 @@ -22,7 +22,6 @@ 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; @@ -41,100 +40,100 @@ import org.apache.commons.lang3.builder.ToStringBuilder; 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(); - } + /** + * 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/onap/so/db/request/beans/WatchdogComponentDistributionStatusId.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatusId.java index 79e6fbaced..6a0fcf7079 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatusId.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogComponentDistributionStatusId.java @@ -22,52 +22,57 @@ 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 WatchdogComponentDistributionStatusId implements Serializable { - 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; - } - @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()); - } - @Override - public int hashCode() { - return Objects.hash(this.getDistributionId(), this.getComponentName()); - } - @Override - public String toString() { - return new ToStringBuilder(this).append("distributionId", getDistributionId()) - .append("componentName", getComponentName()).toString(); - } + 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; + } + + @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()); + } + + @Override + public int hashCode() { + return Objects.hash(this.getDistributionId(), this.getComponentName()); + } + + @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 index c8ad5f1843..ca5ae7bbb6 100644 --- 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 @@ -22,7 +22,6 @@ 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; @@ -32,7 +31,6 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Version; - import java.util.Objects; import org.apache.commons.lang3.builder.ToStringBuilder; @@ -40,97 +38,97 @@ import org.apache.commons.lang3.builder.ToStringBuilder; @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; - @Column(name = "LOCK_VERSION") - private int version; - - 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 int getVersion() { - return version; - } - - public void setVersion(int version) { - this.version = version; - } - - 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(); - } - + /** + * 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; + @Column(name = "LOCK_VERSION") + private int version; + + 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 int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + 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 index 25f5802413..d48a9c792e 100644 --- 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 @@ -24,7 +24,6 @@ import java.io.Serializable; import java.util.Date; import java.util.Objects; import java.util.Optional; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -33,7 +32,6 @@ import javax.persistence.PrePersist; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; - import org.apache.commons.lang3.builder.ToStringBuilder; @IdClass(WatchdogServiceModVerIdLookupId.class) @@ -41,103 +39,108 @@ import org.apache.commons.lang3.builder.ToStringBuilder; @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 = "DISTRIBUTION_NOTIFICATION") - private String distributionNotification; - @Column(name = "CONSUMER_ID", length=200) - private String consumerId; - @Column(name = "CREATE_TIME", updatable=false) - @Temporal(TemporalType.TIMESTAMP) - private Date createTime; - - public WatchdogServiceModVerIdLookup() { - - } - /** - * - * @param distributionId - Distribution ID - * @param serviceModelVersionId -- service UUID - * @param distributionNotification -- Notification content from ASDC - * @param consumerId -- Consumer ID associated with subscription. - */ - public WatchdogServiceModVerIdLookup(String distributionId, String serviceModelVersionId, - Optional<String> distributionNotification, String consumerId) { - this.distributionId = distributionId; - this.serviceModelVersionId = serviceModelVersionId; - this.distributionNotification= distributionNotification.orElse(null); - this.consumerId = consumerId; - } - - 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()) - .append("distributionNotification", getDistributionNotification()) - .append("consumerId", getConsumerId()) - .toString(); - } - public String getDistributionNotification() { - return distributionNotification; - } - public void setDistributionNotification(String distributionNotification) { - this.distributionNotification = distributionNotification; - } - public String getConsumerId() { - return consumerId; - } - public void setConsumerId(String consumerId) { - this.consumerId = consumerId; - } + /** + * 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 = "DISTRIBUTION_NOTIFICATION") + private String distributionNotification; + @Column(name = "CONSUMER_ID", length = 200) + private String consumerId; + @Column(name = "CREATE_TIME", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date createTime; + + public WatchdogServiceModVerIdLookup() { + + } + + /** + * + * @param distributionId - Distribution ID + * @param serviceModelVersionId -- service UUID + * @param distributionNotification -- Notification content from ASDC + * @param consumerId -- Consumer ID associated with subscription. + */ + public WatchdogServiceModVerIdLookup(String distributionId, String serviceModelVersionId, + Optional<String> distributionNotification, String consumerId) { + this.distributionId = distributionId; + this.serviceModelVersionId = serviceModelVersionId; + this.distributionNotification = distributionNotification.orElse(null); + this.consumerId = consumerId; + } + + 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()) + .append("distributionNotification", getDistributionNotification()).append("consumerId", getConsumerId()) + .toString(); + } + + public String getDistributionNotification() { + return distributionNotification; + } + + public void setDistributionNotification(String distributionNotification) { + this.distributionNotification = distributionNotification; + } + + public String getConsumerId() { + return consumerId; + } + + public void setConsumerId(String consumerId) { + this.consumerId = consumerId; + } } diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookupId.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookupId.java index 2c0b67bac2..dd77037971 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookupId.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookupId.java @@ -22,53 +22,58 @@ 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 WatchdogServiceModVerIdLookupId implements Serializable{ +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; + } + + @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()); + } - 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; - } - @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()); - } - @Override - public String toString() { - return new ToStringBuilder(this).append("distributionId", getDistributionId()) - .append("serviceModelVersionId", getServiceModelVersionId()).toString(); - } + @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/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java index 9c29d968c9..f2ff6fac00 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java @@ -26,11 +26,9 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; - import javax.annotation.PostConstruct; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriBuilder; - import org.apache.http.HttpStatus; import org.onap.so.db.request.beans.ArchivedInfraRequests; import org.onap.so.db.request.beans.InfraActiveRequests; @@ -59,7 +57,6 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.stereotype.Component; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; - import uk.co.blackpepper.bowman.ClientFactory; import uk.co.blackpepper.bowman.Configuration; @@ -67,100 +64,112 @@ import uk.co.blackpepper.bowman.Configuration; @Primary public class RequestsDbClient { - private static final String SERVICE_ID = "SERVICE_ID"; - private static final String OPERATION_ID = "OPERATION_ID"; - private static final String SO_REQUEST_ID = "SO_REQUEST_ID"; - private static final String REQUEST_ID = "REQUEST_ID"; - private static final String OPERATIONAL_ENVIRONMENT_ID = "OPERATIONAL_ENV_ID"; - private static final String SERVICE_MODEL_VERSION_ID = "SERVICE_MODEL_VERSION_ID"; - - - @Value("${mso.adapters.requestDb.endpoint}") - protected String endpoint; - - @Value("${mso.adapters.requestDb.auth}") - private String msoAdaptersAuth; - - private String getOrchestrationFilterURI = "/infraActiveRequests/getOrchestrationFiltersFromInfraActive/"; - private static final String OPERATION_STATUS_SEARCH = "/operationStatus/search"; - private static final String OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH = "/operationalEnvServiceModelStatus/search"; - - - private String checkVnfIdStatus = "/infraActiveRequests/checkVnfIdStatus/"; - - private String infraActiveRequestURI = "/infraActiveRequests/"; - - private String checkInstanceNameDuplicate = "/infraActiveRequests/checkInstanceNameDuplicate"; - - private String operationalEnvDistributionStatusURI = "/operationalEnvDistributionStatus/"; - - private String findOneByServiceIdAndOperationIdURI = "/findOneByServiceIdAndOperationId"; - - private String findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI = "/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"; - - private String findAllByOperationalEnvIdAndRequestIdURI = "/findAllByOperationalEnvIdAndRequestId"; - - private String cloudOrchestrationFiltersFromInfraActive = "/infraActiveRequests/getCloudOrchestrationFiltersFromInfraActive"; - - private String requestProcessingDataURI = "/requestProcessingData"; - - private final String findBySoRequestIdOrderByGroupingIdDesc = "/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc"; - - - @Autowired - protected RestTemplate restTemplate; - - @Autowired - ClassURLMapper classURLMapper; - - @PostConstruct - public void init() { - getOrchestrationFilterURI = endpoint + getOrchestrationFilterURI; - infraActiveRequestURI = endpoint + infraActiveRequestURI; - checkVnfIdStatus = endpoint + checkVnfIdStatus; - checkInstanceNameDuplicate = endpoint + checkInstanceNameDuplicate; - cloudOrchestrationFiltersFromInfraActive = endpoint + cloudOrchestrationFiltersFromInfraActive; - findOneByServiceIdAndOperationIdURI = endpoint + OPERATION_STATUS_SEARCH + findOneByServiceIdAndOperationIdURI; - requestProcessingDataURI = endpoint + requestProcessingDataURI; - operationalEnvDistributionStatusURI = endpoint + operationalEnvDistributionStatusURI; - findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI = endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI; - findAllByOperationalEnvIdAndRequestIdURI = endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findAllByOperationalEnvIdAndRequestIdURI; - } - - private ClientFactory getClientFactory(){ - URI baseUri = UriBuilder.fromUri(endpoint).build(); - ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()); - - return Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> { - restTemplate.getInterceptors().add((new SpringClientFilter())); - - restTemplate.getInterceptors().add((request, body, execution) -> { - - request.getHeaders().add(HttpHeaders.AUTHORIZATION, msoAdaptersAuth); - return execution.execute(request, body); - }); - }).build().buildClientFactory(); - } - - - public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive(Map<String, String> orchestrationMap){ - URI uri = getUri(cloudOrchestrationFiltersFromInfraActive); - HttpHeaders headers = getHttpHeaders(); - HttpEntity<Map> entity = new HttpEntity<>(orchestrationMap, headers); - try{ - return restTemplate.exchange(uri, HttpMethod.POST, entity, new ParameterizedTypeReference<List<InfraActiveRequests>>() {}).getBody(); - }catch(HttpClientErrorException e){ - if(HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()){ - return null; - } - throw e; - } - } + private static final String SERVICE_ID = "SERVICE_ID"; + private static final String OPERATION_ID = "OPERATION_ID"; + private static final String SO_REQUEST_ID = "SO_REQUEST_ID"; + private static final String REQUEST_ID = "REQUEST_ID"; + private static final String OPERATIONAL_ENVIRONMENT_ID = "OPERATIONAL_ENV_ID"; + private static final String SERVICE_MODEL_VERSION_ID = "SERVICE_MODEL_VERSION_ID"; + + + @Value("${mso.adapters.requestDb.endpoint}") + protected String endpoint; + + @Value("${mso.adapters.requestDb.auth}") + private String msoAdaptersAuth; + + private String getOrchestrationFilterURI = "/infraActiveRequests/getOrchestrationFiltersFromInfraActive/"; + private static final String OPERATION_STATUS_SEARCH = "/operationStatus/search"; + private static final String OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH = + "/operationalEnvServiceModelStatus/search"; + + + private String checkVnfIdStatus = "/infraActiveRequests/checkVnfIdStatus/"; + + private String infraActiveRequestURI = "/infraActiveRequests/"; + + private String checkInstanceNameDuplicate = "/infraActiveRequests/checkInstanceNameDuplicate"; + + private String operationalEnvDistributionStatusURI = "/operationalEnvDistributionStatus/"; + + private String findOneByServiceIdAndOperationIdURI = "/findOneByServiceIdAndOperationId"; + + private String findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI = + "/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"; + + private String findAllByOperationalEnvIdAndRequestIdURI = "/findAllByOperationalEnvIdAndRequestId"; + + private String cloudOrchestrationFiltersFromInfraActive = + "/infraActiveRequests/getCloudOrchestrationFiltersFromInfraActive"; + + private String requestProcessingDataURI = "/requestProcessingData"; + + private final String findBySoRequestIdOrderByGroupingIdDesc = + "/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc"; + + + @Autowired + protected RestTemplate restTemplate; + + @Autowired + ClassURLMapper classURLMapper; + + @PostConstruct + public void init() { + getOrchestrationFilterURI = endpoint + getOrchestrationFilterURI; + infraActiveRequestURI = endpoint + infraActiveRequestURI; + checkVnfIdStatus = endpoint + checkVnfIdStatus; + checkInstanceNameDuplicate = endpoint + checkInstanceNameDuplicate; + cloudOrchestrationFiltersFromInfraActive = endpoint + cloudOrchestrationFiltersFromInfraActive; + findOneByServiceIdAndOperationIdURI = endpoint + OPERATION_STATUS_SEARCH + findOneByServiceIdAndOperationIdURI; + requestProcessingDataURI = endpoint + requestProcessingDataURI; + operationalEnvDistributionStatusURI = endpoint + operationalEnvDistributionStatusURI; + findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI = + endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + + findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI; + findAllByOperationalEnvIdAndRequestIdURI = + endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findAllByOperationalEnvIdAndRequestIdURI; + } + + private ClientFactory getClientFactory() { + URI baseUri = UriBuilder.fromUri(endpoint).build(); + ClientHttpRequestFactory factory = + new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()); + + return Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory) + .setRestTemplateConfigurer(restTemplate -> { + restTemplate.getInterceptors().add((new SpringClientFilter())); + + restTemplate.getInterceptors().add((request, body, execution) -> { + + request.getHeaders().add(HttpHeaders.AUTHORIZATION, msoAdaptersAuth); + return execution.execute(request, body); + }); + }).build().buildClientFactory(); + } + + + public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive(Map<String, String> orchestrationMap) { + URI uri = getUri(cloudOrchestrationFiltersFromInfraActive); + HttpHeaders headers = getHttpHeaders(); + HttpEntity<Map> entity = new HttpEntity<>(orchestrationMap, headers); + try { + return restTemplate.exchange(uri, HttpMethod.POST, entity, + new ParameterizedTypeReference<List<InfraActiveRequests>>() {}).getBody(); + } catch (HttpClientErrorException e) { + if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { + return null; + } + throw e; + } + } public InfraActiveRequests getInfraActiveRequestbyRequestId(String requestId) { try { - HttpEntity<?> entity = getHttpEntity(); - InfraActiveRequests infraActiveRequests = restTemplate.exchange(getUri(endpoint + "/infraActiveRequests/" + requestId), HttpMethod.GET, entity, InfraActiveRequests.class).getBody(); + HttpEntity<?> entity = getHttpEntity(); + InfraActiveRequests infraActiveRequests = + restTemplate.exchange(getUri(endpoint + "/infraActiveRequests/" + requestId), HttpMethod.GET, + entity, InfraActiveRequests.class).getBody(); if (infraActiveRequests != null) { infraActiveRequests.setRequestId(requestId); } @@ -173,208 +182,217 @@ public class RequestsDbClient { } } - public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive(Map<String, List<String>> orchestrationMap) { - HttpHeaders headers = getHttpHeaders(); - URI uri = getUri(getOrchestrationFilterURI); - HttpEntity<Map<String, List<String>>> entity = new HttpEntity<>(orchestrationMap, headers); - return restTemplate.exchange(uri, HttpMethod.POST, entity, new ParameterizedTypeReference<List<InfraActiveRequests>>() {}).getBody(); - } - - public InfraActiveRequests checkVnfIdStatus(String operationalEnvironmentId) { - HttpEntity<?> entity = getHttpEntity(); - URI uri = getUri(checkVnfIdStatus + operationalEnvironmentId); - return restTemplate.exchange(uri, HttpMethod.GET, entity, InfraActiveRequests.class).getBody(); - } - - public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) { - HttpHeaders headers = getHttpHeaders(); - URI uri = getUri(checkInstanceNameDuplicate); - HttpEntity<InstanceNameDuplicateCheckRequest> entity = new HttpEntity<>(new InstanceNameDuplicateCheckRequest(instanceIdMap, instanceName, requestScope), headers); - try{ - ResponseEntity<InfraActiveRequests> response = restTemplate.exchange(uri, HttpMethod.POST, entity, InfraActiveRequests.class); - if(response != null && response.hasBody()) { - return restTemplate.exchange(uri, HttpMethod.POST, entity, InfraActiveRequests.class).getBody(); - } else { - return null; - } - }catch(HttpClientErrorException e){ - if(HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()){ - return null; - } - throw e; - } - - } - - public OperationStatus getOneByServiceIdAndOperationId(String serviceId, String operationId) { - try { - HttpEntity<?> entity = getHttpEntity(); - OperationStatus operationStatus = restTemplate.exchange(getUri(UriBuilder.fromUri(getUri(findOneByServiceIdAndOperationIdURI)) - .queryParam(SERVICE_ID, serviceId) - .queryParam(OPERATION_ID, operationId) - .build().toString()), HttpMethod.GET, entity, OperationStatus.class).getBody(); - if (operationStatus != null) { - operationStatus.setServiceId(serviceId); - operationStatus.setOperationId(operationId); - } - - return operationStatus; - } catch (HttpClientErrorException e) { - if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { - return null; - } - throw e; - } - } - - public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId(String operationalEnvironmentId, String serviceModelVersionId, String requestId) { - try { - HttpEntity<?> entity = getHttpEntity(); - OperationalEnvServiceModelStatus modelStatus = restTemplate.exchange(getUri(UriBuilder.fromUri(findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI) - .queryParam(OPERATIONAL_ENVIRONMENT_ID, operationalEnvironmentId) - .queryParam(SERVICE_MODEL_VERSION_ID, serviceModelVersionId) - .queryParam(REQUEST_ID, requestId) - .build().toString()), HttpMethod.GET, entity, OperationalEnvServiceModelStatus.class).getBody(); - if (null != modelStatus) { - modelStatus.setOperationalEnvId(operationalEnvironmentId); - modelStatus.setServiceModelVersionId(serviceModelVersionId); - modelStatus.setRequestId(requestId); - } - return modelStatus; - }catch(HttpClientErrorException e){ - if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { - return null; - } - throw e; - } - } - - public List<OperationalEnvServiceModelStatus> getAllByOperationalEnvIdAndRequestId(String operationalEnvironmentId, String requestId){ - return this.getMultipleOperationalEnvServiceModelStatus(getUri(UriBuilder.fromUri(findAllByOperationalEnvIdAndRequestIdURI) - .queryParam(OPERATIONAL_ENVIRONMENT_ID,operationalEnvironmentId) - .queryParam(REQUEST_ID,requestId) - .build().toString())); - } - - public OperationalEnvDistributionStatus getDistributionStatusById(String distributionId){ - try { - HttpEntity<?> entity = getHttpEntity(); - OperationalEnvDistributionStatus distributionStatus = restTemplate.exchange(getUri(operationalEnvDistributionStatusURI + distributionId), - HttpMethod.GET, entity, OperationalEnvDistributionStatus.class).getBody(); - if(null != distributionStatus){ - distributionStatus.setDistributionId(distributionId); - } - return distributionStatus; - }catch(HttpClientErrorException e){ - if(HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()){ - return null; - } - throw e; - } - } - - private List<OperationalEnvServiceModelStatus> getMultipleOperationalEnvServiceModelStatus(URI uri){ - Iterable <OperationalEnvServiceModelStatus> iterable = getClientFactory().create(OperationalEnvServiceModelStatus.class).getAll(uri); - List<OperationalEnvServiceModelStatus> serviceModelStatuses = new ArrayList<>(); - Iterator<OperationalEnvServiceModelStatus> statusIterator = iterable.iterator(); - statusIterator.forEachRemaining(serviceModelStatuses::add); - return serviceModelStatuses; - } - - public void save(InfraActiveRequests infraActiveRequests) { - HttpHeaders headers = getHttpHeaders(); - URI uri = getUri(infraActiveRequestURI); - HttpEntity<InfraActiveRequests> entity = new HttpEntity<>(infraActiveRequests, headers); - restTemplate.postForLocation(uri, entity); - } - - public <T> void save(T object){ - HttpHeaders headers = getHttpHeaders(); - URI uri = getUri(endpoint+classURLMapper.getURI(object.getClass())); - HttpEntity<T> entity = new HttpEntity<>(object, headers); - restTemplate.postForLocation(uri, entity); - } - - public void updateInfraActiveRequests(InfraActiveRequests request) { - HttpHeaders headers = getHttpHeaders(); - URI uri = getUri(infraActiveRequestURI+request.getRequestId()); - HttpEntity<InfraActiveRequests> entity = new HttpEntity<>(request, headers); - restTemplate.put(uri, entity); - } - - protected URI getUri(String uri) { - return URI.create(uri); - } - - public void saveRequestProcessingData(RequestProcessingData requestProcessingData) { - HttpHeaders headers = getHttpHeaders(); - URI uri = getUri(requestProcessingDataURI); - HttpEntity<RequestProcessingData> entity = new HttpEntity<>(requestProcessingData, headers); - restTemplate.postForLocation(uri, entity); - } - - public List<RequestProcessingData> getRequestProcessingDataBySoRequestId(String soRequestId) { - return this.getRequestProcessingData(getUri(UriBuilder.fromUri(endpoint + findBySoRequestIdOrderByGroupingIdDesc) - .queryParam(SO_REQUEST_ID,soRequestId) - .build().toString())); - } - - private List<RequestProcessingData> getRequestProcessingData(URI uri) { - Iterable<RequestProcessingData> requestProcessingDataIterator = getClientFactory().create(RequestProcessingData.class).getAll(uri); - List<RequestProcessingData> requestProcessingDataList = new ArrayList<>(); - Iterator<RequestProcessingData> it = requestProcessingDataIterator.iterator(); - it.forEachRemaining(requestProcessingDataList::add); - return requestProcessingDataList; - } - - @Component - static class ClassURLMapper { - private static final Map <Class,String> classURLMap = new HashMap<>(); - - ClassURLMapper() { - classURLMap.put(ArchivedInfraRequests.class,"/archivedInfraRequests/"); - classURLMap.put(InfraActiveRequests.class,"/infraActiveRequests/"); - classURLMap.put(OperationalEnvDistributionStatus.class,"/operationalEnvDistributionStatus/"); - classURLMap.put(OperationalEnvServiceModelStatus.class,"/operationalEnvServiceModelStatus/"); - classURLMap.put(OperationStatus.class,"/operationStatus/"); - classURLMap.put(ResourceOperationStatus.class,"/resourceOperationStatus/"); - classURLMap.put(SiteStatus.class,"/siteStatus/"); - classURLMap.put(WatchdogComponentDistributionStatus.class,"/watchdogComponentDistributionStatus/"); - classURLMap.put(WatchdogDistributionStatus.class,"/watchdogDistributionStatus/"); - classURLMap.put(WatchdogServiceModVerIdLookup.class,"/watchdogServiceModVerIdLookup/"); - } - - <T> String getURI(Class<T> className) { - Class actualClass = classURLMap.keySet() - .stream() - .filter(requestdbClass -> requestdbClass.isAssignableFrom(className)) - .findFirst() - .get(); - return classURLMap.get(actualClass); - } - } - - //USED FOR TEST ONLY - public void setPortToEndpoint(String port) { - endpoint = endpoint + port; - } - - //USED FOR TEST ONLY - public void removePortFromEndpoint() { - endpoint = endpoint.substring(0, endpoint.lastIndexOf(':') + 1); - } - - private HttpHeaders getHttpHeaders() { - HttpHeaders headers = new HttpHeaders(); - headers.set(HttpHeaders.AUTHORIZATION, msoAdaptersAuth); - headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); - headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); - return headers; - } - - private HttpEntity<?> getHttpEntity() { - HttpHeaders headers = getHttpHeaders(); - return new HttpEntity<>(headers); - } + public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive( + Map<String, List<String>> orchestrationMap) { + HttpHeaders headers = getHttpHeaders(); + URI uri = getUri(getOrchestrationFilterURI); + HttpEntity<Map<String, List<String>>> entity = new HttpEntity<>(orchestrationMap, headers); + return restTemplate + .exchange(uri, HttpMethod.POST, entity, new ParameterizedTypeReference<List<InfraActiveRequests>>() {}) + .getBody(); + } + + public InfraActiveRequests checkVnfIdStatus(String operationalEnvironmentId) { + HttpEntity<?> entity = getHttpEntity(); + URI uri = getUri(checkVnfIdStatus + operationalEnvironmentId); + return restTemplate.exchange(uri, HttpMethod.GET, entity, InfraActiveRequests.class).getBody(); + } + + public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, + String requestScope) { + HttpHeaders headers = getHttpHeaders(); + URI uri = getUri(checkInstanceNameDuplicate); + HttpEntity<InstanceNameDuplicateCheckRequest> entity = new HttpEntity<>( + new InstanceNameDuplicateCheckRequest(instanceIdMap, instanceName, requestScope), headers); + try { + ResponseEntity<InfraActiveRequests> response = + restTemplate.exchange(uri, HttpMethod.POST, entity, InfraActiveRequests.class); + if (response != null && response.hasBody()) { + return restTemplate.exchange(uri, HttpMethod.POST, entity, InfraActiveRequests.class).getBody(); + } else { + return null; + } + } catch (HttpClientErrorException e) { + if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { + return null; + } + throw e; + } + + } + + public OperationStatus getOneByServiceIdAndOperationId(String serviceId, String operationId) { + try { + HttpEntity<?> entity = getHttpEntity(); + OperationStatus operationStatus = restTemplate.exchange(getUri( + UriBuilder.fromUri(getUri(findOneByServiceIdAndOperationIdURI)).queryParam(SERVICE_ID, serviceId) + .queryParam(OPERATION_ID, operationId).build().toString()), + HttpMethod.GET, entity, OperationStatus.class).getBody(); + if (operationStatus != null) { + operationStatus.setServiceId(serviceId); + operationStatus.setOperationId(operationId); + } + + return operationStatus; + } catch (HttpClientErrorException e) { + if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { + return null; + } + throw e; + } + } + + public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId( + String operationalEnvironmentId, String serviceModelVersionId, String requestId) { + try { + HttpEntity<?> entity = getHttpEntity(); + OperationalEnvServiceModelStatus modelStatus = restTemplate.exchange( + getUri(UriBuilder.fromUri(findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI) + .queryParam(OPERATIONAL_ENVIRONMENT_ID, operationalEnvironmentId) + .queryParam(SERVICE_MODEL_VERSION_ID, serviceModelVersionId) + .queryParam(REQUEST_ID, requestId).build().toString()), + HttpMethod.GET, entity, OperationalEnvServiceModelStatus.class).getBody(); + if (null != modelStatus) { + modelStatus.setOperationalEnvId(operationalEnvironmentId); + modelStatus.setServiceModelVersionId(serviceModelVersionId); + modelStatus.setRequestId(requestId); + } + return modelStatus; + } catch (HttpClientErrorException e) { + if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { + return null; + } + throw e; + } + } + + public List<OperationalEnvServiceModelStatus> getAllByOperationalEnvIdAndRequestId(String operationalEnvironmentId, + String requestId) { + return this.getMultipleOperationalEnvServiceModelStatus( + getUri(UriBuilder.fromUri(findAllByOperationalEnvIdAndRequestIdURI) + .queryParam(OPERATIONAL_ENVIRONMENT_ID, operationalEnvironmentId) + .queryParam(REQUEST_ID, requestId).build().toString())); + } + + public OperationalEnvDistributionStatus getDistributionStatusById(String distributionId) { + try { + HttpEntity<?> entity = getHttpEntity(); + OperationalEnvDistributionStatus distributionStatus = + restTemplate.exchange(getUri(operationalEnvDistributionStatusURI + distributionId), HttpMethod.GET, + entity, OperationalEnvDistributionStatus.class).getBody(); + if (null != distributionStatus) { + distributionStatus.setDistributionId(distributionId); + } + return distributionStatus; + } catch (HttpClientErrorException e) { + if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { + return null; + } + throw e; + } + } + + private List<OperationalEnvServiceModelStatus> getMultipleOperationalEnvServiceModelStatus(URI uri) { + Iterable<OperationalEnvServiceModelStatus> iterable = + getClientFactory().create(OperationalEnvServiceModelStatus.class).getAll(uri); + List<OperationalEnvServiceModelStatus> serviceModelStatuses = new ArrayList<>(); + Iterator<OperationalEnvServiceModelStatus> statusIterator = iterable.iterator(); + statusIterator.forEachRemaining(serviceModelStatuses::add); + return serviceModelStatuses; + } + + public void save(InfraActiveRequests infraActiveRequests) { + HttpHeaders headers = getHttpHeaders(); + URI uri = getUri(infraActiveRequestURI); + HttpEntity<InfraActiveRequests> entity = new HttpEntity<>(infraActiveRequests, headers); + restTemplate.postForLocation(uri, entity); + } + + public <T> void save(T object) { + HttpHeaders headers = getHttpHeaders(); + URI uri = getUri(endpoint + classURLMapper.getURI(object.getClass())); + HttpEntity<T> entity = new HttpEntity<>(object, headers); + restTemplate.postForLocation(uri, entity); + } + + public void updateInfraActiveRequests(InfraActiveRequests request) { + HttpHeaders headers = getHttpHeaders(); + URI uri = getUri(infraActiveRequestURI + request.getRequestId()); + HttpEntity<InfraActiveRequests> entity = new HttpEntity<>(request, headers); + restTemplate.put(uri, entity); + } + + protected URI getUri(String uri) { + return URI.create(uri); + } + + public void saveRequestProcessingData(RequestProcessingData requestProcessingData) { + HttpHeaders headers = getHttpHeaders(); + URI uri = getUri(requestProcessingDataURI); + HttpEntity<RequestProcessingData> entity = new HttpEntity<>(requestProcessingData, headers); + restTemplate.postForLocation(uri, entity); + } + + public List<RequestProcessingData> getRequestProcessingDataBySoRequestId(String soRequestId) { + return this + .getRequestProcessingData(getUri(UriBuilder.fromUri(endpoint + findBySoRequestIdOrderByGroupingIdDesc) + .queryParam(SO_REQUEST_ID, soRequestId).build().toString())); + } + + private List<RequestProcessingData> getRequestProcessingData(URI uri) { + Iterable<RequestProcessingData> requestProcessingDataIterator = + getClientFactory().create(RequestProcessingData.class).getAll(uri); + List<RequestProcessingData> requestProcessingDataList = new ArrayList<>(); + Iterator<RequestProcessingData> it = requestProcessingDataIterator.iterator(); + it.forEachRemaining(requestProcessingDataList::add); + return requestProcessingDataList; + } + + @Component + static class ClassURLMapper { + private static final Map<Class, String> classURLMap = new HashMap<>(); + + ClassURLMapper() { + classURLMap.put(ArchivedInfraRequests.class, "/archivedInfraRequests/"); + classURLMap.put(InfraActiveRequests.class, "/infraActiveRequests/"); + classURLMap.put(OperationalEnvDistributionStatus.class, "/operationalEnvDistributionStatus/"); + classURLMap.put(OperationalEnvServiceModelStatus.class, "/operationalEnvServiceModelStatus/"); + classURLMap.put(OperationStatus.class, "/operationStatus/"); + classURLMap.put(ResourceOperationStatus.class, "/resourceOperationStatus/"); + classURLMap.put(SiteStatus.class, "/siteStatus/"); + classURLMap.put(WatchdogComponentDistributionStatus.class, "/watchdogComponentDistributionStatus/"); + classURLMap.put(WatchdogDistributionStatus.class, "/watchdogDistributionStatus/"); + classURLMap.put(WatchdogServiceModVerIdLookup.class, "/watchdogServiceModVerIdLookup/"); + } + + <T> String getURI(Class<T> className) { + Class actualClass = classURLMap.keySet().stream() + .filter(requestdbClass -> requestdbClass.isAssignableFrom(className)).findFirst().get(); + return classURLMap.get(actualClass); + } + } + + // USED FOR TEST ONLY + public void setPortToEndpoint(String port) { + endpoint = endpoint + port; + } + + // USED FOR TEST ONLY + public void removePortFromEndpoint() { + endpoint = endpoint.substring(0, endpoint.lastIndexOf(':') + 1); + } + + private HttpHeaders getHttpHeaders() { + HttpHeaders headers = new HttpHeaders(); + headers.set(HttpHeaders.AUTHORIZATION, msoAdaptersAuth); + headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); + headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); + return headers; + } + + private HttpEntity<?> getHttpEntity() { + HttpHeaders headers = getHttpHeaders(); + return new HttpEntity<>(headers); + } } diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java index a6f283a264..548bc25815 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java @@ -28,10 +28,10 @@ public class InstanceNameDuplicateCheckRequest { private String instanceName; private String requestScope; - public InstanceNameDuplicateCheckRequest() { - } + public InstanceNameDuplicateCheckRequest() {} - public InstanceNameDuplicateCheckRequest(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) { + public InstanceNameDuplicateCheckRequest(HashMap<String, String> instanceIdMap, String instanceName, + String requestScope) { this.instanceIdMap = instanceIdMap; this.instanceName = instanceName; this.requestScope = requestScope; diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/exceptions/NoEntityFoundException.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/exceptions/NoEntityFoundException.java index 76418629e1..7f00c42038 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/exceptions/NoEntityFoundException.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/exceptions/NoEntityFoundException.java @@ -19,6 +19,7 @@ */ package org.onap.so.db.request.exceptions; + public class NoEntityFoundException extends Exception { /** @@ -27,7 +28,7 @@ public class NoEntityFoundException extends Exception { private static final long serialVersionUID = 545820289784366486L; public NoEntityFoundException(String errorMessage) { - super(errorMessage); + super(errorMessage); } diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java index da72ef985c..e4464450ea 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java @@ -23,7 +23,6 @@ package org.onap.so.requestsdb; import java.sql.Timestamp; - import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; import org.slf4j.Logger; @@ -34,79 +33,84 @@ import org.springframework.stereotype.Component; @Component public class RequestsDBHelper { - - private static final String UNKNOWN = "UNKNOWN"; - private static Logger logger = LoggerFactory.getLogger(RequestsDBHelper.class); - private String className = this.getClass().getSimpleName() +" class\'s "; - private String methodName = ""; - private String classMethodMessage = ""; - @Autowired - @Qualifier("RequestsDbClient") - private RequestsDbClient requestsDbClient; - /** - * 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; - logger.debug("Begin of {}", classMethodMessage); - - InfraActiveRequests request = requestsDbClient.getInfraActiveRequestbyRequestId(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()); + + private static final String UNKNOWN = "UNKNOWN"; + private static Logger logger = LoggerFactory.getLogger(RequestsDBHelper.class); + private String className = this.getClass().getSimpleName() + " class\'s "; + private String methodName = ""; + private String classMethodMessage = ""; + @Autowired + @Qualifier("RequestsDbClient") + private RequestsDbClient requestsDbClient; + + /** + * 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; + logger.debug("Begin of {}", classMethodMessage); + + InfraActiveRequests request = requestsDbClient.getInfraActiveRequestbyRequestId(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); - requestsDbClient.save(request); - - logger.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; - logger.debug("Begin of {}", classMethodMessage); - - InfraActiveRequests request = requestsDbClient.getInfraActiveRequestbyRequestId(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()); + requestsDbClient.save(request); + + logger.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; + logger.debug("Begin of {}", classMethodMessage); + + InfraActiveRequests request = requestsDbClient.getInfraActiveRequestbyRequestId(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); - requestsDbClient.save(request); - - logger.debug("End of {}", classMethodMessage); - - } + requestsDbClient.save(request); + + logger.debug("End of {}", classMethodMessage); + + } } diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDbConstant.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDbConstant.java index 60bad3791c..deb4ab96bb 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDbConstant.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDbConstant.java @@ -21,13 +21,12 @@ package org.onap.so.requestsdb; /** - * The constants of the request db - * <br> + * The constants of the request db <br> * <p> * </p> * * @author - * @version ONAP Amsterdam Release 2017-08-28 + * @version ONAP Amsterdam Release 2017-08-28 */ public class RequestsDbConstant { diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/TimestampXMLAdapter.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/TimestampXMLAdapter.java index 3a326598a7..d1477c0674 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/TimestampXMLAdapter.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/TimestampXMLAdapter.java @@ -22,21 +22,20 @@ package org.onap.so.requestsdb; import java.sql.Timestamp; - import javax.xml.bind.annotation.adapters.XmlAdapter; -public class TimestampXMLAdapter extends XmlAdapter <Long, Timestamp> { +public class TimestampXMLAdapter extends XmlAdapter<Long, Timestamp> { @Override - public Long marshal (Timestamp v) throws Exception { - return v.getTime (); + public Long marshal(Timestamp v) throws Exception { + return v.getTime(); } @Override - public Timestamp unmarshal (Long v) throws Exception { + public Timestamp unmarshal(Long v) throws Exception { if (v == null) { return new Timestamp(0); } - return new Timestamp (v); + return new Timestamp(v); } } diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/beans/BeansTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/beans/BeansTest.java index 3f9443ff4a..4211a5ed47 100644 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/beans/BeansTest.java +++ b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/beans/BeansTest.java @@ -21,16 +21,13 @@ package org.onap.so.db.request.beans; import static org.onap.so.openpojo.rules.HasAnnotationMatcher.hasAnnotation; - import javax.persistence.Temporal; - import org.junit.Test; import org.onap.so.openpojo.rules.CustomSetterMustExistRule; import org.onap.so.openpojo.rules.EqualsAndHashCodeTester; import org.onap.so.openpojo.rules.HasEqualsAndHashCodeRule; import org.onap.so.openpojo.rules.HasToStringRule; import org.onap.so.openpojo.rules.ToStringTester; - import com.openpojo.reflection.PojoClass; import com.openpojo.reflection.PojoClassFilter; import com.openpojo.reflection.filters.FilterEnum; @@ -43,29 +40,24 @@ import com.openpojo.validation.test.impl.SetterTester; public class BeansTest { - private PojoClassFilter filterTestClasses = new FilterTestClasses(); - - @Test - public void pojoStructure() { - test("org.onap.so.db.request.beans"); - } - - private void test(String pojoPackage) { - Validator validator = ValidatorBuilder.create() - .with(new GetterMustExistRule()) - .with(new CustomSetterMustExistRule().exclude(hasAnnotation(Temporal.class))) - .with(new HasEqualsAndHashCodeRule()) - .with(new HasToStringRule()) - .with(new SetterTester()) - .with(new GetterTester()) - .with(new EqualsAndHashCodeTester()) - .with(new ToStringTester()) - .build(); - validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, new FilterEnum()); - } - private static class FilterTestClasses implements PojoClassFilter { - public boolean include(PojoClass pojoClass) { - return !pojoClass.getSourcePath().contains("/test-classes/"); - } - } + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + @Test + public void pojoStructure() { + test("org.onap.so.db.request.beans"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create().with(new GetterMustExistRule()) + .with(new CustomSetterMustExistRule().exclude(hasAnnotation(Temporal.class))) + .with(new HasEqualsAndHashCodeRule()).with(new HasToStringRule()).with(new SetterTester()) + .with(new GetterTester()).with(new EqualsAndHashCodeTester()).with(new ToStringTester()).build(); + validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, new FilterEnum()); + } + + private static class FilterTestClasses implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } } |