protected void commit() { Presentations presentations = component.getPresentations(); Document doc = DocumentHelper.createDocument(); doc.setRootElement(doc.addElement("presentation")); component.saveSettings(doc.getRootElement()); String xml = Dom4j.writeDocument(doc, false); presentation.setXml(xml); presentation.setName(nameField.getValue()); presentation.setAutoSave(autoSaveField.getValue()); presentation.setDefault(defaultField.getValue()); User user = sessionSource.getUserSession().getCurrentOrSubstitutedUser(); boolean userOnly = !allowGlobalPresentations || !BooleanUtils.isTrue(globalField.getValue()); presentation.setUser(userOnly ? user : null); if (log.isTraceEnabled()) { log.trace(String.format("XML: %s", Dom4j.writeDocument(doc, true))); } if (isNew) { presentations.add(presentation); } else { presentations.modify(presentation); } presentations.commit(); addCloseListener(e -> { if (isNew) { component.applyPresentation(presentation.getId()); } }); }