PageResourceFactory.java
1.25 KB
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.apache.sling.api.resource.Resource
* org.slf4j.Logger
* org.slf4j.LoggerFactory
*/
package com.adobe.cq.rest.content.impl;
import com.adobe.cq.rest.content.impl.PageResource;
import org.apache.sling.api.resource.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PageResourceFactory {
private static final Logger log = LoggerFactory.getLogger(PageResourceFactory.class);
private static final String RT_CQ_PAGE = "cq:Page";
private static final String RT_SLING_FOLDER = "sling:Folder";
private static final String RT_SLING_ORDERED_FOLDER = "sling:OrderedFolder";
private String apiContextPath;
public PageResourceFactory(String apiContextPath) {
this.apiContextPath = apiContextPath;
}
public Resource createResource(Resource resource, String path) {
if ("cq:Page".equals(resource.getResourceType()) || "sling:OrderedFolder".equals(resource.getResourceType()) || "sling:Folder".equals(resource.getResourceType()) || this.apiContextPath.equals(path)) {
return new PageResource(resource, path);
}
log.debug("Unkwnown resource type: " + (Object)resource);
return null;
}
}