Content Management and Capture

 View Only
  • 1.  Batch export of Documents + their Annotations

    Posted Tue April 30, 2024 03:38 PM

    Good afternoon,

    I am being tasked with a rather weird request. The customer agency is wanting to extract all documents they have in their object store and place them into a folder structure based on the document ID's. That part seems simple enough and I should be able to do it by just creating document objects in java based on the search.fetchObjects() functionality (1 below). What I'm struggling with is how would I extract annotations from those documents? Some of these documents have a large number of annotations attached to them and the ACCE tool is able to export them in a fashion like (2 below) but I haven't found any information on if that is possible via a java method. I have tried using the AnnotationSet object and iterating through each Annotation stored in that object but it doesn't seem to contain any information similar to the example 2 below. In example 3, I have provided a small snippet of code to emulate what I've tried so far. I would greatly appreciate any/all suggestions on how we could satisfy the customer query without going through each document 1-by-1 in ACCE.

    1. DocumentSet docs = (DocumentSet) search.fetchObjects(sqlObject, null, null, Boolean.TRUE);

    2. 

    <FnAnno>
        <PropDesc F_ANNOTATEDID="{REDACTED}" F_BACKCOLOR="REDACTED" F_BORDER_BACKMODE="REDACTED" F_BORDER_COLOR="REDACTED" F_BORDER_STYLE="REDACTED" F_BORDER_WIDTH="REDACTED" F_CLASSID="{REDACTED}" F_CLASSNAME="REDACTED" F_CREATOR="REDACTED" F_ENTRYDATE="REDACTED" F_FONT_BOLD="REDACTED" F_FONT_ITALIC="REDACTED" F_FONT_NAME="REDACTED" F_FONT_SIZE="REDACTED" F_FONT_STRIKETHROUGH="REDACTED" F_FONT_UNDERLINE="REDACTED" F_FORECOLOR="REDACTED" F_HASBORDER="REDACTED" F_HEIGHT="REDACTED" F_ID="{REDACTED}" F_LEFT="REDACTED" F_MODIFYDATE="REDACTED" F_MULTIPAGETIFFPAGENUMBER="REDACTED" F_NAME="REDACTED" F_PAGENUMBER="REDACTED" F_ROTATION="REDACTED" F_TEXT_BACKMODE="REDACTED" F_TOOLTIP="REDACTED" F_TOOLTIPTRANSFERENCODING="REDACTED" F_TOP="REDACTED" F_WIDTH="REDACTED">
            <F_CUSTOM_BYTES/>
            <F_POINTS/>
            <F_TEXT Encoding="unicode">[REDACTED]</F_TEXT>
        </PropDesc>
    </FnAnno>

    3.

    try {
    DocumentSet docs = (DocumentSet) search.fetchObjects(sqlObject, null, null, Boolean.TRUE);
    Document doc = null;
    Iterator<Document> docIt = docs.iterator();
    while (docIt.hasNext()) {
    doc = docIt.next(); 
    iterator++;
    com.filenet.api.property.Properties props = doc.getProperties();
    AnnotationSet as = doc.get_Annotations();
    Iterator iter = as.iterator();
    while(iter.hasNext()) {
    Annotation annObject = (Annotation) iter.next();
    }


    ------------------------------
    Christopher Hegel
    ------------------------------


  • 2.  RE: Batch export of Documents + their Annotations
    Best Answer

    IBM Champion
    Posted Wed May 01, 2024 08:19 AM

    If memory serves, annotations objects are, effectively, a special case of a document. Therefore the XML is retrieved off them as a content element. The access content stream method on the annotation object should get you an input stream to the XML.

    https://www.ibm.com/docs/en/filenet-p8-platform/5.5.12?topic=comfilenetapicore-annotation



    ------------------------------
    Eric Walk
    Director

    O: 617-453-9983 | NASDAQ: PRFT | Perficient.com
    ------------------------------



  • 3.  RE: Batch export of Documents + their Annotations

    Posted Wed May 01, 2024 11:44 AM

    That seems to have worked! Thank you!!



    ------------------------------
    Christopher Hegel
    ------------------------------