LinkingStatusServiceImpl.java
1.61 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.i18n.I18n
* com.day.cq.wcm.api.Page
* org.apache.felix.scr.annotations.Component
* org.apache.felix.scr.annotations.Reference
* org.apache.felix.scr.annotations.Service
* org.apache.sling.api.resource.Resource
*/
package com.adobe.cq.mcm.campaign.impl;
import com.adobe.cq.mcm.campaign.LinkingStatus;
import com.adobe.cq.mcm.campaign.LinkingStatusService;
import com.adobe.cq.mcm.campaign.NewsletterException;
import com.adobe.cq.mcm.campaign.NewsletterManager;
import com.day.cq.i18n.I18n;
import com.day.cq.wcm.api.Page;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.resource.Resource;
@Component(metatype=0)
@Service
public class LinkingStatusServiceImpl
implements LinkingStatusService {
@Reference
private NewsletterManager manager;
@Override
public LinkingStatus retrieveStatus(Resource resource, I18n i18n) throws NewsletterException {
Page page = (Page)resource.getParent().adaptTo(Page.class);
String[] links = this.manager.getLinkedDeliveries(page);
boolean isApproved = this.manager.isApproved(page);
return new LinkingStatus(isApproved, links);
}
protected void bindManager(NewsletterManager newsletterManager) {
this.manager = newsletterManager;
}
protected void unbindManager(NewsletterManager newsletterManager) {
if (this.manager == newsletterManager) {
this.manager = null;
}
}
}