Search in sources :

Example 1 with LotusScriptLibrary

use of org.openntf.nsfodp.commons.odp.LotusScriptLibrary in project org.openntf.nsfodp by OpenNTF.

the class ODPCompiler method importLotusScriptLibraries.

private void importLotusScriptLibraries(NDXLImporter importer, NDatabase database) throws Exception {
    subTask(Messages.ODPCompiler_importingLotusScript);
    List<Integer> noteIds = new ArrayList<>();
    for (LotusScriptLibrary lib : odp.getLotusScriptLibraries()) {
        Document dxlDoc = lib.getDxl();
        String script = lib.getSource();
        int chunkSize = 60 * 1024;
        for (int startIndex = 0; startIndex < script.length(); startIndex += chunkSize) {
            int endIndex = Math.min(startIndex + chunkSize, script.length());
            String scriptChunk = script.substring(startIndex, endIndex);
            // $NON-NLS-1$
            Element el = DXLUtil.writeItemString(dxlDoc, "$ScriptLib", false, scriptChunk);
            // $NON-NLS-1$ //$NON-NLS-2$
            el.setAttribute("sign", "true");
            // $NON-NLS-1$ //$NON-NLS-2$
            el.setAttribute("summary", "false");
        }
        noteIds.addAll(importDxl(importer, NSFODPDomUtil.getXmlString(dxlDoc, null), database, MessageFormat.format(Messages.ODPCompiler_lotusScriptLabel, odp.getBaseDirectory().relativize(lib.getDataFile()))));
    }
    compileLotusScript(database, noteIds, true);
}
Also used : LotusScriptLibrary(org.openntf.nsfodp.commons.odp.LotusScriptLibrary) AbstractSplitDesignElement(org.openntf.nsfodp.commons.odp.AbstractSplitDesignElement) Element(org.w3c.dom.Element) ArrayList(java.util.ArrayList) Document(org.w3c.dom.Document)

Aggregations

ArrayList (java.util.ArrayList)1 AbstractSplitDesignElement (org.openntf.nsfodp.commons.odp.AbstractSplitDesignElement)1 LotusScriptLibrary (org.openntf.nsfodp.commons.odp.LotusScriptLibrary)1 Document (org.w3c.dom.Document)1 Element (org.w3c.dom.Element)1