Serialize this DBObjectBatch object into a UNode tree and return the root node.

@return  Root node of a UNode tree representing this batch update.
760913
public UNode toDoc() {
        // Root object is a MAP called "batch".
        UNode batchNode = UNode.createMapNode("batch");
        
        // Add a "docs" node as an array.
        UNode docsNode = batchNode.addArrayNode("docs");
        for (DBObject dbObj : m_dbObjList) {
            docsNode.addChildNode(dbObj.toDoc());
        }
        return batchNode;
    }
674027
@SuppressWarnings( "unchecked" )
    public <V> Key<V> getRoot() {
        if ( this.getParent() == null ) {
            return (Key<V>) this;
        } else {
            return this.getParent().getRoot();
        }
    }
1296500
public ITreeData getNode() {
        if (lastPointer.get(mRTX) != null && lastPointer.get(mRTX) < 0) {
            return atomics.get(mRTX).getItem(lastPointer.get(mRTX));
        } else {
            return mRTX.getNode();
        }
    }
520093
public Node getDOM()
    {
        Object root = m_message.getRawData();
        try {
            String packageName = (String)((TrxMessageHeader)this.getMessage().getMessageHeader()).get(SOAPMessageTransport.JIBX_PACKAGE_NAME);
            String bindingName = (String)((TrxMessageHeader)this.getMessage().getMessageHeader()).get(SOAPMessageTransport.JIBX_BINDING_NAME);
            if (bindingName == null)
            {
            	packageName = root.getClass().getName();
            	packageName = packageName.substring(0, packageName.lastIndexOf('.'));
            	((TrxMessageHeader)this.getMessage().getMessageHeader()).put(SOAPMessageTransport.JIBX_PACKAGE_NAME, packageName);
            }

            Node node = null;            
//            DocumentBuilder db = Util.getDocumentBuilder();
            Document doc = null;            
            
            IMarshallingContext mctx = JibxContexts.getJIBXContexts().getMarshaller(packageName, bindingName);
            if (mctx == null)
                return null;
            synchronized(mctx)
            {   // Since the marshaller is shared (may want to tweek this for multi-cpu implementations)
//?            	DomElementMapper domElementMapper  = new DomElementMapper();
//?            	m.marshalDocument(domElementMapper);
//?            	domElementMapper.marshal(root, m);
//?                IBindingFactory bfact = BindingDirectory.getFactory(clazz);
//?                IMarshallingContext mctx = bfact.createMarshallingContext();
                
            	String[] namespaces = JibxContexts.getJIBXContexts().get(packageName, bindingName).getFactory().getNamespaces();
                JDOMWriter jdomWriter = new JDOMWriter(namespaces);
                mctx.setXmlWriter(jdomWriter);
                mctx.marshalDocument(root);
                mctx.endDocument();
                
                org.jdom.Document jdoc = jdomWriter.getDocument();
                
                DOMOutputter dout = new DOMOutputter();
                doc = dout.output(jdoc);
            }
            node = doc.getDocumentElement();

            if (node != null)
                return node;
        } catch (JiBXException ex)   {
            ex.printStackTrace();
        } catch (java.lang.IllegalArgumentException ex)   {
            ex.printStackTrace();
        } catch (JDOMException e) {
			e.printStackTrace();
		}
        return super.getDOM();
    }
1330557
public Node getScopeRoot() {
    int roots = scopeRoots.size();
    if (roots > 0) {
      return scopeRoots.get(roots - 1);
    } else {
      AbstractScope<?, ?> s = scopes.peek();
      return s != null ? s.getRootNode() : null;
    }
  }
1282172
public UNode toDoc() {
        // Root node is a MAP and its name is the field name. Set its tag name to "field"
        // for XML.
        UNode fieldNode = UNode.createMapNode(m_name, "field");
        
        // Groups and non-groups are handled differently.
        if (m_type != FieldType.GROUP) {
            // Non-group: Add a "type" attribute, marked as an XML attribute.
            fieldNode.addValueNode("type", m_type.toString(), true);
            
            // Add 'collection', marked as an XML attribute.
            if (m_type.isLinkType() || m_bIsCollection) {
                fieldNode.addValueNode("collection", Boolean.toString(m_bIsCollection), true);
            }
            
            // Add 'analyzer' attribute, if specified, marked as an XML attribute.
            if (m_analyzerName != null) {
                fieldNode.addValueNode("analyzer", m_analyzerName, true);
            }
            
            // Add 'encoding' if applicable, marked as an XML attribute.
            if (m_type == FieldType.BINARY) {
                fieldNode.addValueNode("encoding", m_encoding.toString(), true);
            }
            
            // If this field is a link, add the 'inverse' and 'table' attributes, each
            // marked as XML attributes. Add the link field number only if it is being used.
            if (m_type.isLinkType()) {
                fieldNode.addValueNode("inverse", m_linkInverse, true);
                fieldNode.addValueNode("table", m_linkExtent, true);
            }
                
            // Add 'sharded' for link if true.
            if (m_type == FieldType.LINK && m_bIsSharded) {
                fieldNode.addValueNode("sharded", Boolean.toString(m_bIsSharded), true);
            }
            
            // Add 'junction' for xlink.
            if (m_type == FieldType.XLINK) {
                fieldNode.addValueNode("junction", m_junctionField, true);
            }
        } else {
            // Create a MAP node called "fields".
            assert m_nestedFieldMap.size() > 0;
            UNode fieldsNode = fieldNode.addMapNode("fields");
            
            // Recursing to nested fields, adding them as child nodes.
            for (FieldDefinition nestedFieldDef : getNestedFields()) {
                fieldsNode.addChildNode(nestedFieldDef.toDoc());
            }
        }
        return fieldNode;
    }
802587
@Override
    public String getRootFolderId() {
        if (rootNodeId == null) {
            Document layout = getUserLayoutDOM();

            Element rootNode =
                    this.xpathOperations.evaluate("//layout/folder", layout, XPathConstants.NODE);
            if (rootNode == null
                    || !rootNode.getAttribute(Constants.ATT_TYPE)
                            .equals(Constants.ROOT_FOLDER_ID)) {
                LOG.error(
                        "Unable to locate root node in layout of "
                                + owner.getUserName()
                                + ". Resetting corrupted layout.");
                resetLayout((String) null);

                rootNode =
                        this.xpathOperations.evaluate(
                                "//layout/folder", layout, XPathConstants.NODE);
                if (rootNode == null
                        || !rootNode.getAttribute(Constants.ATT_TYPE)
                                .equals(Constants.ROOT_FOLDER_ID)) {
                    throw new PortalException(
                            "Corrupted layout detected for "
                                    + owner.getUserName()
                                    + " and resetting layout failed.");
                }
            }
            rootNodeId = rootNode.getAttribute("ID");
        }
        return rootNodeId;
    }
994233
public TreeGraphNode highestNodeWithSameHead() {
    TreeGraphNode node = this;
    while (true) {
      TreeGraphNode parent = safeCast(node.parent());
      if (parent == null || parent.headWordNode() != node.headWordNode()) {
        return node;
      }
      node = parent;
    }
  }
1134956
public Throwable getRootCause() {
		
		Throwable rootCause = null;
		Throwable nextCause = getCause();
		
		while (nextCause != null && !nextCause.equals(rootCause)) {
			rootCause = nextCause;
			nextCause = nextCause.getCause();
		}
		
		return rootCause;
	}
58506
protected function getCurrentExpandedProjectionNode()
    {
        if (null === $this->rootNode) {
            $this->rootNode = $this->getRequest()->getRootProjectionNode();
        }
        $expandedProjectionNode = $this->rootNode;
        if (null === $expandedProjectionNode) {
            return null;
        } else {
            $segmentNames = $this->getLightStack();
            $depth = count($segmentNames);
            // $depth == 1 means serialization of root entry
            //(the resource identified by resource path) is going on,
            //so control won't get into the below for loop.
            //we will directly return the root node,
            //which is 'ExpandedProjectionNode'
            // for resource identified by resource path.
            if (0 != $depth) {
                for ($i = 2; $i < $depth; ++$i) {
                    $segName = $segmentNames[$i]['prop'];
                    $expandedProjectionNode = $expandedProjectionNode->findNode($segName);
                    if (null === $expandedProjectionNode) {
                        throw new InvalidOperationException('is_null($expandedProjectionNode)');
                    }
                    if (!$expandedProjectionNode instanceof ExpandedProjectionNode) {
                        $msg = '$expandedProjectionNode not instanceof ExpandedProjectionNode';
                        throw new InvalidOperationException($msg);
                    }
                }
            }
        }

        return $expandedProjectionNode;
    }
55902
protected int getNextNode()
  {
    if (null != m_exprObj)
    {
      m_lastFetched = m_exprObj.nextNode();
    }
    else
      m_lastFetched = DTM.NULL;

    return m_lastFetched;
  }
1224107
private INode findRoot() {
        for (INode node : nodes.values()) {
            if (!node.hasParent() && !BASE_NODE.equals(node.getNodeData().getName())) {
                return node;
            }
        }
        return null;
    }
818965
public Node getCurrentNode()
  {

    if (!m_cacheNodes)
      throw new RuntimeException(
        XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_CANNOT_INDEX, null)); //"This NodeSet can not do indexing or counting functions!");

    int saved = m_next;
    Node n = (m_next < m_firstFree) ? elementAt(m_next) : null;
    m_next = saved; // HACK: I think this is a bit of a hack.  -sb
    return n;
  }
763702
private ViewNode getRootViewNode(HttpServletRequest request) throws Exception {
    String rooNodeID = getRootNodeID(request);
    if (rooNodeID == null){
      Debug.logError("[JdonFramework] root Id is null ! " , module);
      return null;
    }
    Debug.logVerbose("[JdonFramework] get the tree's root Node: " + rooNodeID, module);
    ViewNode rNode = new ViewNode(rooNodeID, rooNodeID, true);
    rNode.setRoot(true);
    return rNode;
  }
1278255
public Optional<String> getRoot() {
        final LinkedList<String> uuids = context.get();
        return uuids.isEmpty()
                ? Optional.empty()
                : Optional.of(uuids.getLast());
    }
1125546
public NodeData getVersionableAncestor() throws RepositoryException
   {
      checkValid();
      NodeData node = nodeData();
      NodeTypeDataManager ntman = session.getWorkspace().getNodeTypesHolder();

      while (node.getParentIdentifier() != null)
      {
         if (ntman.isNodeType(Constants.MIX_VERSIONABLE, node.getPrimaryTypeName(), node.getMixinTypeNames()))
         {
            // mix:versionable has own jcr:isCheckedOut state
            return node;
         }
         else
         {
            // check on deeper ancestor
            NodeData ancestor = (NodeData)dataManager.getItemData(node.getParentIdentifier());
            if (ancestor == null)
            {
               throw new RepositoryException("Parent not found for "
                  + locationFactory.createJCRPath(node.getQPath()).getAsString(false) + ". Parent id "
                  + node.getParentIdentifier());
            }
            else
            {
               node = ancestor;
            }
         }
      }

      return null;
   }
446436
public function getRootId()
    {
        if (self::$rootId !== null) {
            return self::$rootId;
        }

        // Get the root item.
        $k = $this->getKeyName();

        // Test for a unique record with parent_id = 0
        $query = $this->db->getQuery(true)
            ->select($k)
            ->from($this->db->quoteName($this->table))
            ->where('parent_id = 0');

        $result = $this->db->setQuery($query)->loadColumn();

        if (count($result) == 1) {
            return self::$rootId = $result[0];
        }

        // Test for a unique record with lft = 0
        $query->clear()
            ->select($k)
            ->from($this->db->quoteName($this->table))
            ->where('lft = 0');

        $result = $this->db->setQuery($query)->loadColumn();

        if (count($result) == 1) {
            return self::$rootId = $result[0];
        }

        throw new NestedHandleException(sprintf('%s::getRootId', get_class($this)));
    }