documentumdocumentum-dfc

How can I get the number of contents of a dm_document?


I am trying to add a new content to my dm_document with the DFCMethod :

myDocument.setContentEx(myByteArrayOutpuStream, myContentExtension, pageNumber)

However, when I add this content, I don't know if there are other contents already added to this dm_document object. In other words, I don't know the value of the pageNumber parameter. I did not find any method such as a getLastContentIndex to perform on my dm_document.

How can I know the value to give for the parameter ?


Solution

  • The method your are looking for is int getPageCount(). You can also get the main content format (content type) name by the method String getContentType().

    Then you can use received values as parameters in a call of the ByteArrayInputStream getContentEx(String format, int pageNumber) metod which gets the document content from the repository for the given format and page number.

    By the boolean setContentEx(ByteArrayOutputStream content, String format, int pageNumber) method of IDfSysObject you can set primary content as multiple pages. But all pages must be in the same format. If you try to use the method with a different format then it will overwrite the previous content.