io.resys.hdes.client.spi.HdesClientExecutorBuilder Maven / Gradle / Ivy
package io.resys.hdes.client.spi;
/*-
* #%L
* hdes-client-api
* %%
* Copyright (C) 2020 - 2021 Copyright 2020 ReSys OÜ
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License 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.
* #L%
*/
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.databind.JsonNode;
import io.resys.hdes.client.api.HdesClient.DecisionExecutor;
import io.resys.hdes.client.api.HdesClient.ExecutorBuilder;
import io.resys.hdes.client.api.HdesClient.ExecutorInput;
import io.resys.hdes.client.api.HdesClient.FlowExecutor;
import io.resys.hdes.client.api.HdesClient.HdesTypesMapper;
import io.resys.hdes.client.api.HdesClient.ServiceExecutor;
import io.resys.hdes.client.api.programs.DecisionProgram;
import io.resys.hdes.client.api.programs.DecisionProgram.DecisionResult;
import io.resys.hdes.client.api.programs.FlowProgram;
import io.resys.hdes.client.api.programs.FlowProgram.FlowResult;
import io.resys.hdes.client.api.programs.FlowProgram.FlowResultLog;
import io.resys.hdes.client.api.programs.ProgramEnvir;
import io.resys.hdes.client.api.programs.ProgramEnvir.ProgramStatus;
import io.resys.hdes.client.api.programs.ProgramEnvir.ProgramWrapper;
import io.resys.hdes.client.api.programs.ServiceProgram;
import io.resys.hdes.client.api.programs.ServiceProgram.ServiceResult;
import io.resys.hdes.client.spi.config.HdesClientConfig.DependencyInjectionContext;
import io.resys.hdes.client.spi.decision.DecisionProgramExecutor;
import io.resys.hdes.client.spi.flow.FlowProgramExecutor;
import io.resys.hdes.client.spi.groovy.ServiceProgramExecutor;
import io.resys.hdes.client.spi.util.HdesAssert;
public class HdesClientExecutorBuilder implements ExecutorBuilder {
private final ProgramEnvir envir;
private final HdesTypesMapper defs;
private final ImmutableProgramContext.Builder data;
public HdesClientExecutorBuilder(ProgramEnvir envir, HdesTypesMapper defs, DependencyInjectionContext dependencyInjectionContext) {
this.envir = envir;
this.defs = defs;
this.data = ImmutableProgramContext.builder(defs, envir, dependencyInjectionContext);
}
@Override
public ExecutorBuilder inputField(String name, Serializable value) {
return inputMap(Map.of(name, value));
}
@Override
public ExecutorBuilder inputMap(Map input) {
this.data.map(input);
return this;
}
@Override
public ExecutorBuilder input(ExecutorInput input) {
this.data.callback(input);
return this;
}
@Override
public ExecutorBuilder inputList(List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy