
io.serverlessworkflow.api.states.ParallelState Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of serverlessworkflow-api Show documentation
Show all versions of serverlessworkflow-api Show documentation
Java SDK for Serverless Workflow Specification
package io.serverlessworkflow.api.states;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonValue;
import io.serverlessworkflow.api.branches.Branch;
import io.serverlessworkflow.api.end.End;
import io.serverlessworkflow.api.error.Error;
import io.serverlessworkflow.api.filters.StateDataFilter;
import io.serverlessworkflow.api.interfaces.State;
import io.serverlessworkflow.api.start.Start;
import io.serverlessworkflow.api.transitions.Transition;
/**
* Consists of a number of states that are executed in parallel
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"branches",
"completionType",
"n"
})
public class ParallelState
extends DefaultState
implements Serializable, State
{
/**
* Branch Definitions
* (Required)
*
*/
@JsonProperty("branches")
@JsonPropertyDescription("Branch Definitions")
@Valid
@NotNull
private List branches = new ArrayList();
/**
* Option types on how to complete branch execution.
*
*/
@JsonProperty("completionType")
@JsonPropertyDescription("Option types on how to complete branch execution.")
private ParallelState.CompletionType completionType = ParallelState.CompletionType.fromValue("and");
/**
* Used when completionType is set to 'n_of_m' to specify the 'N' value
*
*/
@JsonProperty("n")
@JsonPropertyDescription("Used when completionType is set to 'n_of_m' to specify the 'N' value")
private java.lang.String n = "0";
private final static long serialVersionUID = 4063089357613224921L;
/**
* No args constructor for use in serialization
*
*/
public ParallelState() {
}
/**
*
* @param name
* @param branches
* @param type
*/
public ParallelState(List branches, java.lang.String name, DefaultState.Type type) {
super(name, type);
this.branches = branches;
}
/**
* Branch Definitions
* (Required)
*
*/
@JsonProperty("branches")
public List getBranches() {
return branches;
}
/**
* Branch Definitions
* (Required)
*
*/
@JsonProperty("branches")
public void setBranches(List branches) {
this.branches = branches;
}
public ParallelState withBranches(List branches) {
this.branches = branches;
return this;
}
/**
* Option types on how to complete branch execution.
*
*/
@JsonProperty("completionType")
public ParallelState.CompletionType getCompletionType() {
return completionType;
}
/**
* Option types on how to complete branch execution.
*
*/
@JsonProperty("completionType")
public void setCompletionType(ParallelState.CompletionType completionType) {
this.completionType = completionType;
}
public ParallelState withCompletionType(ParallelState.CompletionType completionType) {
this.completionType = completionType;
return this;
}
/**
* Used when completionType is set to 'n_of_m' to specify the 'N' value
*
*/
@JsonProperty("n")
public java.lang.String getN() {
return n;
}
/**
* Used when completionType is set to 'n_of_m' to specify the 'N' value
*
*/
@JsonProperty("n")
public void setN(java.lang.String n) {
this.n = n;
}
public ParallelState withN(java.lang.String n) {
this.n = n;
return this;
}
@Override
public ParallelState withId(java.lang.String id) {
super.withId(id);
return this;
}
@Override
public ParallelState withName(java.lang.String name) {
super.withName(name);
return this;
}
@Override
public ParallelState withType(DefaultState.Type type) {
super.withType(type);
return this;
}
@Override
public ParallelState withStart(Start start) {
super.withStart(start);
return this;
}
@Override
public ParallelState withEnd(End end) {
super.withEnd(end);
return this;
}
@Override
public ParallelState withStateDataFilter(StateDataFilter stateDataFilter) {
super.withStateDataFilter(stateDataFilter);
return this;
}
@Override
public ParallelState withMetadata(Map metadata) {
super.withMetadata(metadata);
return this;
}
@Override
public ParallelState withTransition(Transition transition) {
super.withTransition(transition);
return this;
}
@Override
public ParallelState withDataInputSchema(java.lang.String dataInputSchema) {
super.withDataInputSchema(dataInputSchema);
return this;
}
@Override
public ParallelState withDataOutputSchema(java.lang.String dataOutputSchema) {
super.withDataOutputSchema(dataOutputSchema);
return this;
}
@Override
public ParallelState withOnErrors(List onErrors) {
super.withOnErrors(onErrors);
return this;
}
public enum CompletionType {
AND("and"),
XOR("xor"),
N_OF_M("n_of_m");
private final java.lang.String value;
private final static Map CONSTANTS = new HashMap();
static {
for (ParallelState.CompletionType c: values()) {
CONSTANTS.put(c.value, c);
}
}
private CompletionType(java.lang.String value) {
this.value = value;
}
@Override
public java.lang.String toString() {
return this.value;
}
@JsonValue
public java.lang.String value() {
return this.value;
}
@JsonCreator
public static ParallelState.CompletionType fromValue(java.lang.String value) {
ParallelState.CompletionType constant = CONSTANTS.get(value);
if (constant == null) {
throw new IllegalArgumentException(value);
} else {
return constant;
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy