EventInfo.java
2.02 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
57
58
59
60
61
62
63
64
65
66
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.osgi.service.event.Event
*/
package com.adobe.cq.dam.mac.sync.impl;
import org.osgi.service.event.Event;
public class EventInfo {
private static final String RENDITIONS_FOLDER_PATH = "jcr:content/renditions";
private static final String METADATA_FOLDER_PATH = "jcr:content/metadata";
private static final String COMMENT_PATH = "/content/dam/.*/comments/.*";
private DAMEventType damEventType;
private ResourceEventType resourceEventType;
public EventInfo(Event event) {
String eventPath = (String)event.getProperty("path");
String topic = event.getTopic();
if (eventPath != null && eventPath.contains("jcr:content/renditions")) {
this.damEventType = DAMEventType.RENDITION;
} else if (eventPath != null && eventPath.contains("jcr:content/metadata")) {
this.damEventType = DAMEventType.METADATA;
} else if (eventPath != null && eventPath.matches("/content/dam/.*/comments/.*")) {
this.damEventType = DAMEventType.ACTIVITY_STREAM;
}
if ("org/apache/sling/api/resource/Resource/CHANGED".equals(topic)) {
this.resourceEventType = ResourceEventType.CHANGED;
} else if ("org/apache/sling/api/resource/Resource/REMOVED".equals(topic)) {
this.resourceEventType = ResourceEventType.REMOVED;
} else if ("org/apache/sling/api/resource/Resource/ADDED".equals(topic)) {
this.resourceEventType = ResourceEventType.ADDED;
}
}
public DAMEventType getDamEventType() {
return this.damEventType;
}
public ResourceEventType getResourceEventType() {
return this.resourceEventType;
}
static enum DAMEventType {
METADATA,
RENDITION,
ACTIVITY_STREAM;
private DAMEventType() {
}
}
static enum ResourceEventType {
ADDED,
CHANGED,
REMOVED;
private ResourceEventType() {
}
}
}