PageResource.java
1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.apache.sling.api.resource.Resource
* org.apache.sling.api.resource.ValueMap
*/
package com.adobe.cq.rest.content.impl;
import com.adobe.cq.rest.content.impl.AbstractPageResource;
import com.adobe.cq.rest.content.impl.PageValueMapDecorator;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
public class PageResource
extends AbstractPageResource {
public static final String RESOURCE_TYPE = "mac/rest/content/page";
private final ValueMap valueMap;
public PageResource(Resource resource, String path) {
ValueMap base;
super(resource, path);
Resource metadata = resource;
if (resource.getChild("jcr:content") != null) {
metadata = resource.getChild("jcr:content");
}
this.valueMap = (base = (ValueMap)metadata.adaptTo(ValueMap.class)) != null ? new PageValueMapDecorator(metadata, base, new String[0]) : ValueMap.EMPTY;
}
public String getResourceType() {
return "mac/rest/content/page";
}
public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
if (type == ValueMap.class) {
return (AdapterType)this.valueMap;
}
return (AdapterType)super.adaptTo(type);
}
}