Search in sources :

Example 36 with Workflow

use of org.alien4cloud.tosca.model.workflow.Workflow in project alien4cloud by alien4cloud.

the class WorkflowsBuilderService method connectStepFrom.

public Workflow connectStepFrom(Topology topology, Csar csar, String workflowName, String stepId, String[] stepNames) {
    TopologyContext topologyContext = buildTopologyContext(topology, csar);
    Workflow wf = topology.getWorkflows().get(workflowName);
    if (wf == null) {
        throw new NotFoundException(String.format("The workflow '%s' can not be found", workflowName));
    }
    AbstractWorkflowBuilder builder = getWorkflowBuilder(topologyContext.getDSLVersion(), wf);
    builder.connectStepFrom(wf, stepId, stepNames);
    workflowValidator.validate(topologyContext, wf);
    return wf;
}
Also used : Workflow(org.alien4cloud.tosca.model.workflow.Workflow) NotFoundException(alien4cloud.exception.NotFoundException)

Example 37 with Workflow

use of org.alien4cloud.tosca.model.workflow.Workflow in project alien4cloud by alien4cloud.

the class WorkflowsBuilderService method renameNode.

public void renameNode(Topology topology, Csar csar, String nodeTemplateName, String newNodeTemplateName) {
    if (topology.getWorkflows() == null) {
        return;
    }
    TopologyContext topologyContext = buildTopologyContext(topology, csar);
    for (Workflow wf : topology.getWorkflows().values()) {
        AbstractWorkflowBuilder builder = getWorkflowBuilder(topologyContext.getDSLVersion(), wf);
        builder.renameNode(wf, nodeTemplateName, newNodeTemplateName);
        if (topology.getUnprocessedWorkflows().containsKey(wf.getName())) {
            builder.renameNode(topology.getUnprocessedWorkflows().get(wf.getName()), nodeTemplateName, newNodeTemplateName);
        }
        WorkflowUtils.fillHostId(wf, topologyContext);
        workflowValidator.validate(topologyContext, wf);
    }
}
Also used : Workflow(org.alien4cloud.tosca.model.workflow.Workflow)

Example 38 with Workflow

use of org.alien4cloud.tosca.model.workflow.Workflow in project alien4cloud by alien4cloud.

the class WorkflowsBuilderService method addNode.

public void addNode(TopologyContext topologyContext, String nodeName) {
    boolean forceOperation = WorkflowUtils.isComputeOrNetwork(nodeName, topologyContext);
    // Use the unprocessed workflow to perform add node as we know that every steps / links will be present as it's defined in declarative workflow
    topologyContext.getTopology().getWorkflows().putAll(topologyContext.getTopology().getUnprocessedWorkflows());
    for (Workflow wf : topologyContext.getTopology().getWorkflows().values()) {
        AbstractWorkflowBuilder builder = getWorkflowBuilder(topologyContext.getDSLVersion(), wf);
        builder.addNode(wf, nodeName, topologyContext, forceOperation);
        WorkflowUtils.fillHostId(wf, topologyContext);
    }
    postProcessTopologyWorkflows(topologyContext);
}
Also used : Workflow(org.alien4cloud.tosca.model.workflow.Workflow)

Example 39 with Workflow

use of org.alien4cloud.tosca.model.workflow.Workflow in project alien4cloud by alien4cloud.

the class WorkflowsBuilderService method removeNode.

public void removeNode(Topology topology, Csar csar, String nodeName) {
    TopologyContext topologyContext = buildTopologyContext(topology, csar);
    topologyContext.getTopology().getWorkflows().putAll(topologyContext.getTopology().getUnprocessedWorkflows());
    for (Workflow wf : topology.getWorkflows().values()) {
        AbstractWorkflowBuilder builder = getWorkflowBuilder(topologyContext.getDSLVersion(), wf);
        builder.removeNode(wf, nodeName);
        WorkflowUtils.fillHostId(wf, topologyContext);
    }
    postProcessTopologyWorkflows(topologyContext);
    debugWorkflow(topology);
}
Also used : Workflow(org.alien4cloud.tosca.model.workflow.Workflow)

Example 40 with Workflow

use of org.alien4cloud.tosca.model.workflow.Workflow in project alien4cloud by alien4cloud.

the class WorkflowsBuilderService method initStandardWorkflow.

private void initStandardWorkflow(String name, TopologyContext topologyContext) {
    Workflow workflow = new Workflow();
    workflow.setName(name);
    workflow.setStandard(true);
    workflow.setHasCustomModifications(false);
    topologyContext.getTopology().getWorkflows().put(name, workflow);
    reinitWorkflow(name, topologyContext, false);
}
Also used : Workflow(org.alien4cloud.tosca.model.workflow.Workflow)

Aggregations

Workflow (org.alien4cloud.tosca.model.workflow.Workflow)46 WorkflowStep (org.alien4cloud.tosca.model.workflow.WorkflowStep)20 NotFoundException (alien4cloud.exception.NotFoundException)11 Test (org.junit.Test)10 Map (java.util.Map)7 Path (alien4cloud.paas.wf.model.Path)6 NodeTemplate (org.alien4cloud.tosca.model.templates.NodeTemplate)6 List (java.util.List)5 Set (java.util.Set)5 Collectors (java.util.stream.Collectors)5 RelationshipTemplate (org.alien4cloud.tosca.model.templates.RelationshipTemplate)5 TopologyDTO (alien4cloud.topology.TopologyDTO)4 ArchiveRoot (alien4cloud.tosca.model.ArchiveRoot)4 AlienUtils.safe (alien4cloud.utils.AlienUtils.safe)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 Slf4j (lombok.extern.slf4j.Slf4j)4 Csar (org.alien4cloud.tosca.model.Csar)4 Topology (org.alien4cloud.tosca.model.templates.Topology)4 WorkflowUtils (alien4cloud.paas.wf.util.WorkflowUtils)3