DamRatingComponent.java
1.4 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.cq.social.tally.RatingComponent
* com.adobe.cq.social.ugcbase.SocialUtils
* org.apache.sling.api.resource.Resource
* org.apache.sling.api.resource.ResourceResolver
*/
package com.day.cq.dam.commons.rating;
import com.adobe.cq.social.tally.RatingComponent;
import com.adobe.cq.social.ugcbase.SocialUtils;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
public class DamRatingComponent {
private static final String RATINGS_PATH = "/ratings";
private Resource assetResource;
private RatingComponent ratingComponent;
public DamRatingComponent(Resource assetResource) {
this.assetResource = assetResource;
ResourceResolver resolver = assetResource.getResourceResolver();
SocialUtils utils = (SocialUtils)resolver.adaptTo(SocialUtils.class);
String socoResourcePath = utils.resourceToUGCStoragePath(assetResource) + "/ratings";
Resource socialResource = resolver.resolve(socoResourcePath);
if (null != socialResource) {
this.ratingComponent = (RatingComponent)socialResource.adaptTo(RatingComponent.class);
}
}
public Resource getAssetResource() {
return this.assetResource;
}
public RatingComponent getRatingComponent() {
return this.ratingComponent;
}
}