IndexRule.java
1.62 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.google.common.collect.ImmutableMap
* org.apache.sling.api.resource.PersistenceException
* org.apache.sling.api.resource.Resource
* org.apache.sling.api.resource.ResourceResolver
*/
package com.adobe.cq.dam.index.builder;
import com.adobe.cq.dam.index.builder.api.PropertyDefinition;
import com.google.common.collect.ImmutableMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.sling.api.resource.PersistenceException;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
public class IndexRule {
String primaryType;
List<? extends PropertyDefinition> propertyDefinitions;
public IndexRule(String primaryType, List<? extends PropertyDefinition> propDef) {
this.primaryType = primaryType;
this.propertyDefinitions = propDef;
}
public String primaryType() {
return this.primaryType;
}
public List<? extends PropertyDefinition> propertyDefinition() {
return this.propertyDefinitions;
}
public void build(Resource resource) throws PersistenceException {
ResourceResolver resolver = resource.getResourceResolver();
Resource primaryTypeNode = resolver.create(resource, this.primaryType, new HashMap());
Resource propertiesNode = resolver.create(primaryTypeNode, "properties", (Map)ImmutableMap.of((Object)"jcr:primaryType", (Object)"nt:unstructured"));
for (PropertyDefinition propDef : this.propertyDefinitions) {
propDef.build(propertiesNode);
}
}
}