Package org.apache.camel.model

Examples of org.apache.camel.model.WhenDefinition


        }

        OnCompletionDefinition onComplete = (OnCompletionDefinition)processor;
        buffer.append(processor.getShortName()).append("()");
        if (onComplete.getOnWhen() != null) {
            WhenDefinition when = onComplete.getOnWhen();
            buffer.append(".onWhen");
            if (when.getExpression().getPredicate() != null) {
                buffer.append("(");
                PredicateRenderer.render(buffer, when.getExpression().getPredicate());
                buffer.append(")");
            } else {
                buffer.append("Unsupported Expression!");
            }
        }
View Full Code Here


        }

        OnCompletionDefinition onComplete = (OnCompletionDefinition)processor;
        buffer.append(processor.getShortName()).append("()");
        if (onComplete.getOnWhen() != null) {
            WhenDefinition when = onComplete.getOnWhen();
            buffer.append(".onWhen");
            if (when.getExpression().getPredicate() != null) {
                buffer.append("(");
                PredicateRenderer.render(buffer, when.getExpression().getPredicate());
                buffer.append(")");
            } else {
                buffer.append("Unsupported Expression!");
            }
        }
View Full Code Here

        }

        OnCompletionDefinition onComplete = (OnCompletionDefinition)processor;
        buffer.append(processor.getShortName()).append("()");
        if (onComplete.getOnWhen() != null) {
            WhenDefinition when = onComplete.getOnWhen();
            buffer.append(".onWhen");
            if (when.getExpression().getPredicate() != null) {
                buffer.append("(");
                PredicateRenderer.render(buffer, when.getExpression().getPredicate());
                buffer.append(")");
            } else {
                buffer.append("Unsupported Expression!");
            }
        }
View Full Code Here

        assertNotNull(route);

        ChoiceDefinition choice = (ChoiceDefinition) route.getOutputs().get(0);
        assertEquals("choice1", choice.getId());

        WhenDefinition when = (WhenDefinition) choice.getOutputs().get(0);
        assertEquals("when1", when.getId());

        LogDefinition log1 = (LogDefinition) when.getOutputs().get(0);
        assertEquals("log1", log1.getId());

        ToDefinition to1 = (ToDefinition) when.getOutputs().get(1);
        assertEquals("camel", to1.getId());

        OtherwiseDefinition other = (OtherwiseDefinition) choice.getOutputs().get(1);
        assertEquals("otherwise1", other.getId());
View Full Code Here

        ChoiceDefinition choice = (ChoiceDefinition) route.getOutputs().get(0);
        assertEquals("myChoice", choice.getId());
        assertTrue(choice.hasCustomIdAssigned());

        WhenDefinition when = choice.getWhenClauses().get(0);
        assertTrue(when.hasCustomIdAssigned());
        assertEquals("UK", when.getId());

        LogDefinition log = (LogDefinition) choice.getOtherwise().getOutputs().get(0);
        assertFalse(log.hasCustomIdAssigned());
    }
View Full Code Here

        ChoiceDefinition choice = (ChoiceDefinition) route.getOutputs().get(0);
        assertEquals("myChoice", choice.getId());
        assertTrue(choice.hasCustomIdAssigned());

        WhenDefinition when = choice.getWhenClauses().get(0);
        assertTrue(when.hasCustomIdAssigned());
        assertEquals("UK", when.getId());

        LogDefinition log = (LogDefinition) choice.getOtherwise().getOutputs().get(0);
        assertFalse(log.hasCustomIdAssigned());
    }
View Full Code Here

        assertNotNull(route);

        ChoiceDefinition choice = (ChoiceDefinition) route.getOutputs().get(0);
        assertEquals("choice1", choice.getId());

        WhenDefinition when = (WhenDefinition) choice.getOutputs().get(0);
        assertEquals("when1", when.getId());

        LogDefinition log1 = (LogDefinition) when.getOutputs().get(0);
        assertEquals("log1", log1.getId());

        ToDefinition to1 = (ToDefinition) when.getOutputs().get(1);
        assertEquals("camel", to1.getId());

        OtherwiseDefinition other = (OtherwiseDefinition) choice.getOutputs().get(1);
        assertEquals("otherwise1", other.getId());
View Full Code Here

    ToDefinition ed4 = assertOutput(routeDef, 1, ToDefinition.class);
    assertEquals("choice -> to", "seda:d", ed4.getUri());

    List<WhenDefinition> whenClauses = c1.getWhenClauses();
    assertSize(whenClauses, 1);
    WhenDefinition wd1 = whenClauses.get(0);
    ToDefinition ed2 = assertSingleOutput(wd1, ToDefinition.class);
    assertEquals("when -> to", "seda:b", ed2.getUri());
   
    OtherwiseDefinition od1 = c1.getOtherwise();
    assertNotNull("Should have Otherwise", od1);
View Full Code Here

    }

    @SuppressWarnings("rawtypes")
    @Override
    public ProcessorDefinition createCamelDefinition() {
        WhenDefinition answer = new WhenDefinition();

        answer.setInheritErrorHandler(toXmlPropertyValue(PROPERTY_INHERITERRORHANDLER, Objects.<Boolean>getField(this, "inheritErrorHandler")));
        answer.setExpression(toXmlPropertyValue(PROPERTY_EXPRESSION, this.getExpression()));

        super.savePropertiesToCamelDefinition(answer);
        return answer;
    }
View Full Code Here

    @Override
    protected void loadPropertiesFromCamelDefinition(ProcessorDefinition processor) {
        super.loadPropertiesFromCamelDefinition(processor);

        if (processor instanceof WhenDefinition) {
            WhenDefinition node = (WhenDefinition) processor;

            this.setInheritErrorHandler(Objects.<Boolean>getField(node, "inheritErrorHandler"));
            this.setExpression(node.getExpression());
        } else {
            throw new IllegalArgumentException("ProcessorDefinition not an instanceof WhenDefinition. Was " + processor.getClass().getName());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.model.WhenDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.