Search in sources :

Example 11 with ChildInfo

use of org.apache.jackrabbit.spi.ChildInfo in project jackrabbit by apache.

the class ItemInfoJsonHandler method endObject.

public void endObject() throws IOException {
    try {
        NodeInfoImpl nInfo = (NodeInfoImpl) nodeInfos.pop();
        List<PropertyInfoImpl> props = propInfoLists.pop();
        // all required information to create a node info should now be gathered
        nInfo.setPropertyInfos(props.toArray(new PropertyInfoImpl[props.size()]), idFactory);
        NodeInfo parent = getCurrentNodeInfo();
        if (parent != null) {
            if (nInfo.getPath().getAncestor(1).equals(parent.getPath())) {
                ChildInfo ci = new ChildInfoImpl(nInfo.getName(), nInfo.getUniqueID(), nInfo.getIndex());
                ((NodeInfoImpl) parent).addChildInfo(ci);
            } else {
                log.debug("NodeInfo '" + nInfo.getPath() + "' out of hierarchy. Parent path = " + parent.getPath());
            }
        }
        if (nInfo.isCompleted()) {
            itemInfos.addAll(props);
            itemInfos.add(nInfo);
        } else {
            log.debug("Incomplete NodeInfo '" + nInfo.getPath() + "' -> Only present as ChildInfo with its parent.");
        }
    } catch (RepositoryException e) {
        throw new IOException(e.getMessage());
    } finally {
        // reset all node-related handler state
        name = null;
        index = Path.INDEX_DEFAULT;
    }
}
Also used : NodeInfo(org.apache.jackrabbit.spi.NodeInfo) ChildInfo(org.apache.jackrabbit.spi.ChildInfo) RepositoryException(javax.jcr.RepositoryException) IOException(java.io.IOException)

Aggregations

ChildInfo (org.apache.jackrabbit.spi.ChildInfo)11 NodeId (org.apache.jackrabbit.spi.NodeId)5 ArrayList (java.util.ArrayList)4 RepositoryException (javax.jcr.RepositoryException)3 Batch (org.apache.jackrabbit.spi.Batch)3 IOException (java.io.IOException)2 NodeInfo (org.apache.jackrabbit.spi.NodeInfo)2 PropertyId (org.apache.jackrabbit.spi.PropertyId)2 Serializable (java.io.Serializable)1 ItemExistsException (javax.jcr.ItemExistsException)1 ItemNotFoundException (javax.jcr.ItemNotFoundException)1 NodeIterator (javax.jcr.NodeIterator)1 HttpResponse (org.apache.http.HttpResponse)1 NodeEntry (org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry)1 ItemInfo (org.apache.jackrabbit.spi.ItemInfo)1 Name (org.apache.jackrabbit.spi.Name)1 Path (org.apache.jackrabbit.spi.Path)1 NameException (org.apache.jackrabbit.spi.commons.conversion.NameException)1 DavException (org.apache.jackrabbit.webdav.DavException)1 MultiStatusResponse (org.apache.jackrabbit.webdav.MultiStatusResponse)1