[midPoint] Search for user based on custom extension value in Maven Overlay

BOSCHMANS Glenn gboschmans at cibg.brussels
Mon May 29 17:17:19 CEST 2017


Hi guys,

We are creating our own REST API with a Maven Overlay of midPoint (to limit the chatter over the network). We also have a custom schema for UserType. In our REST API I need to search for a user based on a value within the extension.

In the Query Playground I get a correct result for this query:
<query>
    <filter>
        <equal>
            <path>extension/briamId</path>
            <value>33c161e0-ed27-470c-9606-c863894c782b</value>
        </equal>
    </filter>
</query>

Because of that I wanted to replicate this query in Java code:

EqualFilter<String> filter = EqualFilter.createEqual(new ItemPath("extension/briamId"),null,null);
       PrismPropertyValue<String> value = new PrismPropertyValue<String>(briamId);
       filter.setValue(value);

       SearchResultList<PrismObject<UserType>> userPrismList =modelService.searchObjects(UserType.class, ObjectQuery.createObjectQuery(filter) , options, task, parentResult);

When I execute this code the following exception occurs:

2017-05-29 16:58:47,375 [] [http-nio-8080-exec-2] ERROR (com.evolveum.midpoint.repo.sql.helpers.BaseHelper): General checked exception occurred.
com.evolveum.midpoint.repo.sql.query.QueryException: Couldn't find a proper restriction for a ValueFilter: EQUAL:
  PATH: extension/briamId
  DEF: null
  VALUE:
    33c161e0-ed27-470c-9606-c863894c782b
                at com.evolveum.midpoint.repo.sql.query2.QueryInterpreter2.findAndCreateRestrictionInternal(QueryInterpreter2.java:230) ~[repo-sql-impl-3.5.1.jar:na]
                at com.evolveum.midpoint.repo.sql.query2.QueryInterpreter2.findAndCreateRestriction(QueryInterpreter2.java:176) ~[repo-sql-impl-3.5.1.jar:na]
                at com.evolveum.midpoint.repo.sql.query2.QueryInterpreter2.interpretFilter(QueryInterpreter2.java:156) ~[repo-sql-impl-3.5.1.jar:na]
                at com.evolveum.midpoint.repo.sql.query2.QueryInterpreter2.interpretQueryFilter(QueryInterpreter2.java:150) ~[repo-sql-impl-3.5.1.jar:na]
                at com.evolveum.midpoint.repo.sql.query2.QueryInterpreter2.interpret(QueryInterpreter2.java:120) ~[repo-sql-impl-3.5.1.jar:na]
                at com.evolveum.midpoint.repo.sql.query2.QueryEngine2.interpret(QueryEngine2.java:50) ~[repo-sql-impl-3.5.1.jar:na]
                at com.evolveum.midpoint.repo.sql.helpers.ObjectRetriever.searchObjectsAttempt(ObjectRetriever.java:373) ~[repo-sql-impl-3.5.1.jar:na]
                at com.evolveum.midpoint.repo.sql.SqlRepositoryServiceImpl.searchObjects(SqlRepositoryServiceImpl.java:251) [repo-sql-impl-3.5.1.jar:na]
                at com.evolveum.midpoint.repo.cache.RepositoryCache.searchObjects(RepositoryCache.java:165) [repo-cache-3.5.1.jar:na]
                at com.evolveum.midpoint.model.impl.controller.ModelController.searchObjects(ModelController.java:826) [model-impl-3.5.1.jar:na]
                at brussels.bric.midpoint.rest.UserService.getUser(UserService.java:104) [briam-midpoint-rest-server-1.0.0.jar:na]
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_66]
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_66]
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_66]
                at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_66]
                ...


I have no idea what I'm missing. Any ideas?

Thanks!

Best regards,
Glenn
[cid:cibg_aee22c14-e9ed-4d7b-8c27-f6c4a26e7736.png]

Glenn Boschmans
Consultant
Business Integrated Solutions
Kunstlaan 21, 1000 Brussel - cibg.brussels<http://cibg.brussels> - disclaimer<http://cibg.brussels/disclaimer-1>
+32 2 282 47 70 |
Be green, leave it on the screen !                                                       [cid:ln_e679eb12-caaa-4d0d-b64d-b39c820c309b.png] <http://www.linkedin.com/company/cirb_cibg>   [cid:tw_20cfb408-d952-4ea7-a757-a8716eaac012.png] <https://twitter.com/CIRB_CIBG>   [cid:logo_eco_mail_e3e2fbdd-9cbf-4a5b-b0c1-1624e00ef4cd.jpg] <http://www.leefmilieu.brussels/themas/duurzame-stad/label-ecodynamische-onderneming>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170529/4fada87a/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cibg_aee22c14-e9ed-4d7b-8c27-f6c4a26e7736.png
Type: image/png
Size: 11221 bytes
Desc: cibg_aee22c14-e9ed-4d7b-8c27-f6c4a26e7736.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170529/4fada87a/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ln_e679eb12-caaa-4d0d-b64d-b39c820c309b.png
Type: image/png
Size: 722 bytes
Desc: ln_e679eb12-caaa-4d0d-b64d-b39c820c309b.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170529/4fada87a/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tw_20cfb408-d952-4ea7-a757-a8716eaac012.png
Type: image/png
Size: 464 bytes
Desc: tw_20cfb408-d952-4ea7-a757-a8716eaac012.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170529/4fada87a/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logo_eco_mail_e3e2fbdd-9cbf-4a5b-b0c1-1624e00ef4cd.jpg
Type: image/jpeg
Size: 1260 bytes
Desc: logo_eco_mail_e3e2fbdd-9cbf-4a5b-b0c1-1624e00ef4cd.jpg
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170529/4fada87a/attachment.jpg>


More information about the midPoint mailing list