Copying a document in Java classes

Use copyToDatabase to copy a document to a specified database (which can be the same database in which the document exists).