Document is a version object. When we first create and check in a new document, we initialize a new version, after editing this version check out, we get a new version of this document. The following describes how to add the document content and retain the content of the previous version document during the document version change process. [Java] <span style = "font-size: 12px;"> </span> <span style = "font-size: 14px;"> Connection conn = CEHelper. getConnection (); CEHelper. pushSubject (conn, "Administrator", "filenet"); ObjectStore OS = CEHelper. getObjectStore (conn); Document doc = Factory. document. fetchInstance (OS, new Id ("{1FC02DF6-7EDE-49BE-998A-801BB6012C75}"), null); Document doc0 = Factory. document. fetchInstance (OS, new Id ("{1FC02DF6-7E DE-49BE-998A-801BB6012C75} "), null); logger.info (! Doc. get_IsReserved (); if (! Doc. get_IsCurrentVersion () {doc = (Document) doc. get_CurrentVersion (); doc0 = (Document) doc. get_CurrentVersion ();} logger.info (! Doc. get_IsReserved (); if (! Doc. get_IsReserved () {doc. checkout (ReservationType. EXCLUSIVE, null, null, doc. getProperties (); doc. save (RefreshMode. REFRESH);} doc = (Document) doc. get_Reservation (); logger.info (! Doc. get_IsReserved (); ContentElementList oldCEL = doc. get_ContentElements (); logger.info (String. valueOf (oldCEL. size (); ContentElementList newCEL = Factory. contentElement. createList (); ContentTransfer ct = Factory. contentTransfer. createInstance (); try {ct. setCaptureSource (new FileInputStream ("c: \ log4j1. log ");} catch (FileNotFoundException e) {e. printStackTrace ();} newCEL. add (ct); logger.info (do C0.get _ ContentElements (). size (); InputStream is = doc0.accessContentStream (0); ContentTransfer ct2 = Factory. contentTransfer. createInstance (); ct2.setCaptureSource (is); newCEL. add (ct2); InputStream is3 = doc0.accessContentStream (1); ContentTransfer ct3 = Factory. contentTransfer. createInstance (); ct3.setCaptureSource (is3); newCEL. add (ct3); InputStream is4 = doc0.accessContentStream (1); ContentTran Sfer ct4 = Factory. contentTransfer. createInstance (); ct4.setCaptureSource (is4); newCEL. add (ct4); doc. set_ContentElements (newCEL); doc. save (RefreshMode. REFRESH); doc. checkin (AutoClassify. DO_NOT_AUTO_CLASSIFY, CheckinType. MAJOR_VERSION); doc. save (RefreshMode. REFRESH); CEHelper. popSubject (); </span> during the preceding operations, you must obtain the current version of the document and check it out to the Reservation version to change its content ). When obtaining the content of a previous version, do not directly reference its ContentTransfer, but retrieve its accessContentStream to recreate ContentTransfer to complete the setting of the document content.