Java API-find parent group

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2013 04:46 PM
Hi,
in my system I have some groups and each group has a sub-group.
How I can get the parent of a specific sub-group?
thank you.
in my system I have some groups and each group has a sub-group.
How I can get the parent of a specific sub-group?
thank you.
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2013 01:15 AM
You can refer the AuthorityService APIs to achieve this

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2013 02:59 AM
You might want to check these out:
<a href="http://docs.alfresco.com/4.2/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Freferences%2FAPI-JS-Au...">Alfresco - Javascript API - Authority Service</a>
getGroups() & searchGroups() should do the trick in your case.
Copying sample code from <a href="http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/remote-api/source/jav...">Here</a>
<a href="http://docs.alfresco.com/4.2/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Freferences%2FAPI-JS-Au...">Alfresco - Javascript API - Authority Service</a>
getGroups() & searchGroups() should do the trick in your case.
Copying sample code from <a href="http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/remote-api/source/jav...">Here</a>
/** * Detailed test of get Parents */ public void testGetParents() throws Exception { createTestTree(); /** * Get all parents for the root group ALFRESCO_ADMINISTRATORS groups which has no parents */ { Response response = sendRequest(new GetRequest(URL_GROUPS + "/" + ADMIN_GROUP + "/parents"), Status.STATUS_OK); JSONObject top = new JSONObject(response.getContentAsString()); logger.debug(response.getContentAsString()); JSONArray data = top.getJSONArray("data"); // Top level group has no parents assertTrue("top level group has no parents", data.length() == 0); } /** * Get GROUP B Which should be a child of TESTROOT */ { Response response = sendRequest(new GetRequest(URL_GROUPS + "/" + TEST_GROUPB + "/parents"), Status.STATUS_OK); JSONObject top = new JSONObject(response.getContentAsString()); logger.debug(response.getContentAsString()); JSONArray data = top.getJSONArray("data"); assertTrue(data.length() > 0); } /** * Get GROUP D Which should be a child of GROUPB child of TESTROOT */ { Response response = sendRequest(new GetRequest(URL_GROUPS + "/" + TEST_GROUPD + "/parents?level=ALL"), Status.STATUS_OK); JSONObject top = new JSONObject(response.getContentAsString()); logger.debug(response.getContentAsString()); JSONArray data = top.getJSONArray("data"); assertTrue(data.length() >= 2); }
