1
votes

I am using a local database in my version of Lotus notes(8.5.2), and I am trying to get the data for two things:

  1. The highlighted document/item in a NotesUIView
  2. The document selected in a NotesUIDocument

However, all I get are the Notes URLs and I don't know what I should do with those. Can anyone help me out/throw me a breadcrumb?

P.S. Yes I am using the Java API for Eclipse.

Here is a code sample of what I do:

NotesUIWorkspace workSpace = new NotesUIWorkspace();
NotesUIElement currentElement = workSpace.getCurrentElement();

if (currentElement instanceof NotesUIView) {
    NotesUIView currentView = (NotesUIView) currentElement;
    NotesUIViewEntryCollection collection = currentView
            .getActionableEntries();
    Iterator docIterator = collection.documentIterator();
    while (docIterator.hasNext()) {
        NotesUIDocumentEntry entry = (NotesUIDocumentEntry) docIterator.next();
        //I can't seem to get to the NoesUIDocument case like I can below... I want fields!
    }
}

if(currentElement instanceof NotesUIDocument){
    NotesUIDocument document = (NotesUIDocument) currentElement;
    //Seem to be able to get the correct data fields only in this case!
    document.getFields();
}
2
Can you post some of the code and the URLs you get? Also, I would assume that you want to get the UniversalID of the document - you can use that then to access the back-end document and its items. Is that correct?Hristo

2 Answers

2
votes

Fetching the "current" document is usually done via the NotesAgentContext.UnprocessedDocuments. In a view, that might return a collection of documents if the user as ticked several.

If you already have an NotesUIView, NotesUIView.getActionableEntries will give you the selected document(s).

When you have a NotesDocumentData instance, NotesUIWorkspace.openDocument can be used to open it up in edit mode. Then NotesUIWorkspace.getCurrentDocument can be used to get hold of the UI Document.

Notice that if you only want to read values from the document, it is more convenient to use the back-end classes like Document.

0
votes

Have you got a URL as an example? If it includes the UUID of the document in question then you should be able to reference it directly with a getDocument(). Otherwise, the URL should include a view reference and a lookup key for that view in question.