1 Reply Latest reply on Nov 24, 2016 2:57 AM by hchiorean

    DocumentWriter's setParents method

    adam.mccormick

      Hi,

       

      I'm curious about the DocumentWriter.setParents(String... parentIds) method. What is the purpose of setting multiple parent's for a node? Also; if a federated node has multiple parents what is it's effect on the behaviour of methods like node.getParent()?

       

      Thanks!

      -Adam

        • 1. Re: DocumentWriter's setParents method
          hchiorean

          Multiple parents (or the notion of a primary parent and additional parents) are a feature of JCR shared nodes.

           

          In the context of connectors, this is currently used by the CMIS connector https://github.com/ModeShape/modeshape/blob/master/connectors

          /modeshape-connector-cmis/src/main/java/org/modeshape/connector/cmis/CmisConnector.java#L791 It's unlikely that a "regular connector" would make use of this, but for CMIS it's required to be able to correctly translate a org.apache.chemistry.opencmis.client.api.Document into an external document.

           

          The getParent() method's behavior will vary based on the type of node: in most cases (including connectors) it will return the node's "primary parent" - this can only be one node and if you're using DocumentWriter#setParents( List<String> parentIds ) that will set the primary parent as the first element in the list. In the case of shared nodes however, getParent() will always take into account the shared set to which a node belongs (you can read more about shared nodes in the JCR 2.0 spec, 3.9)