329 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Jobs | Twitter | Bookmarks | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Presentation from ISBG: An Introduction to Working With the Activity Stream
Fri, May 24th 2013 130
Authentication vs. Authorization
Wed, May 8th 2013 238
Just arrived - thank you IBM
Wed, May 8th 2013 273
Websphere Application Server WIM LDAP adapter log trace
Thu, May 2nd 2013 107
Setting up LDAP failover for Websphere Application Server
Wed, May 1st 2013 140
Looking up a datasource from an IBM Connections event handler
Tue, Apr 30th 2013 189
Fixing IBM Connections help for IE users
Mon, Apr 15th 2013 161
Top 10
A very nice touch from Linkedin
Thu, Dec 20th 2012 749
Configure Eclipse 3.5 for Notes 9
Fri, Dec 14th 2012 698
Configure Eclipse 4.2 (Juno) for Notes 9
Sat, Dec 15th 2012 698
Decrease in blogging year over year - is it a problem?
Sat, Dec 15th 2012 650
There's a new sheriff in town
Thu, Mar 28th 2013 634
IBM Connect 2013 session
Fri, Dec 7th 2012 617
The IBM developerWorks newsletter has been retired
Mon, Dec 10th 2012 570
Social AppDev Toolkit labs and presentations
Mon, Dec 17th 2012 518
New IBM Notes and Domino Certification Available - get 50% off until 25 June 2013
Thu, Feb 21st 2013 480
OnTime at IBM Connect 2013 - Like to win one of 4 iPad minis
Mon, Jan 21st 2013 414


The easy way to loop an XPage managed bean
   

I got harassed by Nathan (hmmm his blog appears to be down just now) yesterday for not contributing to the XPages dicussions out there so I thought I'd better remedy that. A quick tip is to make sure your Managed Bean implements Iterable if it contains a list of "things" and the obvious behaviour would be to loop over these things. If you implement Iterable you simple loop on the object using the "new" for-loop (when in Java) instead of first returning a List or array and then looping that with a for- or while loop.

Below is an example of a Managed Bean (just a Java-element from 8.5.3) that implements Iterable and hence it implements the iterator() method. That method should return an Iterator for the data you want to expose. Here I just return an iterator to the underlying list.

package com.example;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

import lotus.domino.Database;
import lotus.domino.Document;
import lotus.domino.Session;
import lotus.domino.View;

import com.ibm.domino.xsp.module.nsf.NotesContext;

public class PeopleLister implements Iterable {
  // declarations
  private List people = new LinkedList();
  
  public PeopleLister() {
    NotesContext ctx = NotesContext.getCurrent();
    Session session = ctx.getCurrentSession();
    try {
      Database db = session.getDatabase(null, "names.nsf");
      View view = db.getView("People");
      Document doc = view.getFirstDocument();
      while (null != doc) {
        this.people.add(doc.getItemValue("FullName")
          .elementAt(0).toString());
        Document docTemp = view.getNextDocument(doc);
        doc.recycle();
        doc = docTemp;
      }
    } catch (Throwable t) {
      
    }
  }
  
  public Iterator iterator() {
    return this.people.iterator();
  }

  public String toString() {
    StringBuilder b = 
      new StringBuilder(this.people.size() * 25);
    for (String p : this) {
      if (b.length() > 0) b.append(',').append(' ');
      b.append(p);
    }
    return b.toString();
  }
  
  public String[] getList() {
    return (String[]) people
      .toArray(new String[people.size()]);
  }
}

With that in mind I can just use the bean as follows from SSJS code (e.g. a Label):

var people = new com.example.PeopleLister();
var result = "";
for (p in people) {
  if (result.length() > 0) result += ", ";
  result += p;
}
return result;
Happy coding!



---------------------
http://lekkimworld.com/2012/06/05/the_easy_way_to_loop_an_xpage_managed_bean.html
Jun 05, 2012
183 hits



Recent Blog Posts
130


Presentation from ISBG: An Introduction to Working With the Activity Stream
Fri, May 24th 2013 12:52a   Mikkel Heisterberg
Below are my slidedeck from my Activity Stream presentation at ISBG. An Introduction to Working With the Activity Stream from Mikkel Flindt Heisterberg [read] Keywords:
238


Authentication vs. Authorization
Wed, May 8th 2013 7:39a   Mikkel Heisterberg
When ever I talk to customers and partners about single-sign-on (SSO) and the concepts of "authentication" I'm quite often baffled by the level of misunderstanding, misconception and lack of knowledge about just how "authentication" works. Now the reason I put "authentication" is quotes is that when we talk about authentication it's really not just authentication we're talking about. When we talk about confirming the identity of a user and confirming that the user is allowed to access a [read] Keywords: acl domino ibm notes application database password server websphere
273


Just arrived - thank you IBM
Wed, May 8th 2013 6:10a   Mikkel Heisterberg
[read] Keywords: ibm
107


Websphere Application Server WIM LDAP adapter log trace
Thu, May 2nd 2013 12:50a   Mikkel Heisterberg
When debugging LDAP login issues for Websphere Application Server (WAS) you're actually debugging the WIM (Websphere Identity Manager) part of WAS. The actual login piece is part of the adapters (database, ldap, file) which is the repository specific piece that WIM delegate the actual authentication to. The best debug string to use is "com.ibm.ws.wim.adapter.ldap.*=finest" as it limits the debugging to the LDAP piece of WIM. [read] Keywords: ibm application database server websphere
140


Setting up LDAP failover for Websphere Application Server
Wed, May 1st 2013 2:16a   Mikkel Heisterberg
As you may know LDAP is crucial to Websphere Application Server (WAS) when using it for IBM Connections so it makes good sense to configure failover for LDAP. If the LDAP server becomes unavailable you can no longer log in (actually you can't even log into ISC) and WAS can have a hard time reconnecting to the LDAP. Failover is set up using either the ISC Federated Security UI or by editing wimconfig.xml directly (or using wsadmin commands). Using wimconfig.xml have some advantages as you can se [read] Keywords: connections ibm application security server websphere xml
189


Looking up a datasource from an IBM Connections event handler
Tue, Apr 30th 2013 7:33a   Mikkel Heisterberg
For a customer project I'm working on these days I'm writing an event handler for IBM Connections Profiles to integrate two profile systems in real-time using the IBM Connections 4.0 Event SPI. Pretty powerful stuff in case you've never looked into it. In IBM Connections an event handler is basically just a Java bean which you register in events-config.xml to be called when certain events occur such as a profile being updated, the photo set, the photo removed etc. In this event handler I n [read] Keywords: connections ibm ldd lotus application database interface java profile server websphere xml
161


Fixing IBM Connections help for IE users
Mon, Apr 15th 2013 5:13a   Mikkel Heisterberg
At a customer site they were actually using the IBM Connections help documents (a first I know) but it didn't work for the users in Internet Explorer. After some research it turned out to be due to a missing compatability statement in the generated HTML documents (this statement is present in HTML generated for other features). I've previously reported this issue to IBM but it still hasn't been fixed in version 4.0 CR3 so I took it upon me to find a solution. The solution turned out to be sim [read] Keywords: connections ibm microsoft




261


Hiding the Social Mail username and password from socialmail-discovery-config.xml
Fri, Apr 5th 2013 12:38a   Mikkel Heisterberg
It's been bothering me a while that the username and password for our LDAP user was visible in clear text in our socialmail-discovery-config.xml. After going looking for a solution by using very specific searching I found a solution where you can hide the username and password and - stupid as I am - it's actually right there in the install docs. Stupid is as stupid does. The solution is to remove the authentication data from the socialmail-discovery-config.xml and replace the and tags with a [read] Keywords: connections domino ibm ldd lotus exchange exchange password websphere wiki xml
634


There's a new sheriff in town
Thu, Mar 28th 2013 2:33a   Mikkel Heisterberg
Last week was the annual BLUG event this time in Leuven, Belgium, and as always Theo and team created an amazing event. The BLUG event is now the biggest user group in the a World with a staggering 325 attendes and it really makes BLUG a mini-Connect event attracting the top names from IBM as well as the top speakers from all over the World. This year was no exception and the attendees were gifted with 18 IBM Champions covering everything from Domino to Websphere, XPages to widgets and social to [read] Keywords: atlantic collaboration connections domino ibm inotes notes xpages community linkedin twitter websphere widgets
299


Finally!
Mon, Mar 25th 2013 12:25p   Mikkel Heisterberg
[read] Keywords:




Created and Maintained by Yancy Lent - About - Blog Submission - Suggestions - Change Log - Blog Widget - Advertising - Mobile Edition