@Test public void testListMemberForGroup() throws XWikiException { assertEquals( new HashSet<String>(Arrays.asList(this.user.getFullName())), new HashSet<String>(this.groupService.listMemberForGroup(this.group.getFullName(), this.oldcore.getXWikiContext()))); this.groupObject.setStringValue("member", this.userWithSpaces.getFullName()); this.oldcore.getSpyXWiki().saveDocument(this.group, this.oldcore.getXWikiContext()); assertEquals(new HashSet<String>(Arrays.asList(this.userWithSpaces.getFullName())), new HashSet<String>( this.groupService.listMemberForGroup(this.group.getFullName(), this.oldcore.getXWikiContext()))); }
@Override @Deprecated public List<String> listMemberForGroup(String group, XWikiContext context) throws XWikiException { List<String> list = new ArrayList<String>(); try { if (group == null) { try { return context.getWiki().getStore().getQueryManager().getNamedQuery("getAllUsers").execute(); } catch (QueryException ex) { throw new XWikiException(0, 0, ex.getMessage(), ex); } } else { String gshortname = Util.getName(group, context); XWikiDocument docgroup = context.getWiki().getDocument(gshortname, context); List<BaseObject> groups = docgroup.getXObjects(GROUPCLASS_REFERENCE); if (groups != null) { for (BaseObject bobj : groups) { if (bobj != null) { String member = bobj.getStringValue(FIELD_XWIKIGROUPS_MEMBER); if (StringUtils.isNotEmpty(member)) { list.add(member); } } } } return list; } } catch (XWikiException e) { LOGGER.error("Failed to get group document", e); } return null; }
XWikiGroupServiceImpl implements XWikiGroupService, EventListener { @Override @Deprecated public List<String> listMemberForGroup(String group, XWikiContext context) throws XWikiException { List<String> list = new ArrayList<String>(); try { if (group == null) { try { return context.getWiki().getStore().getQueryManager().getNamedQuery("getAllUsers").execute(); } catch (QueryException ex) { throw new XWikiException(0, 0, ex.getMessage(), ex); } } else { String gshortname = Util.getName(group, context); XWikiDocument docgroup = context.getWiki().getDocument(gshortname, context); List<BaseObject> groups = docgroup.getXObjects(GROUPCLASS_REFERENCE); if (groups != null) { for (BaseObject bobj : groups) { if (bobj != null) { String member = bobj.getStringValue(FIELD_XWIKIGROUPS_MEMBER); if (StringUtils.isNotEmpty(member)) { list.add(member); } } } } return list; } } catch (XWikiException e) { LOGGER.error("Failed to get group document", e); } return null; } }
XWikiGroupServiceImpl implements XWikiGroupService, EventListener { @Override @Deprecated public List<String> listMemberForGroup(String group, XWikiContext context) throws XWikiException { List<String> list = new ArrayList<String>(); try { if (group == null) { try { return context.getWiki().getStore().getQueryManager().getNamedQuery("getAllUsers").execute(); } catch (QueryException ex) { throw new XWikiException(0, 0, ex.getMessage(), ex); } } else { String gshortname = Util.getName(group, context); XWikiDocument docgroup = context.getWiki().getDocument(gshortname, context); List<BaseObject> groups = docgroup.getXObjects(GROUPCLASS_REFERENCE); if (groups != null) { for (BaseObject bobj : groups) { if (bobj != null) { String member = bobj.getStringValue(FIELD_XWIKIGROUPS_MEMBER); if (StringUtils.isNotEmpty(member)) { list.add(member); } } } } return list; } } catch (XWikiException e) { LOGGER.error("Failed to get group document", e); } return null; }  }
XWikiGroupServiceImpl implements XWikiGroupService, EventListener { @Override @Deprecated public List<String> listMemberForGroup(String group, XWikiContext context) throws XWikiException { List<String> list = new ArrayList<String>(); try { if (group == null) { try { return context.getWiki().getStore().getQueryManager().getNamedQuery("getAllUsers").execute(); } catch (QueryException ex) { throw new XWikiException(0, 0, ex.getMessage(), ex); } } else { String gshortname = Util.getName(group, context); XWikiDocument docgroup = context.getWiki().getDocument(gshortname, context); List<BaseObject> groups = docgroup.getXObjects(GROUPCLASS_REFERENCE); if (groups != null) { for (BaseObject bobj : groups) { if (bobj != null) { String member = bobj.getStringValue(FIELD_XWIKIGROUPS_MEMBER); if (StringUtils.isNotEmpty(member)) { list.add(member); } } } } return list; } } catch (XWikiException e) { LOGGER.error("Failed to get group document", e); } return null; }  @Override synchronized void init(XWiki xwiki, XWikiContext context); @Override synchronized void initCache(XWikiContext context); @Override synchronized void initCache(int iCapacity, XWikiContext context); @Override void flushCache(); @Override @Deprecated Collection<String> listGroupsForUser(String member, XWikiContext context); @Override @Deprecated void addUserToGroup(String username, String database, String group, XWikiContext context); @Override void replaceMemberInAllGroups(DocumentReference memberSourceReference,
        DocumentReference memberTargetReference, XWikiContext context); @Override void removeUserOrGroupFromAllGroups(String memberWiki, String memberSpace, String memberName,
        XWikiContext context); @Override @Deprecated List<String> listMemberForGroup(String group, XWikiContext context); @Override @Deprecated List<String> listAllGroups(XWikiContext context); @Override String getName(); @Override List<Event> getEvents(); @Override void onEvent(Event event, Object source, Object data); @Override List<?> getAllMatchedUsers(Object[][] matchFields, boolean withdetails, int nb, int start, Object[][] order,
        XWikiContext context); @Override List<?> getAllMatchedGroups(Object[][] matchFields, boolean withdetails, int nb, int start, Object[][] order,
        XWikiContext context); @Override int countAllMatchedUsers(Object[][] matchFields, XWikiContext context); @Override int countAllMatchedGroups(Object[][] matchFields, XWikiContext context); @Override Collection<String> getAllGroupsNamesForMember(String member, int nb, int start, XWikiContext context); @Override Collection<DocumentReference> getAllGroupsReferencesForMember(DocumentReference memberReference, int limit,
        int offset, XWikiContext context); @Override Collection<String> getAllMembersNamesForGroup(String group, int nb, int start, XWikiContext context); @Override Collection<String> getAllMatchedMembersNamesForGroup(String group, String matchField, int nb, int start,
        Boolean orderAsc, XWikiContext context); @Override int countAllMatchedMembersNamesForGroup(String group, String filter, XWikiContext xcontext); @Override int countAllGroupsNamesForMember(String member, XWikiContext context); @Override int countAllMembersNamesForGroup(String group, XWikiContext context); }
XWikiGroupServiceImpl implements XWikiGroupService, EventListener { @Override @Deprecated public List<String> listMemberForGroup(String group, XWikiContext context) throws XWikiException { List<String> list = new ArrayList<String>(); try { if (group == null) { try { return context.getWiki().getStore().getQueryManager().getNamedQuery("getAllUsers").execute(); } catch (QueryException ex) { throw new XWikiException(0, 0, ex.getMessage(), ex); } } else { String gshortname = Util.getName(group, context); XWikiDocument docgroup = context.getWiki().getDocument(gshortname, context); List<BaseObject> groups = docgroup.getXObjects(GROUPCLASS_REFERENCE); if (groups != null) { for (BaseObject bobj : groups) { if (bobj != null) { String member = bobj.getStringValue(FIELD_XWIKIGROUPS_MEMBER); if (StringUtils.isNotEmpty(member)) { list.add(member); } } } } return list; } } catch (XWikiException e) { LOGGER.error("Failed to get group document", e); } return null; }  @Override synchronized void init(XWiki xwiki, XWikiContext context); @Override synchronized void initCache(XWikiContext context); @Override synchronized void initCache(int iCapacity, XWikiContext context); @Override void flushCache(); @Override @Deprecated Collection<String> listGroupsForUser(String member, XWikiContext context); @Override @Deprecated void addUserToGroup(String username, String database, String group, XWikiContext context); @Override void replaceMemberInAllGroups(DocumentReference memberSourceReference,
        DocumentReference memberTargetReference, XWikiContext context); @Override void removeUserOrGroupFromAllGroups(String memberWiki, String memberSpace, String memberName,
        XWikiContext context); @Override @Deprecated List<String> listMemberForGroup(String group, XWikiContext context); @Override @Deprecated List<String> listAllGroups(XWikiContext context); @Override String getName(); @Override List<Event> getEvents(); @Override void onEvent(Event event, Object source, Object data); @Override List<?> getAllMatchedUsers(Object[][] matchFields, boolean withdetails, int nb, int start, Object[][] order,
        XWikiContext context); @Override List<?> getAllMatchedGroups(Object[][] matchFields, boolean withdetails, int nb, int start, Object[][] order,
        XWikiContext context); @Override int countAllMatchedUsers(Object[][] matchFields, XWikiContext context); @Override int countAllMatchedGroups(Object[][] matchFields, XWikiContext context); @Override Collection<String> getAllGroupsNamesForMember(String member, int nb, int start, XWikiContext context); @Override Collection<DocumentReference> getAllGroupsReferencesForMember(DocumentReference memberReference, int limit,
        int offset, XWikiContext context); @Override Collection<String> getAllMembersNamesForGroup(String group, int nb, int start, XWikiContext context); @Override Collection<String> getAllMatchedMembersNamesForGroup(String group, String matchField, int nb, int start,
        Boolean orderAsc, XWikiContext context); @Override int countAllMatchedMembersNamesForGroup(String group, String filter, XWikiContext xcontext); @Override int countAllGroupsNamesForMember(String member, XWikiContext context); @Override int countAllMembersNamesForGroup(String group, XWikiContext context); static final EntityReference GROUPCLASS_REFERENCE; }