Topic
No replies
MSTDevTeam
MSTDevTeam
4 Posts
ACCEPTED ANSWER

Pinned topic Version Update Issue after updating document content

‏2012-08-31T13:54:02Z |
We have an Item type configured to maintain versions for base document. Updating the document contents does update the content, however documetn content gets updated on the old PID and a new PID automatically gets created with empty content.

Below is the code we use for updating document content in CM8:

CMBConnection connection = new CMBConnection();
connection.setDsType(dataStoreType);
connection.setServerName(databaseName);
connection.setUserid(uName);
connection.setPassword(uPassword);
connection.connect();
CMBDataManagement dataManagement = connection.getDataManagement();
CMBObjectManagement objectManagement=connection.getObjectManagement();
CMBItem item=objectManagement.createItem(docID);
dataManagement.setDataObject(item);

if(!dataManagement.isCheckedOut())
dataManagement.checkOut();

CMBObject object = new CMBObject();
object.setMimeType("image/tiff");
object.setData(bos.toByteArray());
dataManagement.updateContent(0,object);