Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Jun 22, 2021
2 parents 08b871d + b814b34 commit 54af4c1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ public Predicate process(ValueFilter<T, ?> filter) throws RepositoryException {
MExtItem extItem = ((SqaleQueryContext<?, ?, ?>) context).repositoryContext()
.resolveExtensionItem(definition, holderType);
assert definition != null;
if (extItem == null) {
throw new QueryException("Extension item " + definition.getItemName()
+ " is not indexed, filter: " + filter);
}

if (definition instanceof PrismReferenceDefinition) {
return processReference(extItem, (RefFilter) filter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public void initObjects() throws Exception {
addExtensionValue(user1Extension, "ref-mv",
ref(org1Oid, null, relation2), // type is nullable if provided in schema
ref(org2Oid, OrgType.COMPLEX_TYPE)); // default relation
addExtensionValue(user1Extension, "string-ni", "not-indexed-item");
ExtensionType user1AssignmentExtension = new ExtensionType(prismContext);
user1.assignment(new AssignmentType(prismContext)
.extension(user1AssignmentExtension));
Expand Down Expand Up @@ -1444,6 +1445,20 @@ ShadowType.F_ATTRIBUTES, new QName("http://example.com/p", "string-mv")),
shadow1Oid);
}

@Test
public void test595SearchObjectByNotIndexedExtensionFails() throws SchemaException {
given("query for not-indexed extension");
OperationResult operationResult = createOperationResult();
ObjectQuery query = prismContext.queryFor(UserType.class)
.item(UserType.F_EXTENSION, new QName("string-ni")).eq("whatever")
.build();

expect("searchObjects throws exception because of not-indexed item");
assertThatThrownBy(() -> searchObjects(UserType.class, query, operationResult))
.isInstanceOf(SystemException.class)
.hasMessageContaining("not indexed");
}

// TODO multi-value EQ filter (IN semantics) is not supported YET (except for refs)
// endregion

Expand Down

0 comments on commit 54af4c1

Please sign in to comment.