use of io.atlasmap.v2.Expression in project kie-wb-common by kiegroup.
the class ContextEntryPropertyConverter method wbFromDMN.
public static ContextEntry wbFromDMN(final org.kie.dmn.model.v1_1.ContextEntry dmn) {
InformationItem variable = InformationItemPropertyConverter.wbFromDMN(dmn.getVariable());
Expression expression = ExpressionPropertyConverter.wbFromDMN(dmn.getExpression());
ContextEntry result = new ContextEntry();
result.setVariable(variable);
result.setExpression(expression);
return result;
}
use of io.atlasmap.v2.Expression in project kie-wb-common by kiegroup.
the class DecisionConverter method nodeFromDMN.
@Override
public Node<View<Decision>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.Decision dmn) {
@SuppressWarnings("unchecked") Node<View<Decision>, ?> node = (Node<View<Decision>, ?>) factoryManager.newElement(dmn.getId(), Decision.class).asNode();
Id id = new Id(dmn.getId());
Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
Name name = new Name(dmn.getName());
InformationItem informationItem = InformationItemPropertyConverter.wbFromDMN(dmn.getVariable());
Expression expression = ExpressionPropertyConverter.wbFromDMN(dmn.getExpression());
Decision decision = new Decision(id, description, name, new Question(), new AllowedAnswers(), informationItem, expression, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
node.getContent().setDefinition(decision);
return node;
}
use of io.atlasmap.v2.Expression in project kie-wb-common by kiegroup.
the class FunctionDefinitionPropertyConverter method wbFromDMN.
public static FunctionDefinition wbFromDMN(final org.kie.dmn.model.v1_1.FunctionDefinition dmn) {
if (dmn == null) {
return null;
}
Id id = new Id(dmn.getId());
Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
Expression expression = ExpressionPropertyConverter.wbFromDMN(dmn.getExpression());
FunctionDefinition result = new FunctionDefinition(id, description, typeRef, expression);
result.getNsContext().putAll(dmn.getNsContext());
for (Entry<javax.xml.namespace.QName, String> kv : dmn.getAdditionalAttributes().entrySet()) {
QName convertedQName = QNamePropertyConverter.wbFromDMN(kv.getKey());
result.getAdditionalAttributes().put(convertedQName, kv.getValue());
}
for (org.kie.dmn.model.v1_1.InformationItem ii : dmn.getFormalParameter()) {
InformationItem iiConverted = InformationItemPropertyConverter.wbFromDMN(ii);
result.getFormalParameter().add(iiConverted);
}
return result;
}
use of io.atlasmap.v2.Expression in project vorto by eclipse.
the class AbstractDataMapper method matchesCondition.
private boolean matchesCondition(Map<String, String> attributes, JXPathContext context) {
if (attributes.containsKey(ATTRIBUTE_CONDITION) && !attributes.get(ATTRIBUTE_CONDITION).equals("")) {
Expression e = JEXL.createExpression(normalizeCondition(attributes.get(ATTRIBUTE_CONDITION)));
JexlContext jc = new ObjectContext<Object>(JEXL, context.getContextBean());
jc.set("this", context.getContextBean());
return (boolean) e.evaluate(jc);
} else {
return true;
}
}
use of io.atlasmap.v2.Expression in project rubia-forums by flashboss.
the class ForumsACLResource method evaluate.
public boolean evaluate() {
boolean isCriteriaMet = true;
if (criteria != null) {
try {
JexlEngine jexl = new JexlEngine();
JexlContext context2 = new MapContext();
if (criteria != null) {
Expression expression = jexl.createExpression(criteria);
context2.set("param", map.get("runtimeInfo"));
context2.set("identity", map.get("identity"));
Object value = expression.evaluate(context2);
isCriteriaMet = ((Boolean) value).booleanValue();
}
} catch (Exception e) {
log.error(e);
isCriteriaMet = false;
}
}
return isCriteriaMet;
}
Aggregations