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;
30 import com.fasterxml.jackson.annotation.JsonInclude;
31 import com.fasterxml.jackson.annotation.JsonInclude.Include;
32 import com.fasterxml.jackson.databind.ObjectMapper;
33 import com.fasterxml.jackson.databind.ObjectWriter;
34 import com.fasterxml.jackson.annotation.JsonProperty;
35 import com.fasterxml.jackson.annotation.JsonRootName;
36 import org.slf4j.Logger;
37 import org.slf4j.LoggerFactory;
39 @JsonRootName(value = "requestParameters")
40 @JsonInclude(Include.NON_DEFAULT)
41 public class RequestParameters implements Serializable {
43 private static final Logger logger = LoggerFactory.getLogger(RequestParameters.class);
45 private static final long serialVersionUID = -5979049912538894930L;
46 @JsonProperty("subscriptionServiceType")
47 private String subscriptionServiceType;
48 @JsonProperty("userParams")
49 private List<Map<String, Object>> userParams = new ArrayList<>();
50 @JsonProperty("aLaCarte")
51 private Boolean aLaCarte;
52 @JsonProperty("payload")
53 private String payload;
54 @JsonProperty("usePreload")
55 private Boolean usePreload;
57 public String getSubscriptionServiceType() {
58 return subscriptionServiceType;
61 public void setSubscriptionServiceType(String subscriptionServiceType) {
62 this.subscriptionServiceType = subscriptionServiceType;
64 @JsonProperty("aLaCarte")
65 public Boolean getALaCarte() {
68 @JsonProperty("aLaCarte")
69 public void setaLaCarte(Boolean aLaCarte) {
70 this.aLaCarte = aLaCarte;
73 public Boolean isaLaCarte() {
77 public String getPayload(){
80 public void setPayload(String value){
84 public List<Map<String, Object>> getUserParams() {
88 public void setUserParams(List<Map<String, Object>> userParams) {
89 this.userParams = userParams;
92 public Object getUserParamValue(String name) {
93 if (userParams != null) {
94 for (Map<String, Object> param : userParams) {
95 if (param.get(name) != null) {
96 return param.get(name);
103 public Boolean isUsePreload() {
107 @JsonProperty("usePreload")
108 public Boolean getUsePreload() {
112 @JsonProperty("usePreload")
113 public void setUsePreload(Boolean usePreload) {
114 this.usePreload = usePreload;
118 @JsonInclude(Include.NON_NULL)
119 public String toJsonString(){
121 ObjectMapper mapper = new ObjectMapper();
122 mapper.setSerializationInclusion(Include.NON_NULL);
123 ObjectWriter ow = mapper.writer();
125 json = ow.writeValueAsString(this);
126 }catch (Exception e){
127 logger.error("Unable to convert Sniro Manager Request to string", e);
133 public String toString() {
134 return "RequestParameters [subscriptionServiceType="
135 + subscriptionServiceType + ", userParams=" + userParams
136 + ", aLaCarte=" + aLaCarte + "]";