Search in sources :

Example 1 with GraphQLModelAugmentor

use of io.automatiko.engine.codegen.process.augmentors.GraphQLModelAugmentor in project automatiko-engine by automatiko-io.

the class InputModelClassGenerator method generate.

public ModelMetaData generate() {
    // create model class for all variables
    String packageName = workFlowProcess.getPackageName();
    modelMetaData = new ModelMetaData(workflowType, workFlowProcess.getId(), CodegenUtils.version(workFlowProcess.getVersion()), packageName, className, workFlowProcess.getVisibility(), VariableDeclarations.ofInput((VariableScope) ((io.automatiko.engine.workflow.base.core.Process) workFlowProcess).getDefaultContext(VariableScope.VARIABLE_SCOPE)), true, ProcessToExecModelGenerator.isServerlessWorkflow(workFlowProcess) ? "/class-templates/JsonModelTemplate.java" : "/class-templates/ModelNoIDTemplate.java", "Input data model for " + workFlowProcess.getName(), "Describes input data model expected by " + workFlowProcess.getName());
    modelMetaData.setSupportsValidation(context.getBuildContext().isValidationSupported());
    modelMetaData.setSupportsOpenApi(context.getBuildContext().isOpenApiSupported());
    if (context.getApplicationProperty("quarkus.automatiko.target-deployment").orElse("unknown").equals("gcp-pubsub")) {
        modelMetaData.addAugmentor(new GcpPubSubModelAugmentor());
    }
    if (context.getBuildContext().isGraphQLSupported()) {
        modelMetaData.addAugmentor(new GraphQLModelAugmentor(true, null, context));
    }
    modelFileName = modelMetaData.getModelClassName().replace('.', '/') + ".java";
    return modelMetaData;
}
Also used : WorkflowProcess(io.automatiko.engine.api.definition.process.WorkflowProcess) GcpPubSubModelAugmentor(io.automatiko.engine.codegen.process.augmentors.GcpPubSubModelAugmentor) ModelMetaData(io.automatiko.engine.workflow.compiler.canonical.ModelMetaData) GraphQLModelAugmentor(io.automatiko.engine.codegen.process.augmentors.GraphQLModelAugmentor)

Example 2 with GraphQLModelAugmentor

use of io.automatiko.engine.codegen.process.augmentors.GraphQLModelAugmentor in project automatiko-engine by automatiko-io.

the class OutputModelClassGenerator method generate.

public ModelMetaData generate() {
    // create model class for all variables
    String packageName = workFlowProcess.getPackageName();
    modelMetaData = new ModelMetaData(workflowType, workFlowProcess.getId(), CodegenUtils.version(workFlowProcess.getVersion()), packageName, className, workFlowProcess.getVisibility(), VariableDeclarations.ofOutput((VariableScope) ((io.automatiko.engine.workflow.base.core.Process) workFlowProcess).getDefaultContext(VariableScope.VARIABLE_SCOPE)), true, ProcessToExecModelGenerator.isServerlessWorkflow(workFlowProcess) ? "/class-templates/JsonOutputModelTemplate.java" : "/class-templates/ModelTemplate.java", "Output data model for " + workFlowProcess.getName(), "Describes output data model expected by " + workFlowProcess.getName());
    modelFileName = modelMetaData.getModelClassName().replace('.', '/') + ".java";
    modelMetaData.setSupportsValidation(context.getBuildContext().isValidationSupported());
    modelMetaData.setSupportsOpenApi(context.getBuildContext().isOpenApiSupported());
    if (context.getBuildContext().isGraphQLSupported()) {
        String processId = workFlowProcess.getId();
        if (workFlowProcess.getVersion() != null) {
            processId += "_" + workFlowProcess.getVersion();
        }
        modelMetaData.addAugmentor(new GraphQLModelAugmentor(false, context.getProcess(processId), context));
    }
    return modelMetaData;
}
Also used : WorkflowProcess(io.automatiko.engine.api.definition.process.WorkflowProcess) ModelMetaData(io.automatiko.engine.workflow.compiler.canonical.ModelMetaData) GraphQLModelAugmentor(io.automatiko.engine.codegen.process.augmentors.GraphQLModelAugmentor)

Aggregations

WorkflowProcess (io.automatiko.engine.api.definition.process.WorkflowProcess)2 GraphQLModelAugmentor (io.automatiko.engine.codegen.process.augmentors.GraphQLModelAugmentor)2 ModelMetaData (io.automatiko.engine.workflow.compiler.canonical.ModelMetaData)2 GcpPubSubModelAugmentor (io.automatiko.engine.codegen.process.augmentors.GcpPubSubModelAugmentor)1