DefaultTargetLocationNameProvider.java
1.67 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
/*
* 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"));
}
}