use of io.atlasmap.v2.Expression in project oozie by apache.
the class CoordInputLogicEvaluatorUtil method validateInputLogic.
/**
* Validate input logic.
*
* @throws JDOMException the JDOM exception
* @throws CommandException in case of error
*/
public void validateInputLogic() throws JDOMException, CommandException {
JexlEngine jexl = new OozieJexlEngine();
String expression = CoordUtils.getInputLogic(coordAction.getActionXml().toString());
if (StringUtils.isEmpty(expression)) {
return;
}
Expression e = jexl.createExpression(expression);
JexlContext jc = new OozieJexlParser(jexl, new CoordInputLogicBuilder(new CoordInputLogicEvaluatorPhaseValidate(coordAction)));
try {
Object result = e.evaluate(jc);
log.debug("Input logic expression is [{0}] and evaluate result is [{1}]", expression, result);
} catch (RuntimeException re) {
throw new CommandException(ErrorCode.E1028, re.getCause().getMessage());
}
}
use of io.atlasmap.v2.Expression in project xtext-core by eclipse.
the class Expression_EqualImpl method basicSetLeft.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLeft(Expression newLeft, NotificationChain msgs) {
Expression oldLeft = left;
left = newLeft;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Bug385636Package.EXPRESSION_EQUAL__LEFT, oldLeft, newLeft);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of io.atlasmap.v2.Expression in project xtext-core by eclipse.
the class Expression_Not_GreaterImpl method basicSetLeft.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLeft(Expression newLeft, NotificationChain msgs) {
Expression oldLeft = left;
left = newLeft;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Bug385636Package.EXPRESSION_NOT_GREATER__LEFT, oldLeft, newLeft);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of io.atlasmap.v2.Expression in project xtext-core by eclipse.
the class Expression_Smaller_EqualImpl method basicSetLeft.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLeft(Expression newLeft, NotificationChain msgs) {
Expression oldLeft = left;
left = newLeft;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Bug385636Package.EXPRESSION_SMALLER_EQUAL__LEFT, oldLeft, newLeft);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of io.atlasmap.v2.Expression in project atlasmap by atlasmap.
the class DefaultAtlasFieldActionsServiceTest method testProcessOldExpressionActionWithoutRoot.
@Test
public void testProcessOldExpressionActionWithoutRoot() throws Exception {
DefaultAtlasSession session = mock(DefaultAtlasSession.class);
FieldGroup fieldGroup = new FieldGroup();
fieldGroup.setPath("/fields<>");
fieldGroup.setCollectionType(CollectionType.LIST);
Field field1 = new SimpleField();
field1.setPath("/fields<0>");
field1.setValue("one");
fieldGroup.getField().add(field1);
Field field2 = new SimpleField();
field2.setPath("/fields<1>");
field2.setValue("two");
fieldGroup.getField().add(field2);
Field field3 = new SimpleField();
field3.setPath("/fields<3>");
field3.setValue("four");
fieldGroup.getField().add(field3);
Expression action = new Expression();
action.setExpression("capitalize(${0})");
fieldGroup.setActions(new ArrayList<Action>());
fieldGroup.getActions().add(action);
Field answer = fieldActionsService.processActions(session, fieldGroup);
assertEquals(FieldGroup.class, answer.getClass());
FieldGroup answerGroup = (FieldGroup) answer;
assertEquals(3, answerGroup.getField().size());
Field f = answerGroup.getField().get(0);
assertEquals("/$ATLASMAP<0>", f.getPath());
assertEquals("One", f.getValue());
f = answerGroup.getField().get(1);
assertEquals("/$ATLASMAP<1>", f.getPath());
assertEquals("Two", f.getValue());
f = answerGroup.getField().get(2);
assertEquals("/$ATLASMAP<2>", f.getPath());
assertEquals("Four", f.getValue());
}
Aggregations