1 /* Copyright (c) 2019 AT&T Intellectual Property. #
\r
3 # Licensed under the Apache License, Version 2.0 (the "License"); #
\r
4 # you may not use this file except in compliance with the License. #
\r
5 # You may obtain a copy of the License at #
\r
7 # http://www.apache.org/licenses/LICENSE-2.0 #
\r
9 # Unless required by applicable law or agreed to in writing, software #
\r
10 # distributed under the License is distributed on an "AS IS" BASIS, #
\r
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
\r
12 # See the License for the specific language governing permissions and #
\r
13 # limitations under the License. #
\r
14 ##############################################################################*/
\r
17 package org.oran.otf.common.model.local;
\r
19 import org.oran.otf.common.utility.gson.Convert;
\r
20 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
\r
21 import java.io.Serializable;
\r
22 import java.util.Map;
\r
23 import org.bson.types.ObjectId;
\r
25 @JsonIgnoreProperties(ignoreUnknown = true)
\r
26 public class WorkflowRequest implements Serializable {
\r
28 private static final long serialVersionUID = 1L;
\r
30 private boolean async = false;
\r
31 private ObjectId executorId = null;
\r
32 private ObjectId testInstanceId = null;
\r
33 private Map<String, ParallelFlowInput> pfloInput = null;
\r
34 private Map<String, Object> testData = null;
\r
35 private Map<String, Object> vthInput = null;
\r
36 private long maxExecutionTimeInMillis = 0L;
\r
38 public WorkflowRequest() throws Exception {
\r
42 public WorkflowRequest(
\r
44 ObjectId executorId,
\r
45 ObjectId testInstanceId,
\r
46 Map<String, ParallelFlowInput> pfloInput,
\r
47 Map<String, Object> testData,
\r
48 Map<String, Object> vthInput,
\r
49 int maxExecutionTimeInMillis)
\r
52 this.executorId = executorId;
\r
53 this.testInstanceId = testInstanceId;
\r
54 this.pfloInput = pfloInput;
\r
55 this.testData = testData;
\r
56 this.vthInput = vthInput;
\r
57 this.maxExecutionTimeInMillis = maxExecutionTimeInMillis;
\r
62 public WorkflowRequest(
\r
65 String testInstanceId,
\r
66 Map<String, ParallelFlowInput> pfloInput,
\r
67 Map<String, Object> testData,
\r
68 Map<String, Object> vthInput,
\r
69 int maxExecutionTimeInMillis)
\r
72 this.executorId = new ObjectId(executorId);
\r
73 this.testInstanceId = new ObjectId(testInstanceId);
\r
74 this.pfloInput = pfloInput;
\r
75 this.testData = testData;
\r
76 this.vthInput = vthInput;
\r
77 this.maxExecutionTimeInMillis = maxExecutionTimeInMillis;
\r
82 private void validate() throws Exception {
\r
83 String missingFieldFormat = "Missing required field %s.";
\r
84 // if (this.async && this.asyncTopic == null) {
\r
85 // throw new Exception(String.format(missingFieldFormat, "asyncTopic"));
\r
88 // Only required on the Camunda engine
\r
89 // if (this.executorId == null) {
\r
90 // throw new Exception(String.format(missingFieldFormat, "executorId"));
\r
93 // Only required on the Camunda engine
\r
94 // if (this.testInstanceId == null) {
\r
95 // throw new Exception(String.format(missingFieldFormat, "testInstanceId"));
\r
98 if (this.maxExecutionTimeInMillis < 0L) {
\r
99 this.maxExecutionTimeInMillis = 0L;
\r
103 public boolean isAsync() {
\r
107 public void setAsync(boolean async) {
\r
108 this.async = async;
\r
111 public ObjectId getExecutorId() {
\r
115 public void setExecutorId(ObjectId executorId) {
\r
116 this.executorId = executorId;
\r
119 public ObjectId getTestInstanceId() {
\r
120 return testInstanceId;
\r
123 public void setTestInstanceId(ObjectId testInstanceId) {
\r
124 this.testInstanceId = testInstanceId;
\r
127 public Map<String, ParallelFlowInput> getPfloInput() {
\r
131 public void setPfloInput(Map<String, ParallelFlowInput> pfloInput) {
\r
132 this.pfloInput = pfloInput;
\r
135 public Map<String, Object> getTestData() {
\r
139 public void setTestData(Map<String, Object> testData) {
\r
140 this.testData = testData;
\r
143 public Map<String, Object> getVthInput() {
\r
147 public void setVthInput(Map<String, Object> vthInput) {
\r
148 this.vthInput = vthInput;
\r
151 public long getMaxExecutionTimeInMillis() {
\r
152 return maxExecutionTimeInMillis;
\r
155 public void setMaxExecutionTimeInMillis(long maxExecutionTimeInMillis) {
\r
156 this.maxExecutionTimeInMillis = maxExecutionTimeInMillis;
\r
160 public String toString() {
\r
161 return Convert.objectToJson(this);
\r