use of com.adaptris.core.services.conditional.conditions.ConditionAnd in project interlok by adaptris.
the class IfElseTest method retrieveObjectForSampleConfig.
@Override
protected Object retrieveObjectForSampleConfig() {
IfElse result = new IfElse();
ConditionMetadata condition = new ConditionMetadata();
condition.setMetadataKey("key1");
condition.setOperator(new NotNull());
Equals equals = new Equals();
equals.setValue("myValue");
ConditionMetadata condition2 = new ConditionMetadata();
condition2.setMetadataKey("key2");
condition2.setOperator(equals);
ConditionOr conditionOr = new ConditionOr();
ConditionExpression conditionExpression = new ConditionExpression();
conditionExpression.setAlgorithm("(%message{key1} - 10) == %message{key2}");
conditionOr.getConditions().add(conditionExpression);
conditionOr.getConditions().add(condition2);
ConditionAnd conditionAnd = new ConditionAnd();
conditionAnd.getConditions().add(condition);
conditionAnd.getConditions().add(conditionOr);
conditionAnd.getConditions().add(new ConditionFunction("function evaluateScript(message) { return message.getMetadataValue('mykey').equals('myvalue');}"));
ThenService thenSrvc = new ThenService();
ElseService elseSrvc = new ElseService();
thenSrvc.setService(new LogMessageService());
elseSrvc.setService(new LogMessageService());
result.setCondition(conditionAnd);
result.setThen(thenSrvc);
result.setOtherwise(elseSrvc);
return result;
}
Aggregations