FolderResource.java
1.64 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
42
43
44
45
46
47
48
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.granite.rest.utils.DeepModifiableValueMapDecorator
* org.apache.sling.api.resource.ModifiableValueMap
* org.apache.sling.api.resource.Resource
* org.apache.sling.api.resource.ValueMap
*/
package com.adobe.cq.screens.impl.rest;
import com.adobe.cq.screens.impl.rest.AbstractScreensResource;
import com.adobe.granite.rest.utils.DeepModifiableValueMapDecorator;
import java.util.Map;
import org.apache.sling.api.resource.ModifiableValueMap;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
public class FolderResource
extends AbstractScreensResource {
public static final String RESOURCE_TYPE = "screens/core/components/folder";
private ValueMap valueMap;
public FolderResource(Resource resource, String path) {
ValueMap base;
super(resource, path);
Resource content = resource;
if (resource.getChild("jcr:content") != null) {
content = resource.getChild("jcr:content");
}
if ((base = (ValueMap)content.adaptTo(ModifiableValueMap.class)) == null) {
base = (ValueMap)content.adaptTo(ValueMap.class);
}
this.valueMap = new DeepModifiableValueMapDecorator(resource, (Map)base);
}
public String getResourceType() {
return "screens/core/components/folder";
}
public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
if (type == ValueMap.class || type == ModifiableValueMap.class) {
return (AdapterType)this.valueMap;
}
return (AdapterType)super.adaptTo(type);
}
}