CommunityCommons XPath Class

2
Has anyone really used the CommunityCommons XPath Class for making XPath queries in Java actions, and if so, is there some kind of a documentation on how it is intended to be used, what each method does, how they should be chained, etc? I found a blog post with a simplistic example, but I'm not getting the results I expect and there is not much documentation to check against. If anybody has or knows of some documentation on this, that would be super helpful. Thanks!
asked
2 answers
1

https://www.mendix.com/blog/easy-xpath-retrieval-in-java/

answered
0

I found that blog post yesterday, but it only explains a small part of the functionality and does not provide any clear definitions of what possible values are, etc.

Do I understand correctly that in the .create() method you define which entity type you want to retrieve, and then you create a subconstraint which defines the path over which you want to retrieve, and then a criteria such as eq() or contains() which contains the conditions for which objects to retrieve? I see that you cannot have a create().eq(), for instance, or a create().addConstraint().eq(), so therefore I infer that .create().subconstraint() is necessary in all cases, as I don't see another way to add a constraint, but this is not described anywhere.

Basically, I am attempting to retrieve active sessions for a System.User which is passed into the java action.

This is what I have currently:

XPath<Session> xpathActiveSessions = XPath.create(context, Session.class)

            .subconstraint(Session.MemberNames.Session_User, User.entityName)

                .eq(Session.MemberNames.Session_User, this.UserParameter1)

            .close();

And this gives me the string (xpathActiveSessions.builder) :

System.Session_User/System.User[System.Session_User = '39969446692913555']

which is not quite what I want I think.

answered