Clone Node in JAVA

Dear All,

I need to clone Node object in Java. I am using org.neo4j.graphdb.* library. Have gone through the documentation. Have found a way to clone Nodes in cypher, but am not able to do it in JAVA. Any help will be deeply appreciated.

Regards
Ankit

Something like this?

Node a = ...
Node b = tx.createNode(a.getLabels());
b.setProperties(a.getAllProperties());