PersonalizedTextHandlerFactory.java 2.16 KB
/*
 * 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");
    }
}