LinkArticleToSharedResourceEntity.java
2.46 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
51
52
53
54
55
56
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.dps.client.producer.EntityProducerDAO
* com.adobe.dps.client.producer.api.ProducerApi
* com.adobe.dps.client.producer.utils.AccessToken
* com.adobe.dps.client.producer.utils.Session
* com.adobe.dps.producer.entity.dto.ArticleEntity
* com.adobe.dps.producer.entity.dto.Entity
* com.adobe.dps.producer.entity.dto.SharedContentEntity
* org.slf4j.Logger
*/
package com.adobe.cq.mobile.dps.impl.service.actions;
import com.adobe.cq.mobile.dps.impl.service.actions.AbstractCallableDPSAction;
import com.adobe.cq.mobile.dps.impl.ui.PerfTimer;
import com.adobe.dps.client.producer.EntityProducerDAO;
import com.adobe.dps.client.producer.api.ProducerApi;
import com.adobe.dps.client.producer.utils.AccessToken;
import com.adobe.dps.client.producer.utils.Session;
import com.adobe.dps.producer.entity.dto.ArticleEntity;
import com.adobe.dps.producer.entity.dto.Entity;
import com.adobe.dps.producer.entity.dto.SharedContentEntity;
import java.util.concurrent.Callable;
import org.slf4j.Logger;
public class LinkArticleToSharedResourceEntity
extends AbstractCallableDPSAction
implements Callable<ArticleEntity> {
private final ProducerApi producerApi;
private final String entityHref;
private final SharedContentEntity sharedContentEntity;
public LinkArticleToSharedResourceEntity(EntityProducerDAO entityAccess, ProducerApi producerAPI, AccessToken accessToken, Session session, String entityHref, SharedContentEntity sharedContentEntity) {
super(entityAccess, accessToken, session);
this.producerApi = producerAPI;
this.entityHref = entityHref;
this.sharedContentEntity = sharedContentEntity;
}
@Override
public ArticleEntity call() throws Exception {
PerfTimer perfTimer = PerfTimer.startTimer(this, this.getClass().getName());
this.logger.debug("Linking article for shared resources " + this.entityHref);
ArticleEntity article = (ArticleEntity)this.entityAccess.readEntity(this.accessToken, this.entityHref, this.session.generateNewRequestId());
if (article != null) {
article = this.producerApi.linkArticleToSharedContent(article, this.sharedContentEntity, "HTMLResources", this.session);
} else {
this.logger.warn("Referenced entity does not exist in AEM Mobile On Demand and cannot be linked, " + this.entityHref);
}
perfTimer.end();
return article;
}
}