Using Custom Result Query Mapper via REST API

280 views
Skip to first unread message

fsousa

unread,
Feb 3, 2020, 7:06:44 AM2/3/20
to jBPM Usage
Hi all,

I am trying to get data from kie-server.

Already made my custom query, registered it using REST API and tested it using RawList as Mapper.

Now I want to get the results from the query but instead of getting only a bunch of unidentified values, I want to get them identified, as a regular key value JSON array.

I've read the the available documentation on using creating custom query mappers.

For convenience I've extended org.jbpm.kie.services.impl.query.mapper.AbstractQueryMapper and implemented org.jbpm.services.api.query.QueryResultMapper on my Query Mapper. It returns a List of my custom DTO.

I've made a jar archive with my DTO and my mapper and dropped it into WEB-INF/lib folder of my  kie-server.war.

Right now, when I try to get results using my mapper, Kie Server complains it won't know any Mapper with the name of the mapper I've created: NodeLogs

Caused by: java.lang.IllegalArgumentException: No mapper found with name NodeLogs
        at deployment
.kie-server.war//org.jbpm.services.api.query.QueryMapperRegistry.mapperFor(QueryMapperRegistry.java:66)
        at deployment
.kie-server.war//org.kie.server.services.jbpm.QueryDataServiceBase.query(QueryDataServiceBase.java:122)
        at deployment
.kie-server.war//org.kie.server.remote.rest.jbpm.QueryDataResource.runQuery(QueryDataResource.java:319)
        at java
.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

After looking into QueryMapperRegistry, I could see it asks the Classloader for the available mappers.

How can I use the same classloader, or let it know for the existance of my Mapper?

Or is there other way to achieve what I want?

Thank you,
FS

fsousa

unread,
Feb 3, 2020, 11:10:06 AM2/3/20
to jBPM Usage
Hi all,

Thanks to this blog post, managed to make things work.

I was missing the services file at META-INF/services/org.jbpm.services.api.query.QueryResultMapper with my mapper FQCN inside.

Regards,
FS
Reply all
Reply to author
Forward
0 new messages