2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright (c) 2019 Samsung
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.so.bpmn.servicedecomposition.generalobjects;
25 import java.io.Serializable;
26 import java.util.ArrayList;
27 import java.util.List;
29 import com.fasterxml.jackson.annotation.JsonInclude;
30 import com.fasterxml.jackson.annotation.JsonInclude.Include;
31 import com.fasterxml.jackson.databind.ObjectMapper;
32 import com.fasterxml.jackson.databind.ObjectWriter;
33 import com.fasterxml.jackson.annotation.JsonProperty;
34 import com.fasterxml.jackson.annotation.JsonRootName;
35 import org.slf4j.Logger;
36 import org.slf4j.LoggerFactory;
38 @JsonRootName(value = "requestParameters")
39 @JsonInclude(Include.NON_DEFAULT)
40 public class RequestParameters implements Serializable {
42 private static final Logger logger = LoggerFactory.getLogger(RequestParameters.class);
44 private static final long serialVersionUID = -5979049912538894930L;
45 @JsonProperty("subscriptionServiceType")
46 private String subscriptionServiceType;
47 @JsonProperty("userParams")
48 private List<Map<String, Object>> userParams = new ArrayList<>();
49 @JsonProperty("aLaCarte")
50 private Boolean aLaCarte;
51 @JsonProperty("payload")
52 private String payload;
53 @JsonProperty("usePreload")
54 private Boolean usePreload;
56 public String getSubscriptionServiceType() {
57 return subscriptionServiceType;
60 public void setSubscriptionServiceType(String subscriptionServiceType) {
61 this.subscriptionServiceType = subscriptionServiceType;
64 @JsonProperty("aLaCarte")
65 public Boolean getALaCarte() {
69 @JsonProperty("aLaCarte")
70 public void setaLaCarte(Boolean aLaCarte) {
71 this.aLaCarte = aLaCarte;
74 public Boolean isaLaCarte() {
78 public String getPayload() {
82 public void setPayload(String value) {
86 public List<Map<String, Object>> getUserParams() {
90 public void setUserParams(List<Map<String, Object>> userParams) {
91 this.userParams = userParams;
94 public Object getUserParamValue(String name) {
95 if (userParams != null) {
96 for (Map<String, Object> param : userParams) {
97 if (param.get(name) != null) {
98 return param.get(name);
105 public Boolean isUsePreload() {
109 @JsonProperty("usePreload")
110 public Boolean getUsePreload() {
114 @JsonProperty("usePreload")
115 public void setUsePreload(Boolean usePreload) {
116 this.usePreload = usePreload;
120 @JsonInclude(Include.NON_NULL)
121 public String toJsonString() {
123 ObjectMapper mapper = new ObjectMapper();
124 mapper.setSerializationInclusion(Include.NON_NULL);
125 ObjectWriter ow = mapper.writer();
127 json = ow.writeValueAsString(this);
128 } catch (Exception e) {
129 logger.error("Unable to convert Sniro Manager Request to string", e);
135 public String toString() {
136 return "RequestParameters [subscriptionServiceType=" + subscriptionServiceType + ", userParams=" + userParams
137 + ", aLaCarte=" + aLaCarte + "]";