public static boolean isNotEmpty(VariableScope variableScope, String variableName) { return !VariableIsEmptyExpressionFunction.isEmpty(variableScope, variableName); }
public void initShortHandExpressionFunctions() { if (shortHandExpressionFunctions == null) { shortHandExpressionFunctions = new ArrayList<>(); String variableScopeName = "execution"; shortHandExpressionFunctions.add(new VariableGetExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableGetOrDefaultExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableContainsAnyExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableContainsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableEqualsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableNotEqualsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableExistsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableIsEmptyExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableIsNotEmptyExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableLowerThanExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableLowerThanOrEqualsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableGreaterThanExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableGreaterThanOrEqualsExpressionFunction(variableScopeName)); } }
@SuppressWarnings("rawtypes") public static boolean isEmpty(VariableScope variableScope, String variableName) { Object variableValue = getVariableValue(variableScope, variableName); if (variableValue == null) { return true; } else if (variableValue instanceof String) { return StringUtils.isEmpty((String) variableValue); } else if (variableValue instanceof Collection) { return CollectionUtil.isEmpty((Collection) variableValue); } else if (variableValue instanceof ArrayNode) { return ((ArrayNode) variableValue).size() == 0; } else { return false; } }
public void initShortHandExpressionFunctions() { if (shortHandExpressionFunctions == null) { shortHandExpressionFunctions = new ArrayList<>(); String variableScopeName = "planItemInstance"; shortHandExpressionFunctions.add(new VariableGetExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableGetOrDefaultExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableContainsAnyExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableContainsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableEqualsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableNotEqualsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableExistsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableIsEmptyExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableIsNotEmptyExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableLowerThanExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableLowerThanOrEqualsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableGreaterThanExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableGreaterThanOrEqualsExpressionFunction(variableScopeName)); } }