My thoughts about the org.opentf.domino api milestone 2.5

A few months ago there was a little fuzz going on in the openntf / domino community. There where some guys who wanted to go where IBM didn’t want to go. Updating the JAVA api that was available to us notes developers.

Since that moment there have been a few releases of the org.openntf.domino api and I decided to take a look and work with it on a little home project. One of my biggest hobbies is playing Wheelchair floorball. Every year it is a little challenge to keep track of the results, the current standings and so on because everything is kept in excel sheets that are downloadable from the official website. I want to have it on a website which gives me a direct overview of where my team is standing in the competition and for other people to see if their team is winning.  So why not create a xpage application from it. From the start I made the decision to use the new org.openntf.domino api to see how it works.

My first impression is.. wow. 

Of course there is the obvious ‘where did my .recycle’ go. The API takes care for that of us. Somehow ( have to check the source for it ) it keeps track of every object you create and recycle’s it when needed.

Secondly there is the iterator support on collections. If you have a NotesDocumentCollection or a ViewEntryCollection you are able to iterate over it using the usual iterator’s as many java developers are accustomed to.

Because I’m still playing around with the new JAVA api I will keep it at these two points. When my project has advanced a bit more I will write another blog about it.

oh btw.. there is a small thing I would like to be added to the API.

ViewEntry.getColumnValue(String name);

In a view you can add the programmatic name. The xsp wrapper of a viewentry is able to retrieve the data from a column by name. For some reason this Api won’t allow it. I think that it would be really nice asset because it makes the code a bit more readable (and that’s what it is all about.. ) see for yourself:

public class SomeFactory{

 public Vector<Some> getSome(){
     View vw = DominoUtil.getCurrentDatabase().getView(".AllDocuments");
     ViewEntryCollection coll = vw.getAllEntriesByKey("Some");
     Iterator<ViewEntry> it = coll.iterator();
     Vector<Some> l = new Vector(coll.getCount());
     While(it.hasNext()){
	l.add(fromEntry(it.next()));
     }
     return l;
  }

  private Some fromEntryOld(ViewEntry entry){
    Some s = new Some();
    entry.setProperty(entry.getColumnValue(11));
    entry.setNextProperty(entry.getColumnValue(14);
    entry.setAnotherProperty(entry.getColumnValue(1));
    return s;
  }
  private Some fromEntry(ViewEntry entry){
    Some s = new Some();
    entry.setProperty(entry.getColumnValue("Property"));
    entry.setNextProperty(entry.getColumnValue("NextProperty");
    entry.setAnotherProperty(entry.getColumnValue("AnotherProperty"));
    return s;
  }
}

This could be possible because inside the viewentry object you can call its parent. Retrieve all the column names and chekc if the given column was found in the namesvector. If so retrieve its index and do a simple getColumnValues().get(index);

2 thoughts on “My thoughts about the org.opentf.domino api milestone 2.5”

  1. That feature request makes sense – I’ve written that column-name translation code a couple times and put in an issue for myself to add it to the API. I haven’t gotten around to it yet, but it’ll definitely be in there in time.

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.