Notes document in a JAVA List

Hi,

I don’t know how to manage notes document in a JAVA list… it’s so trivial in LotusScript and so hard in JAVA… what’s wrong with my code???

Document doc = view.getFirstDocument();

List list = new LinkedList();

list = new ArrayList();

while (doc != null) {

importDocument(doc) ;

list.add(doc);

doc = view.getNextDocument(doc);

}

int size = list.size(); // 2

for(int i = 0; i<size;i++){

 Document docu = list.get(i);

docu.replaceItemValue("isTreated","1") ;

}

Subject: Notes document in a JAVA List

Hi

First of all there is no need to put all the documents in a list first.

Why not handle them in the loop?

I have not tested your code but one thing that comes to mind is

you need to cast the object you get from the list to a Document.

Document docu = (Document) list.get(i);

brgds

Jesper Kiær

http://www.jezzper.com

Subject: RE: Notes document in a JAVA List

it works ! great…i don’t do it in the first loop because the updated field is part of the view selction… so I process it in a post process part…

thanks again and greetings from switzerland

Subject: RE: Notes document in a JAVA List

And if you are going to throw the documents to a container, why not a DocumentCollection? At least that way you can use stampAll() to update the isTreated field (which will be faster than updating and saving individual documents).

Subject: RE: Notes document in a JAVA List

YES ! one point for you Stan !