docs: public Pathref getPathrefFromNoderef(
              String layoutOwnerUsername, String dlmNoderef, org.dom4j.Element layout) {
  
          Validate.notNull(layoutOwnerUsername, "Argument 'layoutOwnerUsername' cannot be null.");
          Validate.notNull(dlmNoderef, "Argument 'dlmNoderef' cannot be null.");
  
          if (log.isTraceEnabled()) {
              StringBuilder msg = new StringBuilder();
              msg.append("createPathref: [layoutOwnerUsername='")
                      .append(layoutOwnerUsername)
                      .append("', dlmNoderef='")
                      .append(dlmNoderef)
                      .append("']");
              log.trace(msg.toString());
          }
  
          Pathref rslt = null; // default;  signifies we can't match a node
  
          final Matcher dlmNodeMatcher = DLM_NODE_PATTERN.matcher(dlmNoderef);
          if (dlmNodeMatcher.matches()) {
              final int userId = Integer.valueOf(dlmNodeMatcher.group(1));
              final String nodeId = dlmNodeMatcher.group(2);
  
              final String userName = this.userIdentityStore.getPortalUserName(userId);
              final Tuple<String, DistributedUserLayout> userLayoutInfo =
                      getUserLayoutTuple(userName, userId);
  
              if (userLayoutInfo.second == null) {
                  this.log.warn(
                          "no layout for fragment user '"
                                  + userLayoutInfo.first
                                  + "' Specified dlmNoderef "
                                  + dlmNoderef
                                  + " cannot be resolved.");
                  return null;
              }
  
              final Document fragmentLayout = userLayoutInfo.second.getLayout();
              final Node targetElement =
                      this.xPathOperations.evaluate(
                              "//*[@ID = $nodeId]",
                              Collections.singletonMap("nodeId", nodeId),
                              fragmentLayout,
                              XPathConstants.NODE);
  
              // We can only proceed if there's a valid match in the document
              if (targetElement != null) {
                  String xpath = this.xmlUtilities.getUniqueXPath(targetElement);
                  // Pathref objects that refer to portlets are expected to include
                  // the fname as the 3rd element; other pathref objects should leave
                  // that element blank.
                  String fname = null;
                  Node fnameAttr = targetElement.getAttributes().getNamedItem("fname");
                  if (fnameAttr != null) {
                      fname = fnameAttr.getTextContent();
                  }
  
                  rslt = new Pathref(userLayoutInfo.first, xpath, fname);
              }
          }
  
          final Matcher userNodeMatcher = USER_NODE_PATTERN.matcher(dlmNoderef);
          if (userNodeMatcher.find()) {
              // We need a pathref based on the new style of layout b/c on
              // import this users own layout will not be in the database
              // when the path is computed back to an Id...
              final String structId = userNodeMatcher.group(1);
              final org.dom4j.Node target = layout.selectSingleNode("//*[@ID = '" + structId + "']");
              if (target == null) {
                  this.log.warn(
                          "no match found on layout for user '"
                                  + layoutOwnerUsername
                                  + "' for the specified dlmNoderef:  "
                                  + dlmNoderef);
                  return null;
              }
  
              String fname = null;
              if (target.getName().equals("channel")) {
                  fname = target.valueOf("@fname");
              }
  
              rslt = new Pathref(layoutOwnerUsername, target.getUniquePath(), fname);
          }
  
          return rslt;
      }