PersonalizedTextHandlerFactory.java
2.16 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.day.cq.wcm.designimporter.api.TagHandler
* com.day.cq.wcm.designimporter.api.TagHandlerFactory
* com.day.cq.wcm.designimporter.parser.taghandlers.TextComponentTagHandler
* org.apache.felix.scr.annotations.Activate
* org.apache.felix.scr.annotations.Component
* org.apache.felix.scr.annotations.Properties
* org.apache.felix.scr.annotations.Property
* org.apache.felix.scr.annotations.Service
* org.apache.sling.commons.osgi.OsgiUtil
* org.osgi.service.component.ComponentContext
*/
package com.day.cq.mcm.campaign.importer;
import com.day.cq.wcm.designimporter.api.TagHandler;
import com.day.cq.wcm.designimporter.api.TagHandlerFactory;
import com.day.cq.wcm.designimporter.parser.taghandlers.TextComponentTagHandler;
import java.util.Dictionary;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.commons.osgi.OsgiUtil;
import org.osgi.service.component.ComponentContext;
@Service
@Component(metatype=1)
@Properties(value={@Property(name="service.ranking", intValue={5000}, propertyPrivate=0), @Property(name="tagpattern", value={"<(p|span|div)\\s+.*data-cq-component=\"(?i)personalized-text\".*?>"})})
public class PersonalizedTextHandlerFactory
implements TagHandlerFactory {
protected static final String RESOURCE_TYPE_PERS_TEXT = "mcm/components/personalization";
public static final String TAG_PATTERN = "<(p|span|div)\\s+.*data-cq-component=\"(?i)personalized-text\".*?>";
private String resourceType;
public TagHandler create() {
TextComponentTagHandler textComponentTagHandler = new TextComponentTagHandler();
textComponentTagHandler.setResourceType(this.resourceType);
return textComponentTagHandler;
}
@Activate
protected void activate(ComponentContext context) {
this.resourceType = OsgiUtil.toString(context.getProperties().get("component.resourceType"), (String)"mcm/components/personalization");
}
}