Hi Team,
I want to list down all the groups which does not associate with any USERS, Brand Folders directly or indirectly on my AEM 6.5, Can you Please suggest any sql 2 query.
Thanks,
User415
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
@tkhan415 : Yes, everything that we do in query builder can be converted to backend code.
// create query description as hash map (simplest way, same as form post)
Map<String, String> map = new HashMap<String, String>();
// create query description as hash map (simplest way, same as form post)
//I have done this with static values for demo, the values and property names can be dynamic as well.
map.put("path", "/home/groups");
map.put("1_property", "jcr:primaryType");
map.put("1_property", "rep:Group");
map.put("2_property", "rep:members");
map.put("2_property.operation", "not");
map.put("p.limit", "-1"); // -1, gives all the matching results, if you set a postive value, it will return that many results
Query query = builder.createQuery(PredicateGroup.create(map), session);
SearchResult result = query.getResult();
You can refer this example and will be able to get an idea on how to do it: https://experienceleague.adobe.com/docs/experience-manager-65/content/implementing/developing/platfo...
thanks.
@tkhan415 : Please try with below in (assuming you are doing this locally, else replace the localhost and port) http://localhost:4502/libs/cq/search/content/querydebug.html
path=/home/groups
1_property=jcr:primaryType
1_property.value=rep:Group
2_property=rep:members
2_property.operation=not
p.limit=-1
path=/home/groups
1_property=jcr:primaryType
1_property.value=rep:Group
2_property=rep:members
2_property.value=<jcr:uuid of specific user or group>
p.limit=-1
Hi Kamal,
Can we convert this query to stand alone java code? If yes can you please share the code snippet.
Thanks,
User415
@tkhan415 : Yes, everything that we do in query builder can be converted to backend code.
// create query description as hash map (simplest way, same as form post)
Map<String, String> map = new HashMap<String, String>();
// create query description as hash map (simplest way, same as form post)
//I have done this with static values for demo, the values and property names can be dynamic as well.
map.put("path", "/home/groups");
map.put("1_property", "jcr:primaryType");
map.put("1_property", "rep:Group");
map.put("2_property", "rep:members");
map.put("2_property.operation", "not");
map.put("p.limit", "-1"); // -1, gives all the matching results, if you set a postive value, it will return that many results
Query query = builder.createQuery(PredicateGroup.create(map), session);
SearchResult result = query.getResult();
You can refer this example and will be able to get an idea on how to do it: https://experienceleague.adobe.com/docs/experience-manager-65/content/implementing/developing/platfo...
thanks.
@tkhan415 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
@tkhan415 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies