DefaultTargetLocationNameProvider.java 1.67 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.day.cq.wcm.api.Page
 *  com.day.cq.wcm.api.WCMMode
 *  com.google.common.collect.ImmutableSet
 *  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.api.resource.ValueMap
 */
package com.day.cq.analytics.testandtarget.impl;

import com.day.cq.analytics.testandtarget.TargetLocationNameProvider;
import com.day.cq.wcm.api.Page;
import com.day.cq.wcm.api.WCMMode;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
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.api.resource.ValueMap;

@Component
@Service
@Properties(value={@Property(name="service.ranking", intValue={5})})
public class DefaultTargetLocationNameProvider
implements TargetLocationNameProvider {
    @Override
    public Set<String> getOfferLocationNames(Page offerPage, WCMMode wcmMode) {
        String location = (String)offerPage.getProperties().get("location", (Object)"");
        if ("".equals(location)) {
            return null;
        }
        if (location.startsWith("/")) {
            location = location.substring(1);
        }
        location.replaceAll("/", "-").replaceAll("-jcr:content", "");
        if (wcmMode == WCMMode.DISABLED) {
            return ImmutableSet.of((Object)(location + "--author"));
        }
        return ImmutableSet.of((Object)(location + "--author"));
    }
}