use of org.jdom.output.Format in project entando-core by entando.
the class ShortcutDefDOM method getXMLDocument.
public String getXMLDocument() {
XMLOutputter out = new XMLOutputter();
Format format = Format.getPrettyFormat();
format.setIndent("\t");
out.setFormat(format);
return out.outputString(_doc);
}
use of org.jdom.output.Format in project entando-core by entando.
the class UserShortcutConfigDOM method createUserConfigXml.
protected static String createUserConfigXml(String[] config) throws ApsSystemException {
XMLOutputter out = new XMLOutputter();
Document document = new Document();
try {
Element rootElement = new Element(ROOT_ELEMENT_NAME);
document.setRootElement(rootElement);
for (int i = 0; i < config.length; i++) {
String shortcut = config[i];
if (null != shortcut) {
Element element = new Element(BOX_ELEMENT_NAME);
element.setAttribute(POS_ATTRIBUTE_NAME, String.valueOf(i));
element.setText(shortcut);
rootElement.addContent(element);
}
}
} catch (Throwable t) {
_logger.error("Error parsing user config", t);
// ApsSystemUtils.logThrowable(t, UserShortcutConfigDOM.class, "extractUserShortcutConfig");
throw new ApsSystemException("Error parsing user config", t);
}
Format format = Format.getPrettyFormat();
format.setIndent("\t");
out.setFormat(format);
return out.outputString(document);
}
use of org.jdom.output.Format in project entando-core by entando.
the class EntityTypeDOM method getXml.
@Override
public String getXml(IApsEntity entityType) throws ApsSystemException {
XMLOutputter out = new XMLOutputter();
Document document = new Document();
try {
Element entityTypeElement = this.createTypeElement(entityType);
document.setRootElement(entityTypeElement);
Format format = Format.getPrettyFormat();
format.setIndent("\t");
out.setFormat(format);
} catch (Throwable t) {
_logger.error("Error building xml", t);
throw new ApsSystemException("Error building xml", t);
}
return out.outputString(document);
}
use of org.jdom.output.Format in project entando-core by entando.
the class EntityTypeDOM method getXml.
@Override
public String getXml(Map<String, IApsEntity> entityTypes) throws ApsSystemException {
XMLOutputter out = new XMLOutputter();
Document document = new Document();
try {
Element rootElement = new Element(this.getEntityTypesRootElementName());
document.setRootElement(rootElement);
List<String> entityTypeCodes = new ArrayList<>(entityTypes.keySet());
Collections.sort(entityTypeCodes);
for (String entityTypeCode : entityTypeCodes) {
IApsEntity currentEntityType = entityTypes.get(entityTypeCode);
Element entityTypeElement = this.createTypeElement(currentEntityType);
rootElement.addContent(entityTypeElement);
}
Format format = Format.getPrettyFormat();
format.setIndent("\t");
out.setFormat(format);
} catch (Throwable t) {
_logger.error("Error building xml", t);
throw new ApsSystemException("Error building xml", t);
}
return out.outputString(document);
}
use of org.jdom.output.Format in project entando-core by entando.
the class PageExtraConfigDOM method getXMLDocument.
protected String getXMLDocument(Document doc) {
XMLOutputter out = new XMLOutputter();
Format format = Format.getPrettyFormat();
out.setFormat(format);
return out.outputString(doc);
}
Aggregations