Skip to content

Commit

Permalink
addressed Issue #42 list queries should now work properly
Browse files Browse the repository at this point in the history
  • Loading branch information
benni committed Dec 18, 2019
1 parent fdab0e9 commit 9401e1b
Showing 1 changed file with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public boolean calculate(BaseProperty property) throws ResponseException {
*
* @param properties
* @return
* @throws ResponseException
* @throws ResponseException
*/
public boolean calculate(List<BaseProperty> properties) throws ResponseException {
boolean result = false;
Expand All @@ -76,7 +76,8 @@ public boolean calculate(List<BaseProperty> properties) throws ResponseException
return result;
}

private boolean calculate(List<BaseProperty> properties, String attribute, String operator, String operant) throws ResponseException {
private boolean calculate(List<BaseProperty> properties, String attribute, String operator, String operant)
throws ResponseException {
if (!attribute.matches(URI) && attribute.contains(".")) {
String[] splittedAttrib = attribute.split("\\.");
ArrayList<BaseProperty> newProps = new ArrayList<BaseProperty>();
Expand Down Expand Up @@ -158,14 +159,24 @@ private boolean calculate(List<BaseProperty> properties, String attribute, Strin

} else if (operant.matches(LIST)) {
List<String> listOfOperants = Arrays.asList(operant.split(","));

for (String listOperant : listOfOperants) {
if (!value.contains(listOperant)) {
return false;
switch (operator) {
case "!=":
for (String listOperant : listOfOperants) {
if (value.contains(listOperant)) {
return false;
}
}
return true;
case "==":
for (String listOperant : listOfOperants) {
if (value.contains(listOperant)) {
return true;
}
}
return false;
default:
return false;
}
return true;

} else {
boolean finalReturnValue = false;
for (Object item : value) {
Expand Down

0 comments on commit 9401e1b

Please sign in to comment.