in src/main/java/org/apache/sling/hapi/impl/HApiUtilImpl.java [281:305]
public HApiTypesCollection collectionFromResource(ResourceResolver resolver, Resource collectionResource) throws RepositoryException {
if (!enabled) {
return null;
}
if (null == collectionResource) return null;
ValueMap resProps = collectionResource.adaptTo(ValueMap.class);
String name = resProps.get("name", (String) null);
String description = resProps.get("description", (String) null);
String path = collectionResource.getPath();
String fqdn = resProps.get("fqdn", (String) null);
HApiTypesCollection collection = new HApiTypesCollectionImpl(name, description, serverContextPath, path, fqdn); // no types yet
// iterate the children of the resource and add to the collection
for (Resource typeRes : collectionResource.getChildren()) {
if (typeRes.isResourceType(resourceType)) {
// child resource if a hapi type, add it to the collection
LOG.debug("Trying to add type from resource: {} to the collection", typeRes);
HApiType type = fromResource(resolver, typeRes);
collection.add(type);
LOG.debug("Added type {} to the collection.", type);
}
}
LOG.debug("Collection: {}", collection);
return collection;
}