GuideModelUtils.java
2.13 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:
* org.apache.commons.lang.StringUtils
* org.apache.sling.api.resource.Resource
* org.apache.sling.api.resource.ValueMap
* org.apache.sling.commons.json.JSONException
* org.apache.sling.commons.json.JSONObject
*/
package com.adobe.aemds.guide.utils;
import com.adobe.aemds.guide.utils.XMLUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.JSONObject;
import org.w3c.dom.Document;
public class GuideModelUtils {
public static String getDataForDORMerge(Document dorDoc, Document dataDocument, JSONObject guideContainerJson) throws JSONException {
String xdpRef = guideContainerJson.has("xdpRef") ? guideContainerJson.getString("xdpRef") : null;
String xsdRef = guideContainerJson.has("xsdRef") ? guideContainerJson.getString("xsdRef") : null;
String excludeFromDorIfHidden = guideContainerJson.has("excludeFromDoRIfHidden") ? guideContainerJson.getString("excludeFromDoRIfHidden") : null;
return GuideModelUtils.getDataForDORMerge(dorDoc, dataDocument, xdpRef, xsdRef, excludeFromDorIfHidden);
}
public static String getDataForDORMerge(Document dorDoc, Document dataDocument, Resource guideContainerResource) {
ValueMap guideContainerProps = guideContainerResource.getValueMap();
String xdpRef = (String)guideContainerProps.get("xdpRef", String.class);
String xsdRef = (String)guideContainerProps.get("xsdRef", String.class);
String excludeFromDorIfHidden = (String)guideContainerProps.get("excludeFromDoRIfHidden", String.class);
return GuideModelUtils.getDataForDORMerge(dorDoc, dataDocument, xdpRef, xsdRef, excludeFromDorIfHidden);
}
private static String getDataForDORMerge(Document dorDoc, Document dataDocument, String xdpRef, String xsdRef, String excludeFromDorIfHidden) {
return XMLUtils.getDorDataXmlPart(dorDoc, dataDocument, excludeFromDorIfHidden, StringUtils.isEmpty((String)xdpRef));
}
}