Search in sources :

Example 1 with DeusNexDocument

use of fi.otavanopisto.muikku.plugins.dnm.parser.structure.DeusNexDocument in project muikku by otavanopisto.

the class DeusNexMachinaController method importDeusNexDocument.

public void importDeusNexDocument(WorkspaceNode parentNode, InputStream inputStream) throws DeusNexException {
    DeusNexDocument desNexDocument = parseDeusNexDocument(inputStream);
    List<WorkspaceNode> createdNodes = new ArrayList<>();
    for (Resource resource : desNexDocument.getRootFolder().getResources()) {
        importResource(parentNode, parentNode, resource, desNexDocument, createdNodes);
    }
    try {
        postProcessResources(createdNodes);
    } catch (Exception e) {
        throw new DeusNexInternalException("PostProcesssing failed. ", e);
    }
    materialUnEmbedder.unembedWorkspaceMaterials(parentNode);
}
Also used : DeusNexDocument(fi.otavanopisto.muikku.plugins.dnm.parser.structure.DeusNexDocument) DeusNexInternalException(fi.otavanopisto.muikku.plugins.dnm.parser.DeusNexInternalException) ArrayList(java.util.ArrayList) Resource(fi.otavanopisto.muikku.plugins.dnm.parser.structure.model.Resource) WorkspaceNode(fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceNode) XPathExpressionException(javax.xml.xpath.XPathExpressionException) SAXException(org.xml.sax.SAXException) TransformerException(javax.xml.transform.TransformerException) DeusNexException(fi.otavanopisto.muikku.plugins.dnm.parser.DeusNexException) IOException(java.io.IOException) DeusNexInternalException(fi.otavanopisto.muikku.plugins.dnm.parser.DeusNexInternalException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException)

Example 2 with DeusNexDocument

use of fi.otavanopisto.muikku.plugins.dnm.parser.structure.DeusNexDocument in project muikku by otavanopisto.

the class DeusNexMachinaController method importHelpPageDocument.

public void importHelpPageDocument(WorkspaceEntity workspaceEntity, InputStream inputStream) throws DeusNexException {
    DeusNexDocument deusNexDocument = parseDeusNexDocument(inputStream);
    List<Resource> resources = deusNexDocument.getRootFolder().getResources();
    if (!resources.isEmpty()) {
        List<WorkspaceNode> createdNodes = new ArrayList<>();
        WorkspaceFolder workspaceHelpPageFolder = workspaceMaterialController.createWorkspaceHelpPageFolder(workspaceEntity);
        for (Resource resource : deusNexDocument.getRootFolder().getResources()) {
            importResource(workspaceHelpPageFolder, workspaceHelpPageFolder, resource, deusNexDocument, createdNodes);
        }
        try {
            postProcessResources(createdNodes);
        } catch (Exception e) {
            throw new DeusNexInternalException("PostProcesssing failed. ", e);
        }
    }
}
Also used : DeusNexDocument(fi.otavanopisto.muikku.plugins.dnm.parser.structure.DeusNexDocument) DeusNexInternalException(fi.otavanopisto.muikku.plugins.dnm.parser.DeusNexInternalException) Resource(fi.otavanopisto.muikku.plugins.dnm.parser.structure.model.Resource) ArrayList(java.util.ArrayList) WorkspaceNode(fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceNode) XPathExpressionException(javax.xml.xpath.XPathExpressionException) SAXException(org.xml.sax.SAXException) TransformerException(javax.xml.transform.TransformerException) DeusNexException(fi.otavanopisto.muikku.plugins.dnm.parser.DeusNexException) IOException(java.io.IOException) DeusNexInternalException(fi.otavanopisto.muikku.plugins.dnm.parser.DeusNexInternalException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) WorkspaceFolder(fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceFolder)

Example 3 with DeusNexDocument

use of fi.otavanopisto.muikku.plugins.dnm.parser.structure.DeusNexDocument in project muikku by otavanopisto.

the class DeusNexMachinaController method importFrontPageDocument.

public void importFrontPageDocument(WorkspaceEntity workspaceEntity, InputStream inputStream) throws DeusNexException {
    DeusNexDocument deusNexDocument = parseDeusNexDocument(inputStream);
    List<Resource> resources = deusNexDocument.getRootFolder().getResources();
    if (!resources.isEmpty()) {
        List<WorkspaceNode> createdNodes = new ArrayList<>();
        WorkspaceFolder workspaceFrontPageFolder = workspaceMaterialController.createWorkspaceFrontPageFolder(workspaceEntity);
        for (Resource resource : deusNexDocument.getRootFolder().getResources()) {
            importResource(workspaceFrontPageFolder, workspaceFrontPageFolder, resource, deusNexDocument, createdNodes);
        }
        try {
            postProcessResources(createdNodes);
        } catch (Exception e) {
            throw new DeusNexInternalException("PostProcesssing failed. ", e);
        }
    }
}
Also used : DeusNexDocument(fi.otavanopisto.muikku.plugins.dnm.parser.structure.DeusNexDocument) DeusNexInternalException(fi.otavanopisto.muikku.plugins.dnm.parser.DeusNexInternalException) Resource(fi.otavanopisto.muikku.plugins.dnm.parser.structure.model.Resource) ArrayList(java.util.ArrayList) WorkspaceNode(fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceNode) XPathExpressionException(javax.xml.xpath.XPathExpressionException) SAXException(org.xml.sax.SAXException) TransformerException(javax.xml.transform.TransformerException) DeusNexException(fi.otavanopisto.muikku.plugins.dnm.parser.DeusNexException) IOException(java.io.IOException) DeusNexInternalException(fi.otavanopisto.muikku.plugins.dnm.parser.DeusNexInternalException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) WorkspaceFolder(fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceFolder)

Aggregations

DeusNexException (fi.otavanopisto.muikku.plugins.dnm.parser.DeusNexException)3 DeusNexInternalException (fi.otavanopisto.muikku.plugins.dnm.parser.DeusNexInternalException)3 DeusNexDocument (fi.otavanopisto.muikku.plugins.dnm.parser.structure.DeusNexDocument)3 Resource (fi.otavanopisto.muikku.plugins.dnm.parser.structure.model.Resource)3 WorkspaceNode (fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceNode)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)3 TransformerException (javax.xml.transform.TransformerException)3 XPathExpressionException (javax.xml.xpath.XPathExpressionException)3 SAXException (org.xml.sax.SAXException)3 WorkspaceFolder (fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceFolder)2