I did not quite understand if I needed to create a new document or a new version of an existing document. Properties can be copied automatically for the newly created version, so version control looks more natural. For this:
// check out the document
Document currentVersion = .. // reference to existing document
currentVersion.checkout(ReservationType.EXCLUSIVE, null, null, null);
currentVersion.save(RefreshMode.REFRESH);
// obtain the reservation object (new version in progress)
newVersion = (com.filenet.api.core.Document) documentObject.get_Reservation();
// set content
InputStream inputStream = .. // obtain input stream with content
ContentElementList contentElements = Factory.ContentElement.createList();
ContentTransfer contentTransfer = Factory.ContentTransfer.createInstance();
contentTransfer.setCaptureSource(inputStream);
contentTransfer.set_RetrievalName("content name");
contentTransfer.set_ContentType("proper MIME type");
contentElements.add(contentTransfer);
newVersion.set_ContentElements(contentElements);
newVersion.checkin(AutoClassify.DO_NOT_AUTO_CLASSIFY, CheckinType.MINOR_VERSION);
newVersion.save(RefreshMode.NO_REFRESH);
// deleting obsolete version
currentVersion.delete();
currentVersion.save(RefreshMode.NO_REFRESH);
, ( , ), , .
, , , . , ( ).
, , :
: , - .
, , .