Package org.structr.web.entity.dom

Examples of org.structr.web.entity.dom.DOMNode


        getWebSocket().send(MessageBuilder.status().code(422).message("Cannot replace node without parentId").build(), true);   
        return;
      }

      // check if parent node with given ID exists
      DOMNode parentNode = getDOMNode(parentId);
      if (parentNode == null) {
   
        getWebSocket().send(MessageBuilder.status().code(404).message("Parent node not found").build(), true);   
        return;
      }

      // check for old ID before creating any nodes
      if (oldId == null) {
   
        getWebSocket().send(MessageBuilder.status().code(422).message("Cannot replace node without oldId").build(), true);
        return;
      }

      // check if old node with given ID exists
      DOMNode oldNode = getDOMNode(oldId);
      if (oldNode == null) {
   
        getWebSocket().send(MessageBuilder.status().code(404).message("Old node not found").build(), true);   
        return;
      }

      // check for new ID before creating any nodes
      if (newId == null) {
   
        getWebSocket().send(MessageBuilder.status().code(422).message("Cannot replace node without newId").build(), true);
        return;
      }

      // check if new node with given ID exists
      DOMNode newNode = getDOMNode(newId);
      if (newNode == null) {
   
        getWebSocket().send(MessageBuilder.status().code(404).message("New node not found").build(), true);   
        return;
      }
View Full Code Here


    Map<String, Object> nodeData          = webSocketData.getNodeData();
    String parentId                       = (String) nodeData.get("parentId");

    if (id != null) {

      final DOMNode node = getDOMNode(id);

      if (parentId == null) {

        getWebSocket().send(MessageBuilder.status().code(422).message("Cannot clone node without parentId").build(), true);

        return;

      }

      // check if parent node with given ID exists
      final DOMNode parent = getDOMNode(parentId);

      if (parent == null) {

        getWebSocket().send(MessageBuilder.status().code(404).message("Parent node not found").build(), true);

        return;

      }

      try {
        DOMNode clonedNode = (DOMNode) node.cloneNode(false);
        parent.appendChild(clonedNode);
        clonedNode.setProperty(DOMNode.ownerDocument, parent.getProperty(DOMNode.ownerDocument));

      } catch (FrameworkException ex) {

        // send DOM exception
        getWebSocket().send(MessageBuilder.status().code(422).message(ex.getMessage()).build(), true);
View Full Code Here

    String parentId                      = (String) properties.get("id");
    final Map<String, Object> relData    = webSocketData.getRelData();

    if (parentId != null) {

      DOMNode parentNode        = (DOMNode) getNode(parentId);
      DOMNode nodeToInsert      = null;

      try {

        PropertyMap nodeProperties = PropertyMap.inputTypeToJavaType(securityContext, properties);
View Full Code Here

        getWebSocket().send(MessageBuilder.status().code(422).message("Cannot add node without parentId").build(), true);   
        return;
      }

      // check if content node with given ID exists
      final DOMNode contentNode = getDOMNode(parentId);
      if (contentNode == null) {
   
        getWebSocket().send(MessageBuilder.status().code(404).message("Parent node not found").build(), true);   
        return;
      }
     
      final Document document = getPage(pageId);
      if (document != null) {

        final String tagName  = (String) nodeData.get("tagName");
        nodeData.remove("tagName");
       
        final DOMNode parentNode = (DOMNode) contentNode.getParentNode();

       
        try {

          DOMNode elementNode = null;
          if (tagName != null && !tagName.isEmpty()) {

            elementNode = (DOMNode) document.createElement(tagName);

          }

          // append new node to parent parent node
          if (elementNode != null) {

            parentNode.appendChild(elementNode);

          }
         
          // append new node to parent parent node
          if (elementNode != null) {

            // append content node to new node
            elementNode.appendChild(contentNode);

          }

        } catch (DOMException dex) {
           
View Full Code Here

      // Filter list and return only top level nodes
      for (GraphObject obj : resultList) {

        if (obj instanceof DOMNode) {

          DOMNode node = (DOMNode) obj;

          if (!doc.equals(node) && !node.hasIncomingRelationships(DOMChildren.class)) {
           
            filteredResults.add(node);

          }
View Full Code Here

TOP

Related Classes of org.structr.web.entity.dom.DOMNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.