/* * Copyright 2011-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.stepfunctions.builder.states; import static com.amazonaws.services.stepfunctions.builder.internal.JacksonUtils.jsonToString; import static com.amazonaws.services.stepfunctions.builder.internal.JacksonUtils.objectToJsonNode; import static com.amazonaws.services.stepfunctions.builder.internal.JacksonUtils.stringToJsonNode; import com.amazonaws.services.stepfunctions.builder.internal.PropertyNames; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonUnwrapped; import com.fasterxml.jackson.databind.JsonNode; /** * The Pass State simply passes its input to its output, performing no work. Pass States are useful when constructing and * debugging state machines. * *
A Pass State MAY have a field named “Result”. If present, its value is treated as the output of a virtual task, and placed * as prescribed by the “ResultPath” field, if any, to be passed on to the next state.
* * @see https://states-language.net/spec.html#pass-state */ public final class PassState extends TransitionState { @JsonProperty(PropertyNames.COMMENT) private final String comment; @JsonProperty(PropertyNames.RESULT) private final JsonNode result; @JsonUnwrapped private final PathContainer pathContainer; @JsonUnwrapped private final Transition transition; private PassState(Builder builder) { this.comment = builder.comment; this.result = builder.result; this.pathContainer = builder.pathContainer.build(); this.transition = builder.transition.build(); } /** * @return Type identifier of {@link PassState}. */ @Override public String getType() { return "Pass"; } /** * @return Human readable description for the state. */ public String getComment() { return comment; } /** * @return String containing JSON document of the state's "virtual" result. */ @JsonIgnore public String getResult() { return jsonToString(result); } /** * @return The input path expression that may optionally transform the input to this state. */ @JsonIgnore public String getInputPath() { return pathContainer.getInputPath(); } /** * @return The output path expression that may optionally transform the output to this state. */ @JsonIgnore public String getOutputPath() { return pathContainer.getOutputPath(); } /** * @return The result path expression that may optionally combine or replace the state's raw input with it's result. */ @JsonIgnore public String getResultPath() { return pathContainer.getResultPath(); } /** * @return The Parameters JSON document that may optionally transform the effective input to the task. */ @JsonIgnore public String getParameters() { return jsonToString(pathContainer.getParameters()); } /** * @return The {@link Transition} for this state. */ public Transition getTransition() { return transition; } @Override public