public NodeId getId() throws InvalidItemStateException, RepositoryException {
IdFactory idFactory = getIdFactory();
if (uniqueID != null) {
return idFactory.createNodeId(uniqueID);
} else {
PathFactory pf = getPathFactory();
if (parent == null) {
// root node
return idFactory.createNodeId((String) null, pf.getRootPath());
} else {
Path p = pf.create(getName(), getIndex());
return idFactory.createNodeId(parent.getId(), p);
}
}
}