Source:
private static boolean matchesFilter(final ModelNode resource, final ModelNode filter, final Operator operator) throws OperationFailedException { boolean isMatching = false; List<Property> filterProperties = filter.asPropertyList(); List<Boolean> matches = new ArrayList<>(filterProperties.size()); for (Property property : filterProperties) { final String filterName = property.getName(); final ModelNode filterValue = property.getValue(); boolean isEqual = false; if(!filterValue.isDefined() || filterValue.asString().equals(UNDEFINED)) { isEqual = !resource.get(filterName).isDefined(); } else { final ModelType targetValueType = resource.get(filterName).getType(); try { switch (targetValueType) { case BOOLEAN: isEqual = filterValue.asBoolean() == resource.get(filterName).asBoolean(); break; case LONG: isEqual = filterValue.asLong() == resource.get(filterName).asLong(); break; case INT: isEqual = filterValue.asInt() == resource.get(filterName).asInt(); break; case DOUBLE: isEqual = filterValue.asDouble() == resource.get(filterName).asDouble(); break; default: isEqual = filterValue.equals(resource.get(filterName)); } } catch (IllegalArgumentException e) { throw new OperationFailedException("Illegal argument for attribute '"+filterName+"'. Expected type "+targetValueType); } } if(isEqual) { matches.add(resource.get(filterName).equals(filterValue)); } } if (Operator.AND.equals(operator)) { isMatching = matches.size() == filterProperties.size(); } else if(Operator.OR.equals(operator)){ for (Boolean match : matches) { if (match) { isMatching = true; break; } } } else { throw new OperationFailedException("Invalid operator"+operator); } return isMatching; }

Target:
private static boolean matchesFilter(final ModelNode resource, final ModelNode filter, final Operator operator) { boolean isMatching = false; List<Property> filterProperties = filter.asPropertyList(); List<Boolean> matches = new ArrayList<>(filterProperties.size()); for (Property property : filterProperties) { final String filterName = property.getName(); final ModelNode filterValue = property.getValue(); boolean isEqual = false; if(!filterValue.isDefined() || filterValue.asString().equals(UNDEFINED)) { isEqual = !resource.get(filterName).isDefined(); } else { final ModelType targetValueType = resource.get(filterName).getType(); try { switch (targetValueType) { case BOOLEAN: isEqual = filterValue.asBoolean() == resource.get(filterName).asBoolean(); break; case LONG: isEqual = filterValue.asLong() == resource.get(filterName).asLong(); break; case INT: isEqual = filterValue.asInt() == resource.get(filterName).asInt(); break; case DOUBLE: isEqual = filterValue.asDouble() == resource.get(filterName).asDouble(); break; default: isEqual = filterValue.equals(resource.get(filterName)); } } catch (IllegalArgumentException e) { throw ControllerLogger.MGMT_OP_LOGGER.validationFailedCouldNotConvertParamToType(filterName, targetValueType, ""); } } if(isEqual) { matches.add(resource.get(filterName).equals(filterValue)); } } if (Operator.AND.equals(operator)) { isMatching = matches.size() == filterProperties.size(); } else if(Operator.OR.equals(operator)){ for (Boolean match : matches) { if (match) { isMatching = true; break; } } } else { throw new IllegalArgumentException( ControllerLogger.MGMT_OP_LOGGER.invalidValue( operator.toString(), OPERATOR, Arrays.asList(Operator.values()) ) ); } return isMatching; }