Page 1 of 1

groupSet field in User entity class

Posted: Tue Jan 29, 2019 6:43 am
by sandrab
In the scripting api docs for the org.cyclos.entities.users.User class I see that it has a getGroup() returning a org.cyclos.entities.users.Group. This Group object can be of subclass org.cyclos.entities.users.UserGroup and this UserGroup class has a getGroupSet().
So, when I have a User object called user, I can get the groupSet of this user via the UserGroup, like so: (variant A in the code example below)

When I accidentally used groupSet on the User object directly, I found it gives the same result (variant B in the code example below). I am not sure I understand why this works, when the User class itself has no getGroupSet(), according to the api docs. Is this safe to use or could it stop working at any Cyclos update because it is not in the api docs?

Code: Select all

import org.cyclos.entities.users.User
String userName = 'johnDoe'
User user = conversionHandler.convert(User, userName)

// A. Getting the groupSet via the group: this works and this is what I would expect.

// B. Getting the groupSet directly from the user: this also works, but why?

Using Cyclos 4.11.1