Hi team,
I am writing UpdateDocument service in Java, for the update done in the document. In the service, I am trying to put the logic to save/update the content.
By using the IBM docs, I tried to develop a logic, but it's not updating the content in the document. Can you please help to identify the problem and rectify it.
Code:
DKParts dkParts = null;
short dataId = ddo.dataId(DKConstant.DK_CM_NAMESPACE_ATTR, DKConstant.DK_CM_DKPARTS);
if (dataId == 0) {
dataId = ddo.addData(DKConstant.DK_CM_NAMESPACE_ATTR, DKConstantICM.DK_CM_DKPARTS);
dkParts = new DKParts();
ddo.setData(dataId, dkParts);
} else {
dkParts = (DKParts)ddo.getData(dataId);
if (dkParts == null) {
dkParts = new DKParts();
ddo.setData(dataId, dkParts);
}
}
DKLobICM icmbase = (DKLobICM) datastoreICM.createDDO("ICMBASE", DKConstantICM.DK_ICM_SEMANTIC_TYPE_BASE);
icmbase.setContentFromClientFile(tmp.getAbsolutePath());
String mimeType = request.getObject().getMimetype();
if (mimeType != null && !"".equalsIgnoreCase(mimeType.trim())){
icmbase.setMimeType(mimeType);
}else{
icmbase.setMimeType(DEFAULT_MIMETYPE_APPLICATION_OCTET_STREAM);
}
icmbase.setPartNumber(2);
dkParts.addElement((dkDataObjectBase)((DKDDO)icmbase));
ddo.update();
------------------------------
Sanket Fating
------------------------------