/**
* A xsl-for-output document.
*/
- private Document xslt;
- private Element xslRoot;
+ private Document xslt = null;
+ private Element xslRoot = null;
/**
* Constructor.
}
/**
+ * Gets a {@link Document}.
+ *
+ * @return a {@link Document}
+ */
+ public Element getXsltForOutputElement() {
+ return xslRoot;
+ }
+
+ /**
* Parses a descriptor XML.
*
* @param descriptorPath
* a path of descriptor XML
*/
+ @SuppressWarnings("deprecation")
public void parse(URL descriptorPath) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
e.printStackTrace();
}
- xslRoot = doc.createElement("xsl:stylesheet");
- xslRoot.setAttribute("xmlns:xsl", XSLT_NAMESPACE);
- xslRoot.setAttribute(ATTR_STYLESHEET_VERSION, VALUE_STYLESHEET_VERSION);
-
if (doc != null && doc.getDocumentElement() != null) {
+ xslRoot = doc.createElement("xsl:stylesheet");
+ xslRoot.setAttribute("xmlns:xsl", XSLT_NAMESPACE);
+ xslRoot.setAttribute(ATTR_STYLESHEET_VERSION, VALUE_STYLESHEET_VERSION);
+ //doc.getDocumentElement().appendChild(xslRoot);
+
parseRoot(doc.getDocumentElement());
- }
- xslt = builder.newDocument();
- xslt.appendChild(xslt.importNode(xslRoot, true));
+ xslt = builder.newDocument();
+ xslt.appendChild(xslt.adoptNode(xslRoot));
+ }
// TODO: Temporary code. Expected to be simplified.
TransformerFactory transFactory = TransformerFactory.newInstance();
} catch (IOException e) {
e.printStackTrace();
}
+
}
/**
String childXpath = elem.getAttribute(ATTR_CHILDXPATH);
boolean boolpaletteVisible = true;
- if (paletteVisible != null) {
+ if (paletteVisible != null && !paletteVisible.isEmpty()) {
boolpaletteVisible = Boolean.parseBoolean(paletteVisible);
}
boolean boolBorderVisible = Boolean.parseBoolean(borderVisible);
if (part instanceof WidgetPartDescriptor) {
String categories = elem.getAttribute(ATTR_CATEGORY);
- if (categories != null) {
+ if (categories != null && !categories.isEmpty()) {
String[] categoriesArray = categories
.split(BuilderConstants.COMMA);
((WidgetPartDescriptor) part).setCategories(Arrays
}
}
- //parseXsltForOutput(elem);
-
manager.addPartDescriptor(part);
}
String excludeIds = elem.getAttribute(ATTR_EXCLUDE_IDS);
String parentIds = elem.getAttribute(ATTR_PARENT_IDS);
- if (excludeIds != null) {
+ if (excludeIds != null && !excludeIds.isEmpty()) {
relation.addNoContentPartIds(excludeIds);
}
- if (parentIds != null) {
+ if (parentIds != null && !parentIds.isEmpty()) {
relation.addParentPartIds(parentIds);
}
}
ContentDescriptor content = new ContentDescriptor();
content.setPartType(partType);
- if (ids != null) {
+ if (ids != null && !ids.isEmpty()) {
content.setPartIds(ids);
}
if (min != null && !min.isEmpty()) {