Search in sources :

Example 1 with UnknownNodeError

use of alien4cloud.paas.wf.validation.UnknownNodeError in project alien4cloud by alien4cloud.

the class WorkflowPostProcessor method processWorkflowErrors.

private void processWorkflowErrors(Workflow wf, List<AbstractWorkflowError> errors, Node workflowNode) {
    for (AbstractWorkflowError error : errors) {
        if (error instanceof InlinedWorkflowNotFoundError) {
            Node node = ParsingContextExecution.getObjectToNodeMap().get(((InlinedWorkflowNotFoundError) error).getInlinedWorkflow());
            ParsingContextExecution.getParsingErrors().add(new ParsingError(ParsingErrorLevel.ERROR, ErrorCode.WORKFLOW_INLINED_WORKFLOW_NOT_FOUND, null, getSafeNodeStartMark(node), null, getSafeNodeEndMark(node), ((InlinedWorkflowNotFoundError) error).getInlinedWorkflow()));
        } else if (error instanceof UnknownNodeError) {
            Node node = ParsingContextExecution.getObjectToNodeMap().get(((UnknownNodeError) error).getNodeId());
            ParsingContextExecution.getParsingErrors().add(new ParsingError(ParsingErrorLevel.ERROR, ErrorCode.UNKNWON_WORKFLOW_STEP_TARGET, null, getSafeNodeStartMark(node), "The target node referenced by the workflow step do not exist.", getSafeNodeEndMark(node), ((UnknownNodeError) error).getNodeId()));
        } else if (error instanceof UnknownRelationshipError) {
            Node node = ParsingContextExecution.getObjectToNodeMap().get(((UnknownRelationshipError) error).getRelationshipId());
            ParsingContextExecution.getParsingErrors().add(new ParsingError(ParsingErrorLevel.ERROR, ErrorCode.UNKNWON_WORKFLOW_STEP_RELATIONSHIP_TARGET, null, getSafeNodeStartMark(node), "The target relationship referenced by the workflow step do not exist.", getSafeNodeEndMark(node), ((UnknownRelationshipError) error).getRelationshipId()));
        } else if (error instanceof WorkflowHasCycleError) {
            ParsingContextExecution.getParsingErrors().add(new ParsingError(ParsingErrorLevel.ERROR, ErrorCode.WORKFLOW_HAS_CYCLE, null, getSafeNodeStartMark(workflowNode), null, getSafeNodeEndMark(workflowNode), wf.getName()));
        } else {
            ParsingContextExecution.getParsingErrors().add(new ParsingError(ParsingErrorLevel.WARNING, ErrorCode.WORKFLOW_HAS_ERRORS, null, getSafeNodeStartMark(workflowNode), null, getSafeNodeEndMark(workflowNode), wf.getName()));
        }
    }
}
Also used : InlinedWorkflowNotFoundError(alien4cloud.paas.wf.validation.InlinedWorkflowNotFoundError) ParsingError(alien4cloud.tosca.parser.ParsingError) AbstractWorkflowError(alien4cloud.paas.wf.validation.AbstractWorkflowError) WorkflowHasCycleError(alien4cloud.paas.wf.validation.WorkflowHasCycleError) Node(org.yaml.snakeyaml.nodes.Node) UnknownRelationshipError(alien4cloud.paas.wf.validation.UnknownRelationshipError) UnknownNodeError(alien4cloud.paas.wf.validation.UnknownNodeError)

Aggregations

AbstractWorkflowError (alien4cloud.paas.wf.validation.AbstractWorkflowError)1 InlinedWorkflowNotFoundError (alien4cloud.paas.wf.validation.InlinedWorkflowNotFoundError)1 UnknownNodeError (alien4cloud.paas.wf.validation.UnknownNodeError)1 UnknownRelationshipError (alien4cloud.paas.wf.validation.UnknownRelationshipError)1 WorkflowHasCycleError (alien4cloud.paas.wf.validation.WorkflowHasCycleError)1 ParsingError (alien4cloud.tosca.parser.ParsingError)1 Node (org.yaml.snakeyaml.nodes.Node)1