Hello Randy
Thanks for the response and suggestion! You're correct, I found the document item as parts in XDO collection.
------------------------------
Apurva Ramesh Mistry
------------------------------
Original Message:
Sent: Tue July 11, 2023 11:45 AM
From: Randy Richardt
Subject: Unable to retrieve documents using DB2 Content Manager API
Hi Apurva,
Looks like there is a mismatch between the your code and the classification of the item type you are using. It looks like you are accessing a document model item type. For these item types, the DKLob is not in the root of the item that is retrieved, it is in the collection of children. This is because document model items can hold multiple content files. See the SDocModelItemICM sample for full details:
https://www.ibm.com/docs/en/content-manager/8.7.0?topic=8-sdocmodelitemicmjava
------------------------------
Randy Richardt
Original Message:
Sent: Fri July 07, 2023 01:55 PM
From: Apurva Ramesh Mistry
Subject: Unable to retrieve documents using DB2 Content Manager API
Hello
I am creating an application to extract documents and metadata from Content Manager 8.6 and having issues with getting the resource item (document) from an Item.
I am querying an Item Type using CM8 query language and getting results of DKDDO objects. I can iterate over and retrieve the items atributes, but I am unable to get the associate resource item (document) from the DDO.
I am following the code sample SResourceItemRetrievalICM.java to retrieve the document. and first I am trying to create a blank DDO then getting DKLobICM object, that I will use to get the resource object in to a local file. I am getting stuck at class cast exception. Below is code snippet for retrieving resource item -
- Query the Item Type using CM8 query language and get the results of DKDDO objects
- Iterate over collection and able to retrieve the items attributes
- get the PID from the DDO
- Recreate XDO objects using PIDs from DDO
- String ddoPidString = ddo.getPidObject().pidString();
- DKLobICM lob = (DKLobICM) dsICM.createDDOFromPID(ddoPidString); (this throws class cast exception as its unable to convert DDO to DKLob type of object).
How do I proceed from here and which is the correct API approach to retrieve a document item along with its metadata.
I will appreciate any help.
------------------------------
Apurva M
------------------------------