Maybe these resources can be of use?
https://docs.mendix.com/howto/logic-business-rules/extending-your-application-with-custom-java
https://www.mendix.com/blog/easy-xpath-retrieval-in-java/
I hope this helps.
how to return list of objects related to current user ?