2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.openecomp.mso.bpmn.common.recipe;
23 import org.openecomp.mso.logger.MsoLogger;
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;
33 * java object of the resource recipe , it
34 * will be passed to the Camunda process
36 @JsonPropertyOrder({"resourceInput", "host", "requestId", "requestAction", "serviceInstanceId", "serviceType", "recipeParams"})
37 @JsonRootName("variables")
38 public class ResourceRecipeRequest {
40 private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
42 @JsonProperty("resourceInput")
43 private BpmnParam resourceInput;
46 private BpmnParam host;
48 @JsonProperty("mso-request-id")
49 private BpmnParam requestId;
51 @JsonProperty("requestAction")
52 private BpmnParam requestAction;
54 @JsonProperty("serviceInstanceId")
55 private BpmnParam serviceInstanceId;
57 @JsonProperty("serviceType")
58 private BpmnParam serviceType;
60 @JsonProperty("recipeParams")
61 private BpmnParam recipeParams;
63 @JsonProperty("mso-service-request-timeout")
64 private BpmnParam recipeTimeout;
66 @JsonProperty("resourceInput")
67 public BpmnParam getResourceInput() {
71 @JsonProperty("resourceInput")
72 public void setResourceInput(BpmnParam resourceInput) {
73 this.resourceInput = resourceInput;
77 public BpmnParam getHost() {
82 public void setHost(BpmnParam host) {
86 @JsonProperty("mso-request-id")
87 public BpmnParam getRequestId() {
91 @JsonProperty("mso-request-id")
92 public void setRequestId(BpmnParam requestId) {
93 this.requestId = requestId;
96 @JsonProperty("requestAction")
97 public BpmnParam getRequestAction() {
101 @JsonProperty("requestAction")
102 public void setRequestAction(BpmnParam requestAction) {
103 this.requestAction = requestAction;
106 @JsonProperty("serviceInstanceId")
107 public BpmnParam getServiceInstanceId() {
108 return serviceInstanceId;
111 @JsonProperty("serviceInstanceId")
112 public void setServiceInstanceId(BpmnParam serviceInstanceId) {
113 this.serviceInstanceId = serviceInstanceId;
116 @JsonProperty("serviceType")
117 public BpmnParam getServiceType() {
121 @JsonProperty("serviceType")
122 public void setServiceType(BpmnParam serviceType) {
123 this.serviceType = serviceType;
126 @JsonProperty("recipeParams")
127 public BpmnParam getRecipeParams() {
131 @JsonProperty("recipeParams")
132 public void setRecipeParams(BpmnParam recipeParams) {
133 this.recipeParams = recipeParams;
136 @JsonProperty("mso-service-request-timeout")
137 public BpmnParam getRecipeTimeout() {
138 return recipeTimeout;
141 @JsonProperty("mso-service-request-timeout")
142 public void setRecipeTimeout(BpmnParam recipeTimeout) {
143 this.recipeTimeout = recipeTimeout;
147 public String toString() {
148 ObjectMapper mapper = new ObjectMapper();
149 mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
150 String jsonStr = "ResourceRecipeRequest";
152 jsonStr = mapper.writeValueAsString(this);
153 } catch(JsonProcessingException e) {
154 msoLogger.error("JsonProcessingException", e);