diff options
Diffstat (limited to 'adapters/mso-adapters-rest-interface/src/main/java/org')
20 files changed, 1373 insertions, 12 deletions
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryAllottedResourceCustomization.java new file mode 100644 index 0000000000..fc4cec9201 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryAllottedResourceCustomization.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.adapters.catalogrest; + +import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; +import org.openecomp.mso.logger.MsoLogger; +import org.codehaus.jackson.map.ObjectMapper; +import org.jboss.resteasy.annotations.providers.NoJackson; + +import javax.xml.bind.annotation.XmlRootElement; +import java.util.ArrayList; +import java.util.List; + +@XmlRootElement(name = "serviceAllottedResources") +@NoJackson +public class QueryAllottedResourceCustomization { + private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private List<AllottedResourceCustomization> allottedResourceCustomization; + + public QueryAllottedResourceCustomization() { super(); allottedResourceCustomization = new ArrayList<AllottedResourceCustomization>(); } + public QueryAllottedResourceCustomization(List<AllottedResourceCustomization> vlist) { allottedResourceCustomization = vlist; } + + public List<AllottedResourceCustomization> getServiceAllottedResources(){ return this.allottedResourceCustomization; } + public void setServiceAllottedResources(List<AllottedResourceCustomization> v) { this.allottedResourceCustomization = v; } + + @Override + public String toString () { + StringBuffer buf = new StringBuffer(); + + boolean first = true; + int i = 1; + for (AllottedResourceCustomization o : allottedResourceCustomization) { + buf.append(i+"\t"); + if (!first) buf.append("\n"); first = false; + buf.append(o); + } + return buf.toString(); + } + + public String toJsonString() { + String jsonString = null; + try { + ObjectMapper mapper = new ObjectMapper(); + jsonString = mapper.writeValueAsString(this); + LOGGER.debug ("AllottedResourceCustomization jsonString: "+jsonString); + } + catch (Exception e) { + LOGGER.debug ("AllottedResourceCustomization jsonString exception:"+e.getMessage()); + } + return jsonString; + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceMacroHolder.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceMacroHolder.java new file mode 100644 index 0000000000..2cb756b856 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceMacroHolder.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.adapters.catalogrest; + +import org.openecomp.mso.db.catalog.beans.ServiceMacroHolder; +import org.openecomp.mso.logger.MsoLogger; +import org.codehaus.jackson.map.ObjectMapper; +import org.jboss.resteasy.annotations.providers.NoJackson; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "serviceResources") +@NoJackson +public class QueryServiceMacroHolder { + private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private ServiceMacroHolder serviceMacroHolder; + + public QueryServiceMacroHolder() { super(); serviceMacroHolder = new ServiceMacroHolder(); } + public QueryServiceMacroHolder(ServiceMacroHolder vlist) { serviceMacroHolder = vlist; } + + public ServiceMacroHolder getServiceResources(){ return this.serviceMacroHolder; } + public void setServiceResources(ServiceMacroHolder v) { this.serviceMacroHolder = v; } + + @Override + public String toString () { return serviceMacroHolder.toString(); } + + public String toJsonString() { + String jsonString = null; + try { + ObjectMapper mapper = new ObjectMapper(); + jsonString = mapper.writeValueAsString(this); + LOGGER.debug ("QueryServiceMacroHolder jsonString: "+jsonString); + } + catch (Exception e) { + LOGGER.debug ("QueryServiceMacroHolder jsonString exception:"+e.getMessage()); + } + return jsonString; + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceNetworks.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceNetworks.java new file mode 100644 index 0000000000..dfc3683fad --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceNetworks.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.adapters.catalogrest; + +import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization; +import org.openecomp.mso.logger.MsoLogger; +import org.codehaus.jackson.map.ObjectMapper; +import org.jboss.resteasy.annotations.providers.NoJackson; + +import javax.xml.bind.annotation.XmlRootElement; +import java.util.ArrayList; +import java.util.List; + +@XmlRootElement(name = "serviceNetworks") +@NoJackson +public class QueryServiceNetworks { + private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private List<NetworkResourceCustomization> serviceNetworks; + + public QueryServiceNetworks() { super(); serviceNetworks = new ArrayList<NetworkResourceCustomization>(); } + public QueryServiceNetworks(List<NetworkResourceCustomization> vlist) { + LOGGER.debug ("QueryServiceNetworks:"); + serviceNetworks = new ArrayList<NetworkResourceCustomization>(); + for (NetworkResourceCustomization o : vlist) { + LOGGER.debug ("-- o is a serviceNetworks ----"); + LOGGER.debug (o.toString()); + serviceNetworks.add(o); + LOGGER.debug ("-------------------"); + } + } + + public List<NetworkResourceCustomization> getServiceNetworks(){ return this.serviceNetworks; } + public void setServiceNetworks(List<NetworkResourceCustomization> v) { this.serviceNetworks = v; } + + @Override + public String toString () { + StringBuffer buf = new StringBuffer(); + + boolean first = true; + int i = 1; + for (NetworkResourceCustomization o : serviceNetworks) { + buf.append(i+"\t"); + if (!first) buf.append("\n"); first = false; + buf.append(o); + } + return buf.toString(); + } + + public String toJsonString() { + String jsonString = null; + try { + ObjectMapper mapper = new ObjectMapper(); + jsonString = mapper.writeValueAsString(this); + LOGGER.debug ("QueryServiceNetworks jsonString: "+jsonString); + } + catch (Exception e) { + LOGGER.debug ("QueryServiceNetworks jsonString exception:"+e.getMessage()); + } + return jsonString; + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceVnfs.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceVnfs.java new file mode 100644 index 0000000000..0ea054309b --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceVnfs.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.adapters.catalogrest; +/* should be called QueryVnfResource.java */ + +import org.openecomp.mso.db.catalog.beans.VnfResource; +import org.openecomp.mso.logger.MsoLogger; +import org.codehaus.jackson.map.ObjectMapper; +import org.jboss.resteasy.annotations.providers.NoJackson; + +import javax.xml.bind.annotation.XmlRootElement; +import java.util.ArrayList; +import java.util.List; + +@XmlRootElement(name = "serviceVnfs") +@NoJackson +public class QueryServiceVnfs { + private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private List<VnfResource> serviceVnfs; + + public QueryServiceVnfs() { super(); serviceVnfs = new ArrayList<VnfResource>(); } + public QueryServiceVnfs(List<VnfResource> vlist) { + LOGGER.debug ("QueryServiceVnfs:"); + serviceVnfs = new ArrayList<VnfResource>(); + for (VnfResource o : vlist) { + LOGGER.debug ("-- o is a serviceVnfs ----"); + LOGGER.debug (o.toString()); + serviceVnfs.add(o); + LOGGER.debug ("-------------------"); + } + } + + public List<VnfResource> getServiceVnfs(){ return this.serviceVnfs; } + public void setServiceVnfs(List<VnfResource> v) { this.serviceVnfs = v; } + + @Override + public String toString () { + StringBuffer buf = new StringBuffer(); + + boolean first = true; + int i = 1; + for (VnfResource o : serviceVnfs) { + buf.append(i+"\t"); + if (!first) buf.append("\n"); first = false; + buf.append(o); + } + return buf.toString(); + } + + public String toJsonString() { + String jsonString = null; + try { + ObjectMapper mapper = new ObjectMapper(); + jsonString = mapper.writeValueAsString(this); + LOGGER.debug ("QuerySrviceVnfs jsonString: "+jsonString); + } + catch (Exception e) { + LOGGER.debug ("QuerySrviceVnfs jsonString exception:"+e.getMessage()); + } + return jsonString; + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java new file mode 100644 index 0000000000..03b8beae03 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.adapters.json; + +import org.codehaus.jackson.JsonNode; +import org.codehaus.jackson.JsonParser; +import org.codehaus.jackson.JsonProcessingException; +import org.codehaus.jackson.map.DeserializationContext; +import org.codehaus.jackson.map.JsonDeserializer; +import org.codehaus.jackson.map.ObjectMapper; + +import java.io.IOException; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * Custom JSON Deserializer for Map<String, String>. + * In MSO with Jackson 1.9.12 and RestEasy 3.0.8, maps in JSON are serialized as + * follows: + * <pre> + * "params": { + * "entry": [ + * {"key": "P1", "value": "V1"}, + * {"key": "P2", "value": "V2"}, + * ... + * {"key": "PN", "value": "VN"} + * ] + * } + * The implementation uses a LinkedHashMap to preserve the ordering of entries. + * </pre> + */ +public class MapDeserializer extends JsonDeserializer<Map<String, String>> { + @Override + public Map<String, String> deserialize(JsonParser parser, + DeserializationContext context) throws IOException, + JsonProcessingException { + ObjectMapper mapper = new ObjectMapper(); + JsonNode tree = mapper.readTree(parser); + + Map<String, String> map = new LinkedHashMap<String, String>(); + Iterator<JsonNode> iterator = tree.iterator(); + + while (iterator.hasNext()) { + JsonNode element = iterator.next(); + Iterator<JsonNode> arrayIterator = element.iterator(); + while (arrayIterator.hasNext()) { + JsonNode arrayElement = arrayIterator.next(); + String key = arrayElement.get("key").getTextValue(); + String value = arrayElement.get("value").getTextValue(); + map.put(key, value); + } + } + + return map; + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java new file mode 100644 index 0000000000..e3f55a0e69 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.adapters.json; + +import org.codehaus.jackson.JsonGenerationException; +import org.codehaus.jackson.JsonGenerator; +import org.codehaus.jackson.map.JsonSerializer; +import org.codehaus.jackson.map.SerializerProvider; + +import java.io.IOException; +import java.util.Map; + +/** + * Custom JSON Serializer for Map<String, String>. + * In MSO with Jackson 1.9.12 and RestEasy 3.0.8, maps in JSON are serialized as + * follows: + * <pre> + * "params": { + * "entry": [ + * {"key": "P1", "value": "V1"}, + * {"key": "P2", "value": "V2"}, + * ... + * {"key": "PN", "value": "VN"} + * ] + * } + * </pre> + * The implementation uses a TreeMap, so entries are always sorted according + * to the natural ordering of the keys. + */ +public class MapSerializer extends JsonSerializer<Map<String, String>> { + @Override + public void serialize(Map<String, String> map, JsonGenerator jsonGenerator, + SerializerProvider serializerProvider) throws IOException, + JsonGenerationException { + + jsonGenerator.writeStartObject(); + jsonGenerator.writeArrayFieldStart("entry"); + + for (String key : map.keySet()) { + String value = map.get(key); + jsonGenerator.writeStartObject(); + jsonGenerator.writeStringField("key", key); + jsonGenerator.writeStringField("value", value); + jsonGenerator.writeEndObject(); + } + + jsonGenerator.writeEndArray(); + jsonGenerator.writeEndObject(); + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/RequestInformation.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/RequestInformation.java new file mode 100644 index 0000000000..24a543c4f0 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/RequestInformation.java @@ -0,0 +1,87 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.adapters.sdncrest; + +import org.codehaus.jackson.annotate.JsonProperty; + +import javax.xml.bind.annotation.XmlElement; +import java.io.Serializable; + +/** + * Request Information specified by the SDNC "agnostic" API. + */ +public class RequestInformation implements Serializable { + private static final long serialVersionUID = 1L; + + // Identifies the transaction MSO has with the calling system. + private String requestId; + + // Identifies the calling system, e.g. CCD. + private String source; + + // The calling system's endpoint for receiving notifications from MSO. + private String notificationUrl; + + // NOTE: these are defined in the SDNC AID, but not used by MSO: + // request-action + // request-sub-action + + public RequestInformation(String requestId, String source, String notificationUrl) { + this.requestId = requestId; + this.source = source; + this.notificationUrl = notificationUrl; + } + + public RequestInformation() { + } + + @JsonProperty("requestId") + @XmlElement(name = "requestId") + public String getRequestId() { + return requestId; + } + + @JsonProperty("requestId") + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + @JsonProperty("source") + @XmlElement(name = "source") + public String getSource() { + return source; + } + + @JsonProperty("source") + public void setSource(String source) { + this.source = source; + } + + @JsonProperty("notificationUrl") + @XmlElement(name = "notificationUrl") + public String getNotificationUrl() { + return notificationUrl; + } + + @JsonProperty("notificationUrl") + public void setNotificationUrl(String notificationUrl) { + this.notificationUrl = notificationUrl; + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommon.java new file mode 100644 index 0000000000..20fc0498f4 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommon.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.adapters.sdncrest; + +import java.io.Serializable; + +/** + * Base class for all SDNC adapter error responses. + */ +public abstract class SDNCErrorCommon extends SDNCResponseCommon implements Serializable { + private static final long serialVersionUID = 1L; + + public SDNCErrorCommon(String sdncRequestId, String responseCode, + String responseMessage, String ackFinalIndicator) { + super(sdncRequestId, responseCode, responseMessage, ackFinalIndicator); + } + + public SDNCErrorCommon() { + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java new file mode 100644 index 0000000000..038aaa4bba --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java @@ -0,0 +1,151 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.adapters.sdncrest; + +import org.openecomp.mso.adapters.json.MapDeserializer; +import org.openecomp.mso.adapters.json.MapSerializer; +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.map.SerializationConfig; +import org.codehaus.jackson.map.annotate.JsonDeserialize; +import org.codehaus.jackson.map.annotate.JsonRootName; +import org.codehaus.jackson.map.annotate.JsonSerialize; +import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; +import org.jboss.resteasy.annotations.providers.NoJackson; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.IOException; +import java.io.Serializable; +import java.util.LinkedHashMap; +import java.util.Map; + +// NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, +// even though we are using JSON exclusively. The @NoJackson annotation +// is also required in this environment. + +/** + * SDNC adapter success response for "agnostic" API services. Note that the + * map of response parameters is represented this way in JSON: + * <pre> + * "params": { + * "entry": [ + * {"key": "P1", "value": "V1"}, + * {"key": "P2", "value": "V2"}, + * ... + * {"key": "PN", "value": "VN"} + * ] + * } + * </pre> + */ +@JsonRootName("SDNCEvent") +@JsonSerialize(include= Inclusion.NON_NULL) +@XmlRootElement(name = "SDNCEvent") +@NoJackson +public class SDNCEvent implements Serializable { + private static final long serialVersionUID = 1L; + + // Event type + private String eventType; + + // Event correlator type + private String eventCorrelatorType; + + // Event correlator value. + private String eventCorrelator; + + // Map of response parameters (possibly none). + private Map<String, String> params = null; + + public SDNCEvent(String eventType, String eventCorrelatorType, String eventCorrelator) { + this.eventType = eventType; + this.eventCorrelatorType = eventCorrelatorType; + this.eventCorrelator = eventCorrelator; + } + + public SDNCEvent() { + } + + @JsonProperty("eventType") + @XmlElement(name = "eventType") + public String getEventType() { + return eventType; + } + + @JsonProperty("eventType") + public void setEventType(String eventType) { + this.eventType = eventType; + } + + @JsonProperty("eventCorrelatorType") + @XmlElement(name = "eventCorrelatorType") + public String getEventCorrelatorType() { + return eventCorrelatorType; + } + + @JsonProperty("eventCorrelatorType") + public void setEventCorrelatorType(String eventCorrelatorType) { + this.eventCorrelatorType = eventCorrelatorType; + } + + @JsonProperty("eventCorrelator") + @XmlElement(name = "eventCorrelator") + public String getEventCorrelator() { + return eventCorrelator; + } + + @JsonProperty("eventCorrelator") + public void setEventCorrelator(String eventCorrelator) { + this.eventCorrelator = eventCorrelator; + } + + @JsonProperty("params") + @JsonDeserialize(using = MapDeserializer.class) + @XmlElement(name = "params") + public Map<String, String> getParams() { + return params; + } + + @JsonProperty("params") + @JsonSerialize(using = MapSerializer.class, include= Inclusion.NON_NULL) + public void setParams(Map<String, String> params) { + this.params = params; + } + + public void addParam(String name, String value) { + if (params == null) { + params = new LinkedHashMap<String, String>(); + } + params.put(name, value); + } + + public String toJson() { + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.setSerializationInclusion(Inclusion.NON_NULL); + return mapper.writeValueAsString(this); + } catch (IOException e) { + e.printStackTrace(); + throw new UnsupportedOperationException("Cannot convert " + + getClass().getSimpleName() + " to JSON", e); + } + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java new file mode 100644 index 0000000000..6232af6f79 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java @@ -0,0 +1,109 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.adapters.sdncrest; + +import org.codehaus.jackson.annotate.JsonIgnore; +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.map.SerializationConfig; +import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; + +import javax.xml.bind.annotation.XmlElement; +import java.io.IOException; +import java.io.Serializable; + +/** + * Base class for all SDNC adapter requests. + */ +public abstract class SDNCRequestCommon implements Serializable { + private static final long serialVersionUID = 1L; + + // Endpoint on which BPMN can receive notifications from the SDNC adapter. + private String bpNotificationUrl; + + // BPMN flow timeout value in ISO 8601 format, e.g. PT5M. + // Not currently used by the SDNC adapter. + private String bpTimeout; + + // Identifies the MSO transaction with SDNC. + // Maps to sdnc-request-header/requestId in the SDNC request. + private String sdncRequestId; + + public SDNCRequestCommon(String sdncRequestId, String bpNotificationUrl, + String bpTimeout) { + this.sdncRequestId = sdncRequestId; + this.bpNotificationUrl = bpNotificationUrl; + this.bpTimeout = bpTimeout; + } + + public SDNCRequestCommon() { + } + + @JsonProperty("bpNotificationUrl") + @XmlElement(name = "bpNotificationUrl") + public String getBPNotificationUrl() { + return bpNotificationUrl; + } + + @JsonProperty("bpNotificationUrl") + public void setBPNotificationUrl(String bpNotificationUrl) { + this.bpNotificationUrl = bpNotificationUrl; + } + + @JsonProperty("bpTimeout") + @XmlElement(name = "bpTimeout") + public String getBPTimeout() { + return bpTimeout; + } + + @JsonProperty("bpTimeout") + public void setBPTimeout(String bpTimeout) { + this.bpTimeout = bpTimeout; + } + + @JsonProperty("sdncRequestId") + @XmlElement(name = "sdncRequestId") + public String getSDNCRequestId() { + return sdncRequestId; + } + + @JsonProperty("sdncRequestId") + public void setSDNCRequestId(String sdncRequestId) { + this.sdncRequestId = sdncRequestId; + } + + @JsonIgnore + public boolean isSynchronous() { + return bpNotificationUrl == null || bpNotificationUrl.isEmpty(); + } + + public String toJson() { + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.setSerializationInclusion(Inclusion.NON_NULL); + return mapper.writeValueAsString(this); + } catch (IOException e) { + e.printStackTrace(); + throw new UnsupportedOperationException("Cannot convert " + + getClass().getSimpleName() + " to JSON", e); + } + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java new file mode 100644 index 0000000000..aa0be2702b --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java @@ -0,0 +1,117 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.adapters.sdncrest; + +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.map.SerializationConfig; +import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; + +import javax.xml.bind.annotation.XmlElement; +import java.io.IOException; +import java.io.Serializable; + +/** + * Base class for all SDNC adapter responses, including errors. + */ +public abstract class SDNCResponseCommon implements Serializable { + private static final long serialVersionUID = 1L; + + // Identifies the MSO transaction with SDNC. + private String sdncRequestId; + + // Response code, either from SDNC, or generated by the SDNC adapter. + // 2XX responses are considered success responses. + private String responseCode; + + // Response message, either from SDNC, or generated by the SDNC adapter. + private String responseMessage; + + // Indicates if the response is final (Y or N). + private String ackFinalIndicator; + + public SDNCResponseCommon(String sdncRequestId, String responseCode, + String responseMessage, String ackFinalIndicator) { + this.sdncRequestId = sdncRequestId; + this.responseCode = responseCode; + this.responseMessage = responseMessage; + this.ackFinalIndicator = ackFinalIndicator; + } + + public SDNCResponseCommon() { + } + + @JsonProperty("sdncRequestId") + @XmlElement(name = "sdncRequestId") + public String getSDNCRequestId() { + return sdncRequestId; + } + + @JsonProperty("sdncRequestId") + public void setSDNCRequestId(String sdncRequestId) { + this.sdncRequestId = sdncRequestId; + } + + @JsonProperty("responseCode") + @XmlElement(name = "responseCode") + public String getResponseCode() { + return responseCode; + } + + @JsonProperty("responseCode") + public void setResponseCode(String responseCode) { + this.responseCode = responseCode; + } + + @JsonProperty("responseMessage") + @XmlElement(name = "responseMessage") + public String getResponseMessage() { + return responseMessage; + } + + @JsonProperty("responseMessage") + public void setResponseMessage(String responseMessage) { + this.responseMessage = responseMessage; + } + + @JsonProperty("ackFinalIndicator") + @XmlElement(name = "ackFinalIndicator") + public String getAckFinalIndicator() { + return ackFinalIndicator; + } + + @JsonProperty("ackFinalIndicator") + public void setAckFinalIndicator(String ackFinalIndicator) { + this.ackFinalIndicator = ackFinalIndicator; + } + + public String toJson() { + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.setSerializationInclusion(Inclusion.NON_NULL); + return mapper.writeValueAsString(this); + } catch (IOException e) { + e.printStackTrace(); + throw new UnsupportedOperationException("Cannot convert " + + getClass().getSimpleName() + " to JSON", e); + } + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceError.java new file mode 100644 index 0000000000..a789316754 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceError.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.adapters.sdncrest; + +import org.codehaus.jackson.map.annotate.JsonRootName; +import org.codehaus.jackson.map.annotate.JsonSerialize; +import org.jboss.resteasy.annotations.providers.NoJackson; + +import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; + +// NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, +// even though we are using JSON exclusively. The @NoJackson annotation +// is also required in this environment. + +/** + * SDNC adapter error response for "agnostic" API services. + */ +@JsonRootName("SDNCServiceError") +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@XmlRootElement(name = "SDNCServiceError") +@NoJackson +public class SDNCServiceError extends SDNCErrorCommon implements Serializable { + private static final long serialVersionUID = 1; + + public SDNCServiceError(String sdncRequestId, String responseCode, + String responseMessage, String ackFinalIndicator) { + super(sdncRequestId, responseCode, responseMessage, ackFinalIndicator); + } + + public SDNCServiceError() { + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequest.java new file mode 100644 index 0000000000..814b603783 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequest.java @@ -0,0 +1,146 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.adapters.sdncrest; + +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.annotate.JsonRootName; +import org.codehaus.jackson.map.annotate.JsonSerialize; +import org.jboss.resteasy.annotations.providers.NoJackson; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; + +// NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, +// even though we are using JSON exclusively. The @NoJackson annotation +// is also required in this environment. + +/** + * SDNC adapter request for "agnostic" API services. + * The target action is determined by a service type and an operation. + */ +@JsonRootName("SDNCServiceRequest") +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@XmlRootElement(name = "SDNCServiceRequest") +@NoJackson +public class SDNCServiceRequest extends SDNCRequestCommon implements Serializable { + private static final long serialVersionUID = 1L; + + // Request Information specified by SDNC "agnostic" API + private RequestInformation requestInformation; + + // Service Information specified by: SDNC "agnostic" API + private ServiceInformation serviceInformation; + + // The SDNC service type specified by SDNC "agnostic" API + private String sdncService; + + // The SDNC operation specified by SDNC "agnostic" API + private String sdncOperation; + + // The SDNC service data type specified by SDNC "agnostic" API + private String sdncServiceDataType; + + // The SDNC service data specified by SDNC "agnostic" API + private String sndcServiceData; + + public SDNCServiceRequest() { + } + + public SDNCServiceRequest(String bpNotificationUrl, String bpTimeout, + String sdncRequestId, String sdncService, String sdncOperation, + RequestInformation requestInformation, + ServiceInformation serviceInformation, String sdncServiceDataType, + String sndcServiceData) { + super(bpNotificationUrl, bpTimeout, sdncRequestId); + this.requestInformation = requestInformation; + this.serviceInformation = serviceInformation; + this.sdncService = sdncService; + this.sdncOperation = sdncOperation; + this.sdncServiceDataType = sdncServiceDataType; + this.sndcServiceData = sndcServiceData; + } + + @JsonProperty("requestInformation") + @XmlElement(name = "requestInformation") + public RequestInformation getRequestInformation() { + return requestInformation; + } + + @JsonProperty("requestInformation") + public void setRequestInformation(RequestInformation requestInformation) { + this.requestInformation = requestInformation; + } + + @JsonProperty("serviceInformation") + @XmlElement(name = "serviceInformation") + public ServiceInformation getServiceInformation() { + return serviceInformation; + } + + @JsonProperty("serviceInformation") + public void setServiceInformation(ServiceInformation serviceInformation) { + this.serviceInformation = serviceInformation; + } + + @JsonProperty("sdncService") + @XmlElement(name = "sdncService") + public String getSDNCService() { + return sdncService; + } + + @JsonProperty("sdncService") + public void setSDNCService(String sdncService) { + this.sdncService = sdncService; + } + + @JsonProperty("sdncOperation") + @XmlElement(name = "sdncOperation") + public String getSDNCOperation() { + return sdncOperation; + } + + @JsonProperty("sdncOperation") + public void setSDNCOperation(String sdncOperation) { + this.sdncOperation = sdncOperation; + } + + @JsonProperty("sdncServiceDataType") + @XmlElement(name = "sdncServiceDataType") + public String getSDNCServiceDataType() { + return sdncServiceDataType; + } + + @JsonProperty("sdncServiceDataType") + public void setSDNCServiceDataType(String sdncServiceDataType) { + this.sdncServiceDataType = sdncServiceDataType; + } + + @JsonProperty("sdncServiceData") + @XmlElement(name = "sdncServiceData") + public String getSDNCServiceData() { + return sndcServiceData; + } + + @JsonProperty("sdncServiceData") + public void setSDNCServiceData(String sndcServiceData) { + this.sndcServiceData = sndcServiceData; + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java new file mode 100644 index 0000000000..2ab6ed5a8a --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.adapters.sdncrest; + +import org.openecomp.mso.adapters.json.MapDeserializer; +import org.openecomp.mso.adapters.json.MapSerializer; +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.annotate.JsonDeserialize; +import org.codehaus.jackson.map.annotate.JsonRootName; +import org.codehaus.jackson.map.annotate.JsonSerialize; +import org.jboss.resteasy.annotations.providers.NoJackson; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; +import java.util.LinkedHashMap; +import java.util.Map; + +// NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, +// even though we are using JSON exclusively. The @NoJackson annotation +// is also required in this environment. + +/** + * SDNC adapter success response for "agnostic" API services. Note that the + * map of response parameters is represented this way in JSON: + * <pre> + * "params": { + * "entry": [ + * {"key": "P1", "value": "V1"}, + * {"key": "P2", "value": "V2"}, + * ... + * {"key": "PN", "value": "VN"} + * ] + * } + * </pre> + */ +@JsonRootName("SDNCServiceResponse") +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@XmlRootElement(name = "SDNCServiceResponse") +@NoJackson +public class SDNCServiceResponse extends SDNCResponseCommon implements Serializable { + private static final long serialVersionUID = 1L; + + // Map of response parameters (possibly none). + private Map<String, String> params = null; + + public SDNCServiceResponse(String sdncRequestId, String responseCode, + String responseMessage, String ackFinalIndicator) { + super(sdncRequestId, responseCode, responseMessage, ackFinalIndicator); + } + + public SDNCServiceResponse() { + } + + @JsonProperty("params") + @JsonDeserialize(using = MapDeserializer.class) + @XmlElement(name = "params") + public Map<String, String> getParams() { + return params; + } + + @JsonProperty("params") + @JsonSerialize(using = MapSerializer.class, include=JsonSerialize.Inclusion.NON_NULL) + public void setParams(Map<String, String> params) { + this.params = params; + } + + public void addParam(String name, String value) { + if (params == null) { + params = new LinkedHashMap<String, String>(); + } + params.put(name, value); + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/ServiceInformation.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/ServiceInformation.java new file mode 100644 index 0000000000..628ef9c071 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/ServiceInformation.java @@ -0,0 +1,102 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.adapters.sdncrest; + +import org.codehaus.jackson.annotate.JsonProperty; + +import javax.xml.bind.annotation.XmlElement; +import java.io.Serializable; + +/** + * Service Information specified by the SDNC "agnostic" API. + */ +public class ServiceInformation implements Serializable { + private static final long serialVersionUID = 1L; + + // The subscription's service type for the target service instance. + private String serviceType; + + // Identifies the target service instance for this particular SDNC request. + // NOTE: this could be a child of the parent model instance, i.e. this + // service instance ID may be different from the service instance ID + // associated with the transaction MSO has with the system that invoked it. + private String serviceInstanceId; + + // The subscriber name. + private String subscriberName; + + // The subscriber global ID (customer ID). + private String subscriberGlobalId; + + public ServiceInformation(String serviceType, String serviceInstanceId, + String subscriberName, String subscriberGlobalId) { + this.serviceType = serviceType; + this.serviceInstanceId = serviceInstanceId; + this.subscriberName = subscriberName; + this.subscriberGlobalId = subscriberGlobalId; + } + + public ServiceInformation() { + } + + @JsonProperty("serviceType") + @XmlElement(name = "serviceType") + public String getServiceType() { + return serviceType; + } + + @JsonProperty("serviceType") + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + @JsonProperty("serviceInstanceId") + @XmlElement(name = "serviceInstanceId") + public String getServiceInstanceId() { + return serviceInstanceId; + } + + @JsonProperty("serviceInstanceId") + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + @JsonProperty("subscriberName") + @XmlElement(name = "subscriberName") + public String getSubscriberName() { + return subscriberName; + } + + @JsonProperty("subscriberName") + public void setSubscriberName(String subscriberName) { + this.subscriberName = subscriberName; + } + + @JsonProperty("subscriberGlobalId") + @XmlElement(name = "subscriberGlobalId") + public String getSubscriberGlobalId() { + return subscriberGlobalId; + } + + @JsonProperty("subscriberGlobalId") + public void setSubscriberGlobalId(String subscriberGlobalId) { + this.subscriberGlobalId = subscriberGlobalId; + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java index f337c4c9de..bcee2ffd8a 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -66,6 +66,7 @@ public class CreateVfModuleRequest extends VfRequestCommon { private String volumeGroupStackId; private String baseVfModuleId; private String baseVfModuleStackId; + private String modelCustomizationUuid; private String requestType; private Boolean failIfExists; @@ -170,6 +171,14 @@ public class CreateVfModuleRequest extends VfRequestCommon { this.baseVfModuleStackId = baseVfModuleStackId; } + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public String getRequestType() { return requestType; } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java index b93a26031f..840edf7fbc 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -42,6 +42,7 @@ public class CreateVolumeGroupRequest extends VfRequestCommon { private String vnfType; private String vnfVersion; private String vfModuleType; + private String modelCustomizationUuid; private Map<String,String> volumeGroupParams = new HashMap<String, String>(); private Boolean failIfExists; private Boolean suppressBackout; @@ -111,6 +112,14 @@ public class CreateVolumeGroupRequest extends VfRequestCommon { return volumeGroupId; } + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public void setVolumeGroupId(String volumeGroupId) { this.volumeGroupId = volumeGroupId; } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java index a3d00a95cd..8f719c88c8 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,6 +25,9 @@ import javax.xml.bind.annotation.XmlRootElement; import org.jboss.resteasy.annotations.providers.NoJackson; import org.codehaus.jackson.map.annotate.JsonRootName; +import java.util.HashMap; +import java.util.Map; + @JsonRootName("deleteVfModuleResponse") @XmlRootElement(name = "deleteVfModuleResponse") @NoJackson @@ -32,16 +35,17 @@ public class DeleteVfModuleResponse extends VfResponseCommon { private String vnfId; private String vfModuleId; private Boolean vfModuleDeleted; - + private Map<String,String> vfModuleOutputs = new HashMap<String, String>(); public DeleteVfModuleResponse() { super(); } - public DeleteVfModuleResponse(String vnfId, String vfModuleId, Boolean vfModuleDeleted, String messageId) { + public DeleteVfModuleResponse(String vnfId, String vfModuleId, Boolean vfModuleDeleted, String messageId, Map<String,String> outputs) { super(messageId); this.vnfId = vnfId; this.vfModuleId = vfModuleId; this.vfModuleDeleted = vfModuleDeleted; + this.vfModuleOutputs = outputs; } public String getVnfId() { @@ -67,4 +71,11 @@ public class DeleteVfModuleResponse extends VfResponseCommon { public void setVfModuleDeleted(Boolean vfModuleDeleted) { this.vfModuleDeleted = vfModuleDeleted; } + public Map<String, String> getVfModuleOutputs() { + return vfModuleOutputs; + } + + public void setVfModuleOutputs(Map<String, String> vfModuleOutputs) { + this.vfModuleOutputs = vfModuleOutputs; + } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java index a234e749ba..6c11232bfa 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -52,6 +52,8 @@ public class UpdateVfModuleRequest extends VfRequestCommon { private String baseVfModuleId; private String baseVfModuleStackId; + private String modelCustomizationUuid; + private String requestType; private Boolean failIfExists; private Boolean backout; @@ -151,6 +153,14 @@ public class UpdateVfModuleRequest extends VfRequestCommon { return baseVfModuleId; } + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public void setBaseVfModuleId(String baseVfModuleId) { this.baseVfModuleId = baseVfModuleId; } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java index 50c60b30d6..596021e5e8 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -42,6 +42,7 @@ public class UpdateVolumeGroupRequest extends VfRequestCommon { private String vnfType; private String vnfVersion; private String vfModuleType; + private String modelCustomizationUuid; private Map<String,String> volumeGroupParams = new HashMap<String, String>(); private MsoRequest msoRequest = new MsoRequest(); @@ -105,6 +106,14 @@ public class UpdateVolumeGroupRequest extends VfRequestCommon { this.vfModuleType = vfModuleType; } + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public Map<String, String> getVolumeGroupParams() { return volumeGroupParams; } |