From 1cfb08779ea0e00be69e072a940b3063e049fe6b Mon Sep 17 00:00:00 2001 From: Ofir Sonsino Date: Wed, 31 Jan 2018 17:19:00 +0200 Subject: org.onap migration Change-Id: I52f0b2851f2c765752b6d21f49b32136d7d72a3d Issue-ID: VID-86 Signed-off-by: Ofir Sonsino --- .../org/onap/vid/mso/rest/AsyncRequestStatus.java | 123 ++++++ .../org/onap/vid/mso/rest/MsoRestClientNew.java | 435 +++++++++++++++++++++ .../OperationEnvironmentRequestDetails.java | 120 ++++++ .../org/onap/vid/mso/rest/RelatedInstance.java | 125 ++++++ .../java/org/onap/vid/mso/rest/RelatedModel.java | 125 ++++++ .../main/java/org/onap/vid/mso/rest/Request.java | 146 +++++++ .../java/org/onap/vid/mso/rest/RequestDetails.java | 235 +++++++++++ .../java/org/onap/vid/mso/rest/RequestList.java | 137 +++++++ .../java/org/onap/vid/mso/rest/RequestWrapper.java | 35 ++ .../main/java/org/onap/vid/mso/rest/Response.java | 54 +++ .../java/org/onap/vid/mso/rest/RestInterface.java | 68 ++++ .../src/main/java/org/onap/vid/mso/rest/Task.java | 119 ++++++ .../main/java/org/onap/vid/mso/rest/TaskList.java | 16 + 13 files changed, 1738 insertions(+) create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/rest/OperationalEnvironment/OperationEnvironmentRequestDetails.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/rest/RelatedInstance.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/rest/RelatedModel.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/rest/Request.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestDetails.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestList.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestWrapper.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/rest/Response.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/rest/RestInterface.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/rest/Task.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/rest/TaskList.java (limited to 'vid-app-common/src/main/java/org/onap/vid/mso/rest') diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java new file mode 100644 index 000000000..f47e16fe0 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java @@ -0,0 +1,123 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.vid.mso.rest; + +//import java.util.HashMap; +//import java.util.Map; +//import javax.annotation.Generated; + +import org.onap.vid.domain.mso.InstanceIds; +import org.onap.vid.domain.mso.RequestStatus; +//import com.fasterxml.jackson.annotation.JsonAnyGetter; +//import com.fasterxml.jackson.annotation.JsonAnySetter; +//import com.fasterxml.jackson.annotation.JsonCreator; +//import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +//import com.fasterxml.jackson.annotation.JsonPropertyOrder; +//import com.fasterxml.jackson.annotation.JsonValue; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + + +/** + * request structure. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) + +public class AsyncRequestStatus extends org.onap.vid.domain.mso.AsyncRequestStatus { + + + /** The instance ids. */ + private InstanceIds instanceIds; + + /** The request status. */ + private RequestStatus requestStatus; + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.AsyncRequestStatus#getInstanceIds() + */ + public InstanceIds getInstanceIds() { + return instanceIds; + } + + /** + * Sets the instance ids. + * + * @param instanceIds the new instance ids + */ + public void setInstanceIds(InstanceIds instanceIds) { + this.instanceIds = instanceIds; + } + + + /** + * (Required). + * + * @return The requestStatus + */ + @JsonProperty("requestStatus") + public RequestStatus getRequestStatus() { + return requestStatus; + } + + /** + * (Required). + * + * @param requestStatus The requestStatus + */ + @JsonProperty("requestStatus") + public void setRequestStatus(RequestStatus requestStatus) { + this.requestStatus = requestStatus; + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.AsyncRequestStatus#toString() + */ + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.AsyncRequestStatus#hashCode() + */ + @Override + public int hashCode() { + return new HashCodeBuilder().append(getCorrelator()).append(getFinishTime()).append(instanceIds).append(getRequestId()).append(getRequestScope()).append(getRequestStatus()).append(getRequestType()).append(getStartTime()).append(getAdditionalProperties()).toHashCode(); + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.AsyncRequestStatus#equals(java.lang.Object) + */ + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof AsyncRequestStatus) == false) { + return false; + } + AsyncRequestStatus rhs = ((AsyncRequestStatus) other); + return new EqualsBuilder().append(getCorrelator(), rhs.getCorrelator()).append(getFinishTime(), rhs.getFinishTime()).append(instanceIds, rhs.instanceIds).append(getRequestId(), rhs.getRequestId()).append(getRequestScope(), rhs.getRequestScope()).append(getRequestStatus(), rhs.getRequestStatus()).append(getRequestType(), rhs.getRequestType()).append(getStartTime(), rhs.getStartTime()).append(getAdditionalProperties(), rhs.getAdditionalProperties()).isEquals(); + } +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java new file mode 100644 index 000000000..9bb54035d --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java @@ -0,0 +1,435 @@ +package org.onap.vid.mso.rest; + +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.vid.changeManagement.MsoRequestDetails; +import org.onap.vid.changeManagement.RequestDetailsWrapper; +import org.onap.vid.model.RequestReferencesContainer; +import org.onap.vid.mso.*; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + + +/** + * Created by pickjonathan on 21/06/2017. + */ +public class MsoRestClientNew extends RestMsoImplementation implements MsoInterface { + + /** + * The Constant dateFormat. + */ + final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); + private final String ORIGINAL_REQUEST_ID = "originalRequestId"; + /** + * The logger. + */ + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoRestClientNew.class); + + @Override + public MsoResponseWrapper createSvcInstance(RequestDetails requestDetails, String endpoint) throws Exception { + String methodName = "createSvcInstance "; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + return createInstance(requestDetails, endpoint); + } + + @Override + public MsoResponseWrapper createVnf(RequestDetails requestDetails, String endpoint) throws Exception { + + String methodName = "createVnf"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + return createInstance(requestDetails, endpoint); + } + + @Override + public MsoResponseWrapper createNwInstance(RequestDetails requestDetails, String endpoint) throws Exception { + + String methodName = "createNwInstance"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + return createInstance(requestDetails, endpoint); + } + + @Override + public MsoResponseWrapper createVolumeGroupInstance(RequestDetails requestDetails, String endpoint) throws Exception { + String methodName = "createVolumeGroupInstance"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + return createInstance(requestDetails, endpoint); + } + + @Override + public MsoResponseWrapper createVfModuleInstance(RequestDetails requestDetails, String endpoint) throws Exception { + String methodName = "createVfModuleInstance"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + return createInstance(requestDetails, endpoint); + } + + @Override + public MsoResponseWrapper createConfigurationInstance(RequestDetails requestDetails, String endpoint) throws Exception { + String methodName = "createConfigurationInstance"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + return createInstance(requestDetails, endpoint); + } + + @Override + public MsoResponseWrapper deleteSvcInstance(RequestDetails requestDetails, String endpoint) throws Exception { + String methodName = "deleteSvcInstance"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + return deleteInstance(requestDetails, endpoint); + } + + @Override + public MsoResponseWrapper deleteVnf(RequestDetails requestDetails, String endpoint) throws Exception { + String methodName = "deleteVnf"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + return deleteInstance(requestDetails, endpoint); + } + + @Override + public MsoResponseWrapper deleteVfModule(RequestDetails requestDetails, String endpoint) throws Exception { + String methodName = "deleteVfModule"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + return deleteInstance(requestDetails, endpoint); + } + + @Override + public MsoResponseWrapper deleteVolumeGroupInstance(RequestDetails requestDetails, String endpoint) throws Exception { + String methodName = "deleteVolumeGroupInstance"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + return deleteInstance(requestDetails, endpoint); + } + + @Override + public MsoResponseWrapper deleteNwInstance(RequestDetails requestDetails, String endpoint) throws Exception { + String methodName = "deleteNwInstance"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + return deleteInstance(requestDetails, endpoint); + } + + @Override + public void getOrchestrationRequest(String t, String sourceId, String endpoint, RestObject restObject) throws Exception { + Get(t, sourceId, endpoint, restObject); + } + + public void getManualTasks(String t, String sourceId, String endpoint, RestObject restObject) throws Exception { + Get(t, sourceId, endpoint, restObject); + } + + + public MsoResponseWrapper createInstance(RequestDetails request, String path) throws Exception { + String methodName = "createInstance"; + logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start"); + + try { + RestObject restObjStr = new RestObject(); + + String str = new String(); + + restObjStr.set(str); + + Post(str, request, "", path, restObjStr); + MsoResponseWrapper w = MsoUtil.wrapResponse(restObjStr); + + return w; + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + throw e; + } + } + + + /** + * Delete instance. + * + * @param request the request + * @param path the path + * @return the mso response wrapper + * @throws Exception the exception + */ + public MsoResponseWrapper deleteInstance(RequestDetails request, String path) throws Exception { + String methodName = "deleteInstance"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + try { + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Delete, path =[" + path + "]"); + + RestObject restObjStr = new RestObject(); + String str = new String(); + restObjStr.set(str); + Delete(str, request, "", path, restObjStr); + MsoResponseWrapper w = MsoUtil.wrapResponse(restObjStr); + + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse()); + return w; + + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + throw e; + } + + } + + public MsoResponseWrapper getOrchestrationRequestsForDashboard(String t, String sourceId, String endpoint, RestObject restObject) throws Exception { + String methodName = "getOrchestrationRequestsForDashboard"; + logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start"); + + try { + getOrchestrationRequest(t, sourceId, endpoint, restObject); + MsoResponseWrapper w = MsoUtil.wrapResponse(restObject); + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse()); + + return w; + + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + throw e; + } + } + + public MsoResponseWrapper getManualTasksByRequestId(String t, String sourceId, String endpoint, RestObject restObject) throws Exception { + String methodName = "getManualTasksByRequestId"; + logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start"); + + try { + getManualTasks(t, sourceId, endpoint, restObject); + MsoResponseWrapper w = MsoUtil.wrapResponse(restObject); + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse()); + + return MsoUtil.wrapResponse(restObject); + + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + throw e; + } + } + + + @Override + public MsoResponseWrapper completeManualTask(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject restObject) throws Exception { + String methodName = "completeManualTask"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Complete "); + try { + + Post(t, requestDetails, sourceId, endpoint, restObject); + MsoResponseWrapper w = MsoUtil.wrapResponse(restObject); + + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse()); + return w; + + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + throw e; + } + } + + @Override + public MsoResponseWrapper replaceVnf(org.onap.vid.changeManagement.RequestDetails requestDetails, String endpoint) throws Exception { + String methodName = "replaceVnf"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + return replaceInstance(requestDetails, endpoint); + } + + @Override + public MsoResponseWrapper deleteConfiguration(RequestDetails requestDetails, String pmc_endpoint) + throws Exception { + String methodName = "deleteConfiguration"; + logger.debug(EELFLoggerDelegate.debugLogger, + dateFormat.format(new Date()) + "<== " + methodName + " start"); + + return deleteInstance(requestDetails, pmc_endpoint); + } + + @Override + public MsoResponseWrapper setConfigurationActiveStatus(RequestDetails request, String path) throws Exception { + String methodName = "setConfigurationActiveStatus"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + try { + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling change configuration active status, path =[" + path + "]"); + + RestObject restObjStr = new RestObject(); + String str = new String(); + restObjStr.set(str); + Post(str, request, "", path, restObjStr); + MsoResponseWrapper msoResponseWrapperObject = MsoUtil.wrapResponse(restObjStr); + + return msoResponseWrapperObject; + } catch (Exception e) { + logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + throw e; + } + } + + @Override + public MsoResponseWrapper setPortOnConfigurationStatus(RequestDetails request, String path) throws Exception { + String methodName = "setPortOnConfigurationStatus"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + try { + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling change port configuration status, path =[" + path + "]"); + + RestObject restObjStr = new RestObject(); + String str = new String(); + restObjStr.set(str); + Post(str, request, "", path, restObjStr); + MsoResponseWrapper msoResponseWrapperObject = MsoUtil.wrapResponse(restObjStr); + + return msoResponseWrapperObject; + } catch (Exception e) { + logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + throw e; + } + } + + @Override + public MsoResponseWrapperInterface changeManagementUpdate(RequestDetailsWrapper requestDetails, String endpoint) throws Exception { + RestObject msoResponse = PostForObject(requestDetails, "", endpoint, RequestReferencesContainer.class); + return new MsoResponseWrapper2<>(msoResponse); + } + + public MsoResponseWrapper replaceInstance(org.onap.vid.changeManagement.RequestDetails request, String path) throws Exception { + String methodName = "replaceInstance"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + try { + + + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Replace VNF, path =[" + path + "]"); + RestObject restObjStr = new RestObject(); + String str = new String(); + restObjStr.set(str); + RequestDetailsWrapper requestDetailsWrapper = new RequestDetailsWrapper(); + requestDetailsWrapper.requestDetails = new MsoRequestDetails(request); + + Post(str, requestDetailsWrapper, "", path, restObjStr); + MsoResponseWrapper msoResponseWrapperObject = MsoUtil.wrapResponse(restObjStr); + int status = msoResponseWrapperObject.getStatus(); + if (status == 202) { + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + + ",post succeeded, msoResponseWrapperObject response:" + msoResponseWrapperObject.getResponse()); + } else { + logger.error(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + + ": post failed, msoResponseWrapperObject status" + status + ", response:" + msoResponseWrapperObject.getResponse()); + + // TODO + } + return msoResponseWrapperObject; + + } catch (Exception e) { + logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + throw e; + } + + } + + @Override + public MsoResponseWrapper updateVnf(org.onap.vid.changeManagement.RequestDetails requestDetails, String endpoint) throws Exception { + String methodName = "updateVnf"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + RequestDetailsWrapper wrapper = new RequestDetailsWrapper(); + wrapper.requestDetails = new MsoRequestDetails(requestDetails); + return updateInstance(requestDetails, endpoint); + } + + public MsoResponseWrapper updateInstance(org.onap.vid.changeManagement.RequestDetails request, String path) throws Exception { + String methodName = "updateInstance"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + try { + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Delete, path =[" + path + "]"); + RestObject restObjStr = new RestObject(); + String str = new String(); + restObjStr.set(str); + RequestDetailsWrapper requestDetailsWrapper = new RequestDetailsWrapper(); + requestDetailsWrapper.requestDetails = new MsoRequestDetails(request); + Put(str, requestDetailsWrapper, "", path, restObjStr); + MsoResponseWrapper w = MsoUtil.wrapResponse(restObjStr); + + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse()); + return w; + + } catch (Exception e) { + logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + throw e; + } + + } + + public void setServiceInstanceStatus(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject restObject) throws Exception { + String methodName = "activateServiceInstance"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start "); + try { + + Post(t, requestDetails, sourceId, endpoint, restObject); + MsoResponseWrapper w = MsoUtil.wrapResponse(restObject); + + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w =" + w.getResponse()); + + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + throw e; + } + } + + @Override + public MsoResponseWrapper removeRelationshipFromServiceInstance(RequestDetails requestDetails, String endpoint) throws Exception { + String methodName = "removeRelationshipFromServiceInstance"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + try { + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Remove relationship from service instance, path =[" + endpoint + "]"); + + RestObject restObjStr = new RestObject(); + String str = ""; + restObjStr.set(str); + Post(str, requestDetails, "", endpoint, restObjStr); + + return MsoUtil.wrapResponse(restObjStr); + } catch (Exception e) { + logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + throw e; + } + } + + @Override + public MsoResponseWrapper addRelationshipToServiceInstance(RequestDetails requestDetails, String addRelationshipsPath) throws Exception { + String methodName = "addRelationshipToServiceInstance"; + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); + + try { + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Add relationship to service instance, path =[" + addRelationshipsPath + "]"); + + RestObject restObjStr = new RestObject<>(); + restObjStr.set(""); + Post("", requestDetails, "", addRelationshipsPath, restObjStr); + + return MsoUtil.wrapResponse(restObjStr); + } catch (Exception e) { + logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); + throw e; + } + } + +} \ No newline at end of file diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/OperationalEnvironment/OperationEnvironmentRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/OperationalEnvironment/OperationEnvironmentRequestDetails.java new file mode 100644 index 000000000..2f6d233c2 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/OperationalEnvironment/OperationEnvironmentRequestDetails.java @@ -0,0 +1,120 @@ +package org.onap.vid.mso.rest.OperationalEnvironment; + + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.List; + +public class OperationEnvironmentRequestDetails { + private final RequestInfo requestInfo; + private final List relatedInstanceList; + private final RequestParameters requestParameters; + + public OperationEnvironmentRequestDetails(@JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo, + @JsonProperty(value = "relatedInstanceList", required = true) List relatedInstanceList, + @JsonProperty(value = "requestParameters", required = true) RequestParameters requestParameters) { + this.requestInfo = requestInfo; + this.relatedInstanceList = relatedInstanceList; + this.requestParameters = requestParameters; + } + + public RequestInfo getRequestInfo() { + return requestInfo; + } + + public List getRelatedInstanceList() { + return relatedInstanceList; + } + + public RequestParameters getRequestParameters() { + return requestParameters; + } + + public static class RequestInfo { + private final String resourceType; + private final String instanceName; + private final String source; + private final String requestorId; + + public RequestInfo(@JsonProperty(value = "resourceType", required = true) String resourceType, + @JsonProperty(value = "instanceName", required = true) String instanceName, + @JsonProperty(value = "source", required = true) String source, + @JsonProperty(value = "requestorId", required = true) String requestorId) { + this.resourceType = resourceType; + this.instanceName = instanceName; + this.source = source; + this.requestorId = requestorId; + } + + public String getResourceType() { + return resourceType; + } + + public String getInstanceName() { + return instanceName; + } + + public String getSource() { + return source; + } + + public String getRequestorId() { + return requestorId; + } + } + + public static class RequestParameters { + private final String operationalEnvironmentType; + private final String tenantContext; + private final String workloadContext; + + public RequestParameters(@JsonProperty(value = "operationalEnvironmentType", required = true) String operationalEnvironmentType, + @JsonProperty(value = "tenantContext", required = true) String tenantContext, + @JsonProperty(value = "workloadContext", required = true) String workloadContext) { + this.operationalEnvironmentType = operationalEnvironmentType; + this.tenantContext = tenantContext; + this.workloadContext = workloadContext; + } + public String getOperationalEnvironmentType() { + return operationalEnvironmentType; + } + + public String getTenantContext() { + return tenantContext; + } + + public String getWorkloadContext() { + return workloadContext; + } + } + + @JsonTypeName("relatedInstance") + @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME) + public static class RelatedInstance { + private final String resourceType; + private final String instanceId; + private final String instanceName; + + public String getResourceType() { + return resourceType; + } + + public String getInstanceId() { + return instanceId; + } + + public String getInstanceName() { + return instanceName; + } + + public RelatedInstance(@JsonProperty(value = "instanceName", required = true) String resourceType, + @JsonProperty(value = "instanceId", required = true) String instanceId, + @JsonProperty(value = "instanceName", required = true) String instanceName) { + this.resourceType = resourceType; + this.instanceId = instanceId; + this.instanceName = instanceName; + } + } +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RelatedInstance.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RelatedInstance.java new file mode 100644 index 000000000..b7f120330 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RelatedInstance.java @@ -0,0 +1,125 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.vid.mso.rest; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + + +/** + * modelInfo and optional instanceId and instanceName for a model related to the modelInfo being operated on. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@Generated("org.jsonschema2pojo") +@JsonPropertyOrder({ + "instanceName", + "instanceId", + "modelInfo" +}) +public class RelatedInstance extends org.onap.vid.domain.mso.RelatedInstance{ + + + /** The model info. */ + @JsonProperty("modelInfo") + private org.onap.vid.domain.mso.ModelInfo modelInfo; + + /** The additional properties. */ + @JsonIgnore + private Map additionalProperties = new HashMap(); + + /** + * (Required). + * + * @return The modelInfo + */ + @JsonProperty("modelInfo") + public org.onap.vid.domain.mso.ModelInfo getModelInfo() { + return modelInfo; + } + + /** + * (Required). + * + * @param modelInfo The modelInfo + */ + @JsonProperty("modelInfo") + public void setModelInfo(org.onap.vid.domain.mso.ModelInfo modelInfo) { + this.modelInfo = modelInfo; + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.RelatedInstance#toString() + */ + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.RelatedInstance#getAdditionalProperties() + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.RelatedInstance#setAdditionalProperty(java.lang.String, java.lang.Object) + */ + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.RelatedInstance#hashCode() + */ + @Override + public int hashCode() { + return new HashCodeBuilder().append(getInstanceName()).append(getInstanceId()).append(modelInfo).append(additionalProperties).toHashCode(); + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.RelatedInstance#equals(java.lang.Object) + */ + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof RelatedInstance) == false) { + return false; + } + RelatedInstance rhs = ((RelatedInstance) other); + return new EqualsBuilder().append(getInstanceName(), rhs.getInstanceName()).append(getInstanceId(), rhs.getInstanceId()).append(modelInfo, rhs.getModelInfo()).append(additionalProperties, rhs.additionalProperties).isEquals(); + } + +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RelatedModel.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RelatedModel.java new file mode 100644 index 000000000..39722e172 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RelatedModel.java @@ -0,0 +1,125 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.vid.mso.rest; + +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + + +/** + * modelInfo and optional instance id for a model related to the modelInfo being operated on. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "instanceId", + "modelInfo" +}) +public class RelatedModel extends org.onap.vid.domain.mso.RelatedModel { + + /** (Required). */ + @JsonProperty("modelInfo") + private org.onap.vid.domain.mso.ModelInfo modelInfo; + +// /** The related model object instance list. */ +// @JsonProperty("instanceId") +// private org.openecomp.vid.domain.mso.InstanceIds instanceId; + + /** The additional properties. */ + @JsonIgnore + private Map additionalProperties = new HashMap(); + + /** + * (Required). + * + * @return The modelInfo + */ + @JsonProperty("modelInfo") + public org.onap.vid.domain.mso.ModelInfo getModelInfo() { + return modelInfo; + } + + /** + * (Required). + * + * @param modelInfo The modelInfo + */ + @JsonProperty("modelInfo") + public void setModelInfo(org.onap.vid.domain.mso.ModelInfo modelInfo) { + this.modelInfo = modelInfo; + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.RelatedModel#toString() + */ + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.RelatedModel#getAdditionalProperties() + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.RelatedModel#setAdditionalProperty(java.lang.String, java.lang.Object) + */ + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.RelatedModel#hashCode() + */ + @Override + public int hashCode() { + return new HashCodeBuilder().append(getInstanceId()).append(modelInfo).append(additionalProperties).toHashCode(); + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.RelatedModel#equals(java.lang.Object) + */ + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof RelatedModel) == false) { + return false; + } + RelatedModel rhs = ((RelatedModel) other); + return new EqualsBuilder().append(getInstanceId(), rhs.getInstanceId()).append(modelInfo, rhs.modelInfo).append(additionalProperties, rhs.additionalProperties).isEquals(); + } + +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/Request.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/Request.java new file mode 100644 index 000000000..b1a84ab29 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/Request.java @@ -0,0 +1,146 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.vid.mso.rest; + +//import java.util.HashMap; +//import java.util.Map; +//import javax.annotation.Generated; + +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.vid.domain.mso.InstanceIds; +import org.onap.vid.domain.mso.RequestStatus; +//import com.fasterxml.jackson.annotation.JsonAnyGetter; +//import com.fasterxml.jackson.annotation.JsonAnySetter; +//import com.fasterxml.jackson.annotation.JsonCreator; +//import com.fasterxml.jackson.annotation.JsonIgnore; +//import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +//import com.fasterxml.jackson.annotation.JsonPropertyOrder; +//import com.fasterxml.jackson.annotation.JsonValue; +import org.apache.commons.lang.builder.EqualsBuilder; +//import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + + +/** + * request structure. + */ +public class Request extends org.onap.vid.domain.mso.Request { + + + /** The instance ids. */ + private InstanceIds instanceIds; + + /** The request details. */ + private RequestDetails requestDetails; + + /** The request status. */ + private RequestStatus requestStatus; + + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.Request#getInstanceIds() + */ + @JsonProperty("instanceIds") + public InstanceIds getInstanceIds() { + return instanceIds; + } + + /** + * Sets the instance ids. + * + * @param instanceIds The instanceIds + */ + @JsonProperty("instanceIds") + public void setInstanceIds(InstanceIds instanceIds) { + this.instanceIds = instanceIds; + } + + /** + * (Required). + * + * @return The requestDetails + */ + @JsonProperty("requestDetails") + public RequestDetails getRequestDetails() { + return requestDetails; + } + + /** + * (Required). + * + * @param requestDetails The requestDetails + */ + @JsonProperty("requestDetails") + public void setRequestDetails(RequestDetails requestDetails) { + this.requestDetails = requestDetails; + } + + + /** + * Gets the request status. + * + * @return The requestStatus + */ + @JsonProperty("requestStatus") + public RequestStatus getRequestStatus() { + return requestStatus; + } + + /** + * Sets the request status. + * + * @param requestStatus The requestStatus + */ + @JsonProperty("requestStatus") + public void setRequestStatus(RequestStatus requestStatus) { + this.requestStatus = requestStatus; + } + + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.Request#toString() + */ + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.Request#equals(java.lang.Object) + */ + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof Request) == false) { + return false; + } + Request rhs = ((Request) other); + return new EqualsBuilder().append(getFinishTime(), rhs.getFinishTime()).append(getInstanceIds(), rhs.getInstanceIds()).append(getRequestDetails(), rhs.getRequestDetails()).append(getRequestId(), rhs.getRequestId()).append(getRequestScope(), rhs.getRequestScope()).append(getRequestStatus(), rhs.getRequestStatus()).append(getRequestType(), rhs.getRequestType()).append(getStartTime(), rhs.getStartTime()).append(getAdditionalProperties(), rhs.getAdditionalProperties()).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(17, 37).append(getFinishTime()).append(getInstanceIds()).append(getRequestDetails()).append(getRequestId()).append(getRequestScope()).append(getRequestStatus()).append(getRequestType()).append(getStartTime()).append(getAdditionalProperties()).toHashCode(); + } +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestDetails.java new file mode 100644 index 000000000..1e059896f --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestDetails.java @@ -0,0 +1,235 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.vid.mso.rest; + +import java.util.HashMap; +import java.util.Map; +import java.util.List; + +import org.onap.vid.domain.mso.*; +import org.onap.vid.domain.mso.SubscriberInfo; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + + +/** + * aggregates the context, configuraiton and detailed parameters associated with the request into a single structure. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "cloudConfiguration", + "modelInfo", + "relatedModelList", + "requestInfo", + "subscriberInfo", + "requestParameters" +}) +public class RequestDetails{ + + /** The cloud configuration. */ + @JsonProperty("cloudConfiguration") + private CloudConfiguration cloudConfiguration; + + /** The model info. */ + @JsonProperty("modelInfo") + private ModelInfo modelInfo; + + /** The related model list. */ + @JsonProperty("relatedModelList") + private List relatedInstanceList; + + /** The request info. */ + @JsonProperty("requestInfo") + private RequestInfo requestInfo; + + /** The subscriber info. */ + @JsonProperty("subscriberInfo") + private SubscriberInfo subscriberInfo; + + /** The request parameters. */ + @JsonProperty("requestParameters") + private RequestParameters requestParameters; + + /** The additional properties. */ + @JsonIgnore + private Map additionalProperties = new HashMap(); + + /** + * Gets the cloud configuration. + * + * @return The cloudConfiguration + */ + @JsonProperty("cloudConfiguration") + public CloudConfiguration getCloudConfiguration() { + return cloudConfiguration; + } + + /** + * Sets the cloud configuration. + * + * @param cloudConfiguration The cloudConfiguration + */ + @JsonProperty("cloudConfiguration") + public void setCloudConfiguration(CloudConfiguration cloudConfiguration) { + this.cloudConfiguration = cloudConfiguration; + } + + /** + * Gets the model info. + * + * @return The modelInfo + */ + @JsonProperty("modelInfo") + public ModelInfo getModelInfo() { + return modelInfo; + } + + /** + * Sets the model info. + * + * @param modelInfo The modelInfo + */ + @JsonProperty("modelInfo") + public void setModelInfo(ModelInfo modelInfo) { + this.modelInfo = modelInfo; + } + /** + * Gets the related instance list. + * + * @return The relatedInstanceList + */ + @JsonProperty("relatedInstanceList") + public List getRelatedInstanceList() { + return relatedInstanceList; + } + + /** + * Sets the related model list. + * + * @param relatedInstanceList The relatedInstanceList + */ + @JsonProperty("relatedInstanceList") + public void setRelatedInstanceList( List relatedInstanceList) { + this.relatedInstanceList = relatedInstanceList; + } + + /** + * Gets the request info. + * + * @return The requestInfo + */ + @JsonProperty("requestInfo") + public RequestInfo getRequestInfo() { + return requestInfo; + } + + /** + * Sets the request info. + * + * @param requestInfo The requestInfo + */ + @JsonProperty("requestInfo") + public void setRequestInfo(RequestInfo requestInfo) { + this.requestInfo = requestInfo; + } + + /** + * Gets the subscriber info. + * + * @return The subscriberInfo + */ + @JsonProperty("subscriberInfo") + public SubscriberInfo getSubscriberInfo() { + return subscriberInfo; + } + + /** + * Sets the subscriber info. + * + * @param subscriberInfo The subscriberInfo + */ + @JsonProperty("subscriberInfo") + public void setSubscriberInfo(SubscriberInfo subscriberInfo) { + this.subscriberInfo = subscriberInfo; + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.RequestDetails#toString() + */ + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.RequestDetails#getAdditionalProperties() + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.RequestDetails#setAdditionalProperty(java.lang.String, java.lang.Object) + */ + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.RequestDetails#hashCode() + */ + @Override + public int hashCode() { + return new HashCodeBuilder().append(cloudConfiguration).append(modelInfo).append(relatedInstanceList).append(requestInfo).append(getRequestParameters()).append(subscriberInfo).append(additionalProperties).toHashCode(); + } + + /* (non-Javadoc) + * @see org.openecomp.vid.domain.mso.RequestDetails#equals(java.lang.Object) + */ + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof RequestDetails) == false) { + return false; + } + RequestDetails rhs = ((RequestDetails) other); + return new EqualsBuilder().append(cloudConfiguration, rhs.cloudConfiguration).append(modelInfo, rhs.modelInfo).append(relatedInstanceList, rhs.relatedInstanceList).append(requestInfo, rhs.requestInfo).append(getRequestParameters(), rhs.getRequestParameters()).append(subscriberInfo, rhs.subscriberInfo).append(additionalProperties, rhs.additionalProperties).isEquals(); + } + + public RequestParameters getRequestParameters() { + return requestParameters; + } + + public void setRequestParameters(RequestParameters requestParameters) { + this.requestParameters = requestParameters; + } +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestList.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestList.java new file mode 100644 index 000000000..8f8272c07 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestList.java @@ -0,0 +1,137 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.vid.mso.rest; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Generated; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +//import com.fasterxml.jackson.annotation.JsonInclude; +//import com.fasterxml.jackson.annotation.JsonProperty; +//import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; +import java.util.List; + +/** + * List of relatedModel structures that are related to a modelInfo being operated on. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@Generated("org.jsonschema2pojo") +@JsonPropertyOrder({ + "finishTime", + "instanceIds", + "requestDetails", + "requestId", + "requestScope", + "requestStatus", + "requestType", + "startTime" +}) + +public class RequestList { + + /** The request list. */ + private List requestList; + + /** The additional properties. */ + @JsonIgnore + private Map additionalProperties = new HashMap(); + + /** + * (Required). + * + * @return The RelatedModel List + */ + public List getRequestList() { + return requestList; + } + + /** + * Sets the request list. + * + * @param l the new request list + */ + public void setRequestList(List l) { + this.requestList = l; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + /** + * Gets the additional properties. + * + * @return the additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Sets the additional property. + * + * @param name the name + * @param value the value + */ + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + return new HashCodeBuilder().append(getRequestList()).append(additionalProperties).toHashCode(); + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof RequestList) == false) { + return false; + } + RequestList rhs = ((RequestList) other); + return new EqualsBuilder().append(getRequestList(), rhs.getRequestList()).append(additionalProperties, rhs.additionalProperties).isEquals(); + } + +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestWrapper.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestWrapper.java new file mode 100644 index 000000000..c93d0e563 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestWrapper.java @@ -0,0 +1,35 @@ +package org.onap.vid.mso.rest; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * request wrapper structure. + */ +public class RequestWrapper { + + + /** The request. */ + private Request request; + + + /** + * Gets the request. + * + * @return The requestDetails + */ + @JsonProperty("request") + public Request getRequest() { + return request; + } + + /** + * Sets the request. + * + * @param request The request + */ + @JsonProperty + public void setRequest(Request request) { + this.request = request; + } + +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/Response.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/Response.java new file mode 100644 index 000000000..ee074f38d --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/Response.java @@ -0,0 +1,54 @@ +package org.onap.vid.mso.rest; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Response { + + /** The status. */ + private int status; + + /** The entity. */ + private RequestList entity; + + /** + * Gets the status. + * + * @return The status + */ + @JsonProperty("status") + public int getStatus() { + return status; + } + + /** + * Sets the status. + * + * @param status The status + */ + @JsonProperty("status") + public void setStatus(int status) { + this.status = status; + } + + /** + * Gets the entity. + * + * @return The entity + */ + @JsonProperty("entity") + public RequestList getEntity() { + return entity; + } + + /** + * Sets the entity. + * + * @param entity The entity + */ + @JsonProperty("entity") + public void setEntity(RequestList entity) { + this.entity = entity; + } + + +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RestInterface.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RestInterface.java new file mode 100644 index 000000000..9fc95fcec --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RestInterface.java @@ -0,0 +1,68 @@ +package org.onap.vid.mso.rest; + +import org.onap.vid.mso.RestObject; + +import javax.ws.rs.core.MultivaluedHashMap; + +/** + * Created by pickjonathan on 26/06/2017. + */ +public interface RestInterface { + + /** + * Inits the rest client. + */ + MultivaluedHashMap initMsoClient(); + + /** + * Gets the. + * + * @param the generic type + * @param t the t + * @param sourceId the source id + * @param path the path + * @param restObject the rest object + * @throws Exception the exception + */ + void Get (T t, String sourceId, String path, RestObject restObject ) throws Exception; + + /** + * Delete. + * + * @param the generic type + * @param t the t + * @param r the r + * @param sourceID the source ID + * @param path the path + * @param restObject the rest object + * @throws Exception the exception + */ + void Delete(T t, RequestDetails r, String sourceID, String path, RestObject restObject) throws Exception; + + /** + * Post. + * + * @param the generic type + * @param t the t + * @param r the r + * @param sourceID the source ID + * @param path the path + * @param restObject the rest object + * @throws Exception the exception + */ + void Post(T t, Object r, String sourceID, String path, RestObject restObject) throws Exception; + + /** + * Put. + * + * @param the generic type + * @param t the t + * @param r the r + * @param sourceID the source ID + * @param path the path + * @param restObject the rest object + * @throws Exception the exception + */ + void Put(T t, org.onap.vid.changeManagement.RequestDetailsWrapper r, String sourceID, String path, RestObject restObject) throws Exception; + +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/Task.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/Task.java new file mode 100644 index 000000000..79aaaea51 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/Task.java @@ -0,0 +1,119 @@ +package org.onap.vid.mso.rest; + +import java.util.List; + +public class Task { + + private String taskId; + private String type; + private String nfRole; + private String subscriptionServiceType; + private String originalRequestId; + private String originalRequestorId; + private String errorSource; + private String errorCode; + private String errorMessage; + private String buildingBlockName; + private String buildingBlockStep; + private List validResponses; + + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getNfRole() { + return nfRole; + } + + public void setNfRole(String nfRole) { + this.nfRole = nfRole; + } + + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + + public String getOriginalRequestId() { + return originalRequestId; + } + + public void setOriginalRequestId(String originalRequestId) { + this.originalRequestId = originalRequestId; + } + + public String getOriginalRequestorId() { + return originalRequestorId; + } + + public void setOriginalRequestorId(String originalRequestorId) { + this.originalRequestorId = originalRequestorId; + } + + public String getErrorSource() { + return errorSource; + } + + public void setErrorSource(String errorSource) { + this.errorSource = errorSource; + } + + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + public String getBuildingBlockName() { + return buildingBlockName; + } + + public void setBuildingBlockName(String buildingBlockName) { + this.buildingBlockName = buildingBlockName; + } + + public String getBuildingBlockStep() { + return buildingBlockStep; + } + + public void setBuildingBlockStep(String buildingBlockStep) { + this.buildingBlockStep = buildingBlockStep; + } + + public List getValidResponses() { + return validResponses; + } + + public void setValidResponses(List validResponses) { + this.validResponses = validResponses; + } + + + +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/TaskList.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/TaskList.java new file mode 100644 index 000000000..bbff333af --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/TaskList.java @@ -0,0 +1,16 @@ +package org.onap.vid.mso.rest; + +import java.util.List; + +public class TaskList { + + public List getTaskList() { + return taskList; + } + + public void setTaskList(List taskList) { + this.taskList = taskList; + } + + private List taskList; +} -- cgit 1.2.3-korg