2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.bpmn.servicedecomposition.generalobjects;
23 import java.io.Serializable;
24 import java.util.ArrayList;
25 import java.util.List;
28 import org.onap.so.logger.MsoLogger;
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;
37 @JsonRootName(value = "requestParameters")
38 @JsonInclude(Include.NON_DEFAULT)
39 public class RequestParameters implements Serializable {
41 private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, RequestParameters.class);
43 private static final long serialVersionUID = -5979049912538894930L;
44 @JsonProperty("subscriptionServiceType")
45 private String subscriptionServiceType;
46 @JsonProperty("userParams")
47 private List<Map<String, Object>> userParams = new ArrayList<>();
48 @JsonProperty("aLaCarte")
49 private Boolean aLaCarte;
52 public String getSubscriptionServiceType() {
53 return subscriptionServiceType;
56 public void setSubscriptionServiceType(String subscriptionServiceType) {
57 this.subscriptionServiceType = subscriptionServiceType;
59 @JsonProperty("aLaCarte")
60 public Boolean getALaCarte() {
63 @JsonProperty("aLaCarte")
64 public void setaLaCarte(Boolean aLaCarte) {
65 this.aLaCarte = aLaCarte;
68 public Boolean isaLaCarte() {
72 public List<Map<String, Object>> getUserParams() {
76 public void setUserParams(List<Map<String, Object>> userParams) {
77 this.userParams = userParams;
80 public Object getUserParamValue(String name) {
81 if (userParams != null) {
82 for (Map<String, Object> param : userParams) {
83 if (param.get(name) != null) {
84 return param.get(name);
92 @JsonInclude(Include.NON_NULL)
93 public String toJsonString(){
95 ObjectMapper mapper = new ObjectMapper();
96 mapper.setSerializationInclusion(Include.NON_NULL);
97 ObjectWriter ow = mapper.writer();
99 json = ow.writeValueAsString(this);
100 }catch (Exception e){
101 log.error("Unable to convert Sniro Manager Request to string", e);
107 public String toString() {
108 return "RequestParameters [subscriptionServiceType="
109 + subscriptionServiceType + ", userParams=" + userParams
110 + ", aLaCarte=" + aLaCarte + "]";