use of org.alien4cloud.tosca.model.workflow.activities.SetStateWorkflowActivity in project alien4cloud by alien4cloud.
the class WorkflowGraphUtils method isStepEmpty.
public static boolean isStepEmpty(WorkflowStep step, TopologyContext topologyContext) {
// No activity
if (step.getActivity() == null) {
return true;
}
// Inline activity is never empty
if (step.getActivity() instanceof DelegateWorkflowActivity || step.getActivity() instanceof SetStateWorkflowActivity || step.getActivity() instanceof InlineWorkflowActivity) {
return false;
}
CallOperationWorkflowActivity callOperationWorkflowActivity = (CallOperationWorkflowActivity) step.getActivity();
NodeTemplate nodeTemplate = topologyContext.getTopology().getNodeTemplates().get(step.getTarget());
String stepInterfaceName = ToscaNormativeUtil.getLongInterfaceName(callOperationWorkflowActivity.getInterfaceName());
String stepOperationName = callOperationWorkflowActivity.getOperationName();
if (step instanceof NodeWorkflowStep) {
return !hasImplementation(nodeTemplate, NodeType.class, topologyContext, stepInterfaceName, stepOperationName);
} else if (step instanceof RelationshipWorkflowStep) {
RelationshipWorkflowStep relationshipWorkflowStep = (RelationshipWorkflowStep) step;
RelationshipTemplate relationshipTemplate = nodeTemplate.getRelationships().get(relationshipWorkflowStep.getTargetRelationship());
return !hasImplementation(relationshipTemplate, RelationshipType.class, topologyContext, stepInterfaceName, stepOperationName);
} else {
return false;
}
}
use of org.alien4cloud.tosca.model.workflow.activities.SetStateWorkflowActivity in project alien4cloud by alien4cloud.
the class WorkflowUtils method createStateStep.
public static WorkflowStep createStateStep(Workflow wf, String nodeId, String stateName) {
SetStateWorkflowActivity task = new SetStateWorkflowActivity();
task.setStateName(stateName);
NodeWorkflowStep step = new NodeWorkflowStep();
step.setTarget(nodeId);
step.setActivity(task);
step.setName(buildStepName(wf, step, 0));
return step;
}
Aggregations