AnnotationProcessor.java
3.04 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
67
68
69
70
71
72
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.aemds.guide.xsd;
import java.util.Hashtable;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
public class AnnotationProcessor {
private static final String appinfoSourceURL = "http://www.adobe.com/in/marketing-cloud/enterprise-content-management.html";
private static final String appinfoNamespaceURL = "http://www.adobe.com/in/marketing-cloud/enterprise-content-management.html";
private static AnnotationProcessor annotationProcessor = new AnnotationProcessor();
public static AnnotationProcessor getInstance() {
return annotationProcessor;
}
private AnnotationProcessor() {
}
public List<Node> getValidAppInfoNodes(Element annotation) {
LinkedList<Node> validAppInfoNodeList = new LinkedList<Node>();
if (annotation == null) {
return validAppInfoNodeList;
}
String prefix = annotation.getPrefix();
NodeList appInfoNodes = annotation.getElementsByTagName(prefix + ":" + "appinfo");
int length = appInfoNodes.getLength();
for (int i = 0; i < length; ++i) {
Node appInfoNode = appInfoNodes.item(i);
String namespacePrefix = appInfoNode.lookupPrefix("http://www.adobe.com/in/marketing-cloud/enterprise-content-management.html");
Node source = appInfoNode.getAttributes().getNamedItem("source");
if (!source.getNodeValue().equals("http://www.adobe.com/in/marketing-cloud/enterprise-content-management.html") || namespacePrefix == null || namespacePrefix.isEmpty()) continue;
validAppInfoNodeList.add(appInfoNode);
}
return validAppInfoNodeList;
}
public Map<String, String> getProperties(Node appinfo) {
Hashtable<String, String> propertiesTable = new Hashtable<String, String>();
if (appinfo == null) {
return propertiesTable;
}
String prefix = appinfo.lookupPrefix("http://www.adobe.com/in/marketing-cloud/enterprise-content-management.html");
Node form = ((Element)appinfo).getElementsByTagName(prefix + ":" + "form").item(0);
if (form == null) {
return propertiesTable;
}
NodeList properties = form.getChildNodes();
int length = properties.getLength();
for (int i = 0; i < length; ++i) {
Node nameNode;
Node property = properties.item(i);
if (!property.getNodeName().equals(prefix + ":" + "afProperty") || (nameNode = property.getAttributes().getNamedItem("name")) == null) continue;
String value = property.getTextContent();
String name = nameNode.getNodeValue();
if (name == null || value == null || name.isEmpty() || value.isEmpty()) continue;
propertiesTable.put(name, value);
}
return propertiesTable;
}
}