I have a requirement to add annotations programmatically using Java code. I have tried it and can see the annotation applied for the document in the CPE, but when I open the same document in the ICN. I'm unable to view the annotation that was applied to the document. Here is the code.
ContentElementList docContentList = doc.get_ContentElements();
Integer elementSequenceNumber = ((ContentElement) docContentList.get(0)).get_ElementSequenceNumber();
Annotation annObject = Factory.Annotation.createInstance(os, "Annotation");
annObject.set_AnnotatedObject(doc);
annObject.set_AnnotatedContentElement(elementSequenceNumber.intValue() );
annObject.set_DescriptiveText("Annotation applied to the document's 1st content element.");
File annotationFile = new File("C:\\annotation.txt");
ContentTransfer ctObject = Factory.ContentTransfer.createInstance();
ContentElementList annContentList = Factory.ContentTransfer.createList();
try
{
FileInputStream fileIS = new FileInputStream(annotationFile.getAbsolutePath());
ctObject.setCaptureSource(fileIS);
}
catch (Exception e)
{
System.out.println(e.getMessage() );
}
annContentList.add(ctObject);
annObject.set_ContentElements(annContentList);
annObject.save(RefreshMode.REFRESH);
https://www.ibm.com/docs/en/filenet-p8-platform/5.2.1?topic=annotation-working-objects
Followed the above URL from IBM, Was I missing something here?
-------------------------------------------