AnsweredAssumed Answered

I created a child node but I cannot see it from its parent

Question asked by johnhelen on Mar 11, 2014
Latest reply on Mar 11, 2014 by mrogers
Hello

I create a child nodeRef from a parentNode by using the code


Map<QName, Serializable> reportProps = new HashMap<QName, Serializable>(4, 1.0f);
      reportProps.put(WCMAppModel.PROP_DEPLOYSERVER, serverUri);
      reportProps.put(WCMAppModel.PROP_DEPLOYVERSION, version);


NodeRef childNode = nodeService.createNode(parentNode,
                          WCMAppModel.ASSOC_DEPLOYMENTREPORTS, WCMAppModel.ASSOC_DEPLOYMENTREPORTS, WCMAppModel.TYPE_DEPLOYMENTREPORT, reportProps).getChildRef();



Now I want to know if the parentNode has a child nodeRef or not, I use this code:


List<ChildAssociationRef> children = nodeService.getChildAssocs(parentNode, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
          
      for (ChildAssociationRef childAssoc : children) {
          NodeRef childRef = childAssoc.getChildRef();
          logger.debug("Parent NodeRef has: " + childRef);
      }


I think that the size of children must be 1. However, children always empty
I did something wrong here to get the children nodes? Could you please help

Many thanks

Outcomes