VariationTemplateImpl.java
1.68 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
49
50
51
52
53
54
55
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.cq.dam.cfm.VariationTemplate
* org.apache.sling.api.resource.Resource
* org.apache.sling.api.resource.ValueMap
*/
package com.adobe.cq.dam.cfm.impl;
import com.adobe.cq.dam.cfm.VariationTemplate;
import com.adobe.cq.dam.cfm.impl.InvalidTemplateException;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
public class VariationTemplateImpl
implements VariationTemplate {
private final String name;
private final String title;
private final String description;
public VariationTemplateImpl(Resource resource) throws InvalidTemplateException {
ValueMap properties = (ValueMap)resource.adaptTo(ValueMap.class);
String name = (String)properties.get("name", String.class);
if (name == null) {
throw new InvalidTemplateException("Missing variation name on template.");
}
this.name = name;
String title = (String)properties.get("jcr:title", String.class);
if (title == null) {
throw new InvalidTemplateException("Missing variation title on template.");
}
this.title = title;
this.description = (String)properties.get("jcr:description", (Object)"");
}
VariationTemplateImpl(String name, String title, String description) {
this.name = name;
this.title = title;
this.description = description != null ? description : "";
}
public String getName() {
return this.name;
}
public String getTitle() {
return this.title;
}
public String getDescription() {
return this.description;
}
}