2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.common.recipe;
25 import com.fasterxml.jackson.annotation.JsonProperty;
26 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
27 import com.fasterxml.jackson.annotation.JsonRootName;
28 import com.fasterxml.jackson.core.JsonProcessingException;
29 import com.fasterxml.jackson.databind.ObjectMapper;
30 import com.fasterxml.jackson.databind.SerializationFeature;
31 import org.slf4j.Logger;
32 import org.slf4j.LoggerFactory;
35 * java object of the resource recipe , it
36 * will be passed to the Camunda process
38 @JsonPropertyOrder({"resourceInput", "host", "requestId", "requestAction", "serviceInstanceId", "serviceType", "recipeParams"})
39 @JsonRootName("variables")
40 public class ResourceRecipeRequest {
42 private static Logger logger = LoggerFactory.getLogger(ResourceRecipeRequest.class);
44 @JsonProperty("resourceInput")
45 private BpmnParam resourceInput;
48 private BpmnParam host;
50 @JsonProperty("mso-request-id")
51 private BpmnParam requestId;
53 @JsonProperty("requestAction")
54 private BpmnParam requestAction;
56 @JsonProperty("serviceInstanceId")
57 private BpmnParam serviceInstanceId;
59 @JsonProperty("serviceType")
60 private BpmnParam serviceType;
62 @JsonProperty("recipeParams")
63 private BpmnParam recipeParams;
65 @JsonProperty("mso-service-request-timeout")
66 private BpmnIntegerParam recipeTimeout;
68 @JsonProperty("resourceInput")
69 public BpmnParam getResourceInput() {
73 @JsonProperty("resourceInput")
74 public void setResourceInput(BpmnParam resourceInput) {
75 this.resourceInput = resourceInput;
79 public BpmnParam getHost() {
84 public void setHost(BpmnParam host) {
88 @JsonProperty("mso-request-id")
89 public BpmnParam getRequestId() {
93 @JsonProperty("mso-request-id")
94 public void setRequestId(BpmnParam requestId) {
95 this.requestId = requestId;
98 @JsonProperty("requestAction")
99 public BpmnParam getRequestAction() {
100 return requestAction;
103 @JsonProperty("requestAction")
104 public void setRequestAction(BpmnParam requestAction) {
105 this.requestAction = requestAction;
108 @JsonProperty("serviceInstanceId")
109 public BpmnParam getServiceInstanceId() {
110 return serviceInstanceId;
113 @JsonProperty("serviceInstanceId")
114 public void setServiceInstanceId(BpmnParam serviceInstanceId) {
115 this.serviceInstanceId = serviceInstanceId;
118 @JsonProperty("serviceType")
119 public BpmnParam getServiceType() {
123 @JsonProperty("serviceType")
124 public void setServiceType(BpmnParam serviceType) {
125 this.serviceType = serviceType;
128 @JsonProperty("recipeParams")
129 public BpmnParam getRecipeParams() {
133 @JsonProperty("recipeParams")
134 public void setRecipeParams(BpmnParam recipeParams) {
135 this.recipeParams = recipeParams;
138 @JsonProperty("mso-service-request-timeout")
139 public BpmnIntegerParam getRecipeTimeout() {
140 return recipeTimeout;
143 @JsonProperty("mso-service-request-timeout")
144 public void setRecipeTimeout(BpmnIntegerParam recipeTimeout) {
145 this.recipeTimeout = recipeTimeout;
149 public String toString() {
150 ObjectMapper mapper = new ObjectMapper();
151 mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
152 String jsonStr = "ResourceRecipeRequest";
154 jsonStr = mapper.writeValueAsString(this);
155 } catch (JsonProcessingException e) {
156 logger.error("JsonProcessingException", e);