//UserRoleGroup table contains userId
else
{
//Tool used to pull objects
ObjectRetrievalTools objRetTools = new ObjectRetrievalTools();
//list to store all the UserRoleGroups a userId belongs to
List<UserRoleGroup> userUrgList = objRetTools.getObjectList(Table.UserRoleGroup, "userId", userId);
//sets up a list to store the groups a userId belongs to
List<Group> groups = new ArrayList<>(0);
//iterates the list of UserRoleGroups and extracts the Group based on the groupId of the UserRoleGroup
//add the Group to the list storing Groups
for (UserRoleGroup urgIterator : userUrgList)
{
Group group = (Group) objRetTools.getObject(Table.Group, "id", urgIterator.getGroupId());
groups.add(group);
//System.out.println("\n\n\tThis is a title: " + group.getGroupTitle());
}
//sets up return object