@keshava219 For this you can get list by following the below steps:
1. Create the sling model for the list component and get the currentPage using the annotation
@ScriptVariable
private Page currentPage;
2. As the component could be present in any of the hierarchy, so better to find all the components using the query builder using the predicate map. For this you can do by finding all the paths having the property sling:resourceType with combination of the another property which has the cheecked value as true.
Map<String, String> map = new HashMap<String, String>();
map.put("path", <page-path>/jcr:content);
map.put("1_property", "sling:resourceType");
map.put("1_property.operation", "exists");
map.put("2_property", "sling:resourceType");
map.put("2_property.operation", "unequals");
map.put("2_property.value", "<project-name>/components/container");
map.put("3_property", "componentChecked");
map.put("3_property.value", "true");
map.put("group.p.and", "true");
map.put("p.limit", "-1");
try {
Session session = resourceResolver.adaptTo(Session.class);
Query query = builder.createQuery(PredicateGroup.create(map), session);
if (query != null) {
SearchResult result = query.getResult();
for (Hit hit : result.getHits()) {
.............
}
}
} catch (IOException | RepositoryException e) {
logger.error("Error while processing data {}",e.getMessage());
}
Finally you will get the list of all the components on the page which has the property checked.
Hope this helps!
Thanks