Skip to content

Commit

Permalink
LPD-31818 I misunderstood the odata spec
Browse files Browse the repository at this point in the history
  • Loading branch information
4lejandrito committed Jul 22, 2024
1 parent 3cfaa75 commit 6f168e4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public Predicate getInPredicate(
Function<String, Column<?, ?>> objectDefinitionColumnSupplier,
Object left, List<Object> rights);

public Predicate getIsEmptyPredicate(
public Predicate getIsNotEmptyPredicate(
String fieldName,
Function<String, Column<?, ?>> objectDefinitionColumnSupplier);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ private Predicate _visitCollectionPropertyExpression(
_getFieldPredicateProvider(
collectionPropertyExpression.getName(), objectDefinition);

return fieldPredicateProvider.getIsEmptyPredicate(
return fieldPredicateProvider.getIsNotEmptyPredicate(
collectionPropertyExpression.getName(),
name -> _getColumn(name, objectDefinition));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ public Predicate getInPredicate(
}

@Override
public Predicate getIsEmptyPredicate(
public Predicate getIsNotEmptyPredicate(
String fieldName,
Function<String, Column<?, ?>> objectDefinitionColumnSupplier) {

Column<?, ?> column = objectDefinitionColumnSupplier.apply("id");

return column.notIn(
return column.in(
DSLQueryFactoryUtil.select(
AssetEntryTable.INSTANCE.classPK
).from(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ public Predicate getInPredicate(
}

@Override
public Predicate getIsEmptyPredicate(
public Predicate getIsNotEmptyPredicate(
String fieldName,
Function<String, Column<?, ?>> objectDefinitionColumnSupplier) {

return objectDefinitionColumnSupplier.apply(
fieldName
).isNull();
).isNotNull();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ public Predicate getInPredicate(
}

@Override
public Predicate getIsEmptyPredicate(
public Predicate getIsNotEmptyPredicate(
String fieldName,
Function<String, Column<?, ?>> objectDefinitionColumnSupplier) {

Column<?, ?> column = objectDefinitionColumnSupplier.apply("id");

return column.notIn(
return column.in(
DSLQueryFactoryUtil.select(
AssetEntryTable.INSTANCE.classPK
).from(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5148,8 +5148,8 @@ public void testGetObjectEntryFilteredByKeywords() throws Exception {
_postObjectEntryWithKeywords("tag1", "tag2");
_postObjectEntryWithKeywords("tag1", "tag2", "tag3");

_assertFilteredObjectEntries(1, "keywords/any()");
_assertFilteredObjectEntries(4, "not keywords/any()");
_assertFilteredObjectEntries(4, "keywords/any()");
_assertFilteredObjectEntries(1, "not keywords/any()");

_assertFilteredObjectEntries(4, "keywords/any(k:k eq 'tag1')");
_assertFilteredObjectEntries(4, "keywords/any(k:k eq 'TAG1')");
Expand Down Expand Up @@ -5245,10 +5245,10 @@ public void testGetObjectEntryFilteredByMultiselectPicklistObjectField()
_TAG_1);

_assertFilteredObjectEntries(
1,
3,
String.format("%s/any()", _OBJECT_FIELD_NAME_MULTISELECT_PICKLIST));
_assertFilteredObjectEntries(
3,
1,
String.format(
"not %s/any()", _OBJECT_FIELD_NAME_MULTISELECT_PICKLIST));
_assertFilteredObjectEntries(
Expand Down Expand Up @@ -5407,8 +5407,8 @@ public void testGetObjectEntryFilteredByTaxonomyCategories()
_postObjectEntryWithTaxonomyCategories(
taxonomyCategory1, taxonomyCategory2, taxonomyCategory3);

_assertFilteredObjectEntries(1, "taxonomyCategoryIds/any()");
_assertFilteredObjectEntries(3, "not taxonomyCategoryIds/any()");
_assertFilteredObjectEntries(3, "taxonomyCategoryIds/any()");
_assertFilteredObjectEntries(1, "not taxonomyCategoryIds/any()");
_assertFilteredObjectEntries(
3,
String.format(
Expand Down

0 comments on commit 6f168e4

Please sign in to comment.