code: public static String nodeIdentifier( NodeKey key,
                                           NodeKey rootKey ) {
          return isForeignKey(key, rootKey) ? key.toString() : key.getIdentifier();
      }
docs: Returns a string representing a node's identifier, based on whether the node is foreign or not.
  
  @param key the node key; may be null
  @param rootKey the key of the root node in the workspace; may not be null
  @return the identifier for the node; never null
  @see javax.jcr.Node#getIdentifier()