2 * Copyright (c) 2017 ZTE Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the Apache License, Version 2.0
5 * and the Eclipse Public License v1.0 which both accompany this distribution,
6 * and are available at http://www.eclipse.org/legal/epl-v10.html
7 * and http://www.apache.org/licenses/LICENSE-2.0
10 * ZTE - initial API and implementation and/or initial documentation
12 package org.onap.sdc.workflowdesigner.model;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
17 import com.fasterxml.jackson.annotation.JsonInclude;
18 import com.fasterxml.jackson.annotation.JsonInclude.Include;
19 import com.fasterxml.jackson.core.JsonProcessingException;
20 import com.fasterxml.jackson.databind.ObjectMapper;
22 public class Parameter {
23 private static Logger log = LoggerFactory.getLogger(Parameter.class);
24 private String description = "";
26 private String position;
27 private boolean required;
30 // body parameter may be a json object
33 @JsonInclude(Include.NON_NULL)
34 private String valueSource;
36 public String getDescription() {
40 public void setDescription(String description) {
41 this.description = description;
44 public String getName() {
48 public void setName(String name) {
52 public String getPosition() {
56 public void setPosition(String position) {
57 this.position = position;
60 public boolean isRequired() {
64 public void setRequired(boolean required) {
65 this.required = required;
68 public String getType() {
72 public void setType(String type) {
76 public Object getValue() {
80 public void setValue(Object value) {
84 public String getValueSource() {
88 public void setValueSource(String valueSource) {
89 this.valueSource = valueSource;
92 public String toString() {
93 ObjectMapper mapper = new ObjectMapper();
96 result = mapper.writeValueAsString(this);
97 } catch (JsonProcessingException e) {
98 log.error("fail to convert parameter to json string", e);