cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

How to programmatically determine if a representation has an associated annotation.

Darrell
13-Aquamarine

How to programmatically determine if a representation has an associated annotation.

I haven't tried, but I think I could do it this way:

Starting with an EPMDoc, get the representation:

        VisualizationHelper vzh = VisualizationHelper.newVisualizationHelper();

QueryResult rep = vzh.getRepresentations((Persistable) epmDoc);

Then get content files in the rep:

        ContentHolder holder=ContentHelper.service.getContents(rep);

        Vector contents=ContentHelper.getContentListAll(holder);

Iterate through the vector: data=(ApplicationData)contents.get(i);

and check each filename (data.getFileName()) for the .ast extension which seems to be an annotation set.

Seems like there should be some simpler method. Anyone know a better way?

2 REPLIES 2
Darrell
13-Aquamarine
(To:Darrell)

I did some testing with the method I described above. I can get a list of the filenames in the rep, but it does not include annotation files. In the UI, when I save the rep I have the option of including annotations:

And I can save an annotation like I can save the rep:

But, I don't know how to use the VisualizationHelper and ContentHelper to do it.

Darrell
13-Aquamarine
(To:Darrell)

Figured it out. Used ViewMarkUpHelper.service:

boolean block;

block = false;

QueryResult qr = ViewMarkUpHelper.service.getMarkUps((Viewable)myrep);

while (qr.hasMoreElements()) {

Object object = qr.nextElement();

if (!(object instanceof WTMarkUp) || ((WTMarkUp)object).getMarkUpType() == MarkUpType.LANDMARK) continue;

block = true;

break;

}

Announcements

Top Tags