Search in sources :

Example 1 with DxlExporter

use of org.openntf.domino.DxlExporter in project org.openntf.domino by OpenNTF.

the class DatabaseDesign method loadDatabaseXml.

private void loadDatabaseXml() {
    DxlExporter exporter = getAncestorSession().createDxlExporter();
    exporter.setOutputDOCTYPE(false);
    NoteCollection nc = database_.createNoteCollection(false);
    nc.setSelectAcl(true);
    nc.setSelectIcon(true);
    nc.buildCollection();
    String xml = exporter.exportDxl(nc);
    databaseXml = loadDxl(xml);
}
Also used : DxlExporter(org.openntf.domino.DxlExporter) NoteCollection(org.openntf.domino.NoteCollection)

Example 2 with DxlExporter

use of org.openntf.domino.DxlExporter in project org.openntf.domino by OpenNTF.

the class Database method isDesignProtected.

public boolean isDesignProtected() {
    if (designProtected_ == null) {
        Document iconNote = getDocumentByID(org.openntf.domino.design.impl.DatabaseDesign.ICON_NOTE);
        designProtected_ = Boolean.FALSE;
        try {
            if (iconNote != null) {
                DxlExporter exporter = getAncestorSession().createDxlExporter();
                exporter.exportDxl(iconNote);
            }
        } catch (OpenNTFNotesException e) {
            designProtected_ = Boolean.TRUE;
        }
    }
    return designProtected_.booleanValue();
}
Also used : DxlExporter(org.openntf.domino.DxlExporter) OpenNTFNotesException(org.openntf.domino.exceptions.OpenNTFNotesException) Document(org.openntf.domino.Document)

Example 3 with DxlExporter

use of org.openntf.domino.DxlExporter in project org.openntf.domino by OpenNTF.

the class AbstractDesignBase method getDxl.

protected final XMLDocument getDxl() {
    if (dxl_ == null) {
        DxlExporter exporter = getAncestorSession().createDxlExporter();
        exporter.setOutputDOCTYPE(false);
        exporter.setForceNoteFormat(enforceRawFormat());
        // TODO: You will get an exporter error, if the design is protected. This should be handled correctly
        String xml = doExport(exporter);
        loadDxl(xml);
        if (dxl_ == null) {
            // $NON-NLS-1$
            throw new IllegalStateException(getClass().getSimpleName() + ": Could not load DXL");
        }
        XMLNode docRoot = getDocumentElement();
        if (docRoot.getNodeName() == "note") {
            // $NON-NLS-1$
            if (!enforceRawFormat()) {
                throw new UnsupportedOperationException(// $NON-NLS-1$
                getClass().getSimpleName() + ": got note in RAW format. this was not expected. NoteID " + // $NON-NLS-1$
                (document_ == null ? "" : document_.getNoteID()));
            }
            dxlFormat_ = DxlFormat.RAWNOTE;
        } else {
            if (enforceRawFormat()) {
                throw new UnsupportedOperationException(// $NON-NLS-1$
                getClass().getSimpleName() + ": Raw format was enforced, but we got a " + docRoot.getNodeName());
            }
            dxlFormat_ = DxlFormat.DXL;
        }
    }
    return dxl_;
}
Also used : DxlExporter(org.openntf.domino.DxlExporter) XMLNode(org.openntf.domino.utils.xml.XMLNode)

Aggregations

DxlExporter (org.openntf.domino.DxlExporter)3 Document (org.openntf.domino.Document)1 NoteCollection (org.openntf.domino.NoteCollection)1 OpenNTFNotesException (org.openntf.domino.exceptions.OpenNTFNotesException)1 XMLNode (org.openntf.domino.utils.xml.XMLNode)1