Question

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();
}
Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top