code: public String getId(Node node) {
          String id = null;
          try {
              id = node.getIdentifier();
          } catch (RepositoryException e) {
              id = node.toString(); // use Java 'ID'
          }
          return id;
      }
docs: Retrieves the nodes id.
  
  @return a hopefully useful ID (not <code>null</code>)