Getting The User ID From Connections Addendum1

As a little add on from This post on getting The User Id from IBM Connections, we discovered another little wrinkle, and that is the single sign on name that you get from @username in domino is not necessary the same as the what IBM connections is wanting in the ?Name= search parameter in its profile search, as we all should know the domino full name is not always the FirstName + ” ” + Last name then we tend to expect, so I just do a little lookup before running the function in the previous blog post

That is

String userid = convertSSOnametoFullName( userNab, agentContext.getEffectiveUserName().toString());
userid = getUserID( adminUserName, adminPassword, baseURL, ProfileNameSearch, userid);

The top function is below, the second function is [here](https://stickfight.co.uk/blog/Getting-The-User-ID-From-Connections)

private String convertSSOnametoFullName(  String NabNsf, String SSOUser) throws NotesException {
    System.out.println("convertSSOnametoFullName 0.1 " + SSOUser + NabNsf);
        String FullName = "";
        Session session = getSession();
        Database db = session.getDatabase(null, NabNsf);
        View view = db.getView("($VIMPeople)");
        DocumentCollection dc = view.getAllDocumentsByKey(SSOUser, true);
        //if we get more that 1 result then its a bad name to search and for security reasons we will return nothing
        if( dc.getCount() == 1) {
            Document nabdocument = dc.getFirstDocument();
            FullName = nabdocument.getItemValueString("FirstName") + " " + nabdocument.getItemValueString("LastName"); 
        } else if (dc.getCount() == 0){
            //we cant find that person in this address book so I going to return the name they put in as opposed to a blank, in case its a valid name in another address book
            FullName = SSOUser;
        }
        System.out.println("end convertSSOnametoFullName 0.1 " + FullName + " " + dc.getCount());
    return FullName; 
}

Getting The User ID From Connections

IBM Connections has an evil setting that disables emails from being seen on the system, this is meant as a security setting, but it not only hides the email from the front end but from all the atom feeds, suddenly you don’t have a unique key to reference users on functions.

Well that’s not exactly true, you have a internal ID that IBM functions will accept instead e.g “A7B2C512-27E5-596C-8625-7AD4000843Z3”, the only problem is how in the heck do you GET HOLD OF IT?

If you are within a community you can get it from member lists and such but how about when you want to just want to get a name that is on the system, say to add it to a community, the only way I have found is to search for it and no you cant search for it by email as that is disabled.

You have to search for it by name which while not exactly precise does the job but even that is not an ultra easy function, here is a little function to do it for you.

    private String getUserID( String adminUserName, String adminPassword, String baseURL, String ProfileSearchURL, String SearchUser) throws NotesException {
        String Unid = "";
        try {
            // example values for the passed parameters.
            adminUserName = "administrator"; 
            adminPassword = "password"; 
            baseURL = "https://www.myconnectionsSite.com"; 
            ProfileSearchURL = "/profiles/atom/search.do?name="; //sthis is what connections 4 uses 
            SearchUser = "John Smith";
            //build our search string
            String searchString = baseURL + ProfileSearchURL + URLEncoder.encode(SearchUser, "UTF-8");
            Abdera abdera = new Abdera();
            AbderaClient client = new AbderaClient(abdera);
            //ensure we can handle SSL requests
            AbderaClient.registerTrustManager();
            //logon to connections
            client.addCredentials(baseURL, null, null, new UsernamePasswordCredentials(adminUserName,adminPassword));
            //make the call
            ClientResponse resp = client.get(searchString );
            XPath xpath = abdera.getXPath();
            //get the xml back an navigate to the root of the document
            org.apache.abdera.model.Document doc = resp.getDocument();
            Feed feed = (Feed) doc.getRoot();          
            //if there is more than 1 returned entry then the user name is none unique and we cant trust our response
            if (xpath.numericValueOf("count(/a:feed/a:entry)", feed).intValue() > 1) {
                System.out.println("Ack we have more than 1 user with that name I cant be certain I have got the right one");
            } else {
                //as there is only one entry we can navigate straight down to the contributer sectnio which contains the user id
                Object contrubuternode = xpath.selectSingleNode("/a:feed/a:entry/a:contributor", feed );
                //because of the "snx" part we cant get the value without passing xpath our namespaces from the feed so it knows what "snx" means
                String snxUserid = xpath.valueOf("snx:userid", (Base) contrubuternode, feed.getNamespaces());
                Unid = snxUserid;   
            }
        } catch (ClassCastException e) {
            System.out.println("no user found or some other garbage return");
            e.printStackTrace();
            Unid = ""; 
        } catch (Exception e) {
            e.printStackTrace();
        }
        return Unid;
    } 

Yummy vegan burger

If you ever have a Vegan round for a junk food bash in the UK and want to serve them something that actually tastes nice without a load of complex cooking and stuff, try this:

Ingredients:

  • Vegan chicken burgers from Holland & Barrett.
  • Vegan cheese slices from Holland & Barrett (or anywhere you can find them).
  • Sainsburys hash browns (A lot of the other makes don’t seem to be certified vegan).
  • Nandos Peri Peri chip sprinkle you can get this from Sainsburys as well.
  • A Jar of Doritos hot or mild salsa.

Cook the chicken burgers and hash browns (sprinkle the hash browns with the Peri Peri)

Just before the burgers are done, put the cheese slices on them to melt a bit (you will find the vegan cheese is fairly naff at melting)

Then simply stack the sandwich in the order: burger,cheese, Doritos salsa with hash browns on top.

Yum

 

Mobile Working Accessories

I was quite late to the tablet game as I had been burnt by my 2 previous attempts to force a mobile device to do more than it was designed to ( the devices being the Palm III and the Nokia N-Gage) and being more than happy to jump from android phone to full size laptop for my different computing needs, but as I am doing more and more with my Nexus 7 (including writing this blog) I thought I would note down something that I have found to be at odds with the what everyone else seems to be doing.

Data entry on tablets has improved hugely, the smart soft keyboards are brill, I personally think Swift Key on the android is a work of genius and know of at least one occasion where it has lead to someone moving from apple to android, these meet the requirements of most people, BUT I still think there is a place for a proper keyboard and by proper I don’t mean one of those naff portable keyboards that fold up, I have tried 3 different ones and they all compare poorly against the soft keyboards. the only thing that is actually better than the modern soft keyboard is your actual laptop keyboard, and that strangely is the answer.

I have ended up with the Lenovo thinkpad usb keyboard, and quite simply its perfect, its full size with all the proper keys, this is no wonder as it is basically one of the award winning think pad laptop keyboards in a ultra thin case, nipple mouse and all, it is exactly A4 in size so fits in any A4 folder meaning that not only does it fit nicely with any of your papers but cases are easy to get and cheap.

before you scoff, and I get the inevitable “well why not just use a laptop” bare in mind I use a Lenovo W Series so

  • I have a battery life of 2 hours max even with all the extra battery packs rather than the 6 hours plus of a tablet
  • The weight difference is massive
  • I can keep it charged infidelity with something like the Goal Zero Guide 10 (which is my current fav. charging solution) where as with a lot of the serious laptops you cant charge off anything but mains e.g. my W510 uses a 135W charger which plane and car chargers simply sulk over.
  • Its a cheap, easy to replace and I don’t have to get a special tablet such as the Asus transformer.

At IBM connect there were a couple of times when I pulled out a full size keyboard that I generated a moment of mirth that moved to a ‘Ooooo’ when I simply plugged it in and started typing on my lap with no fuss or compromise

An extra advantage for me is that as I also use a think pad laptop the keyboard is exactly the same so I feel completely at home, If you are a Mac boy I would perhaps recommend the apple blue tooth keyboard and get the same advantage

 

The second thing is cases and stands for the nexus 7 and other small tablets, I tried a fold over case and reckon that unless of the highest quality and the tablet is designed for them (Such as with an IPad) they are a pain in the arse, a 7 inch tablet will fit in a jeans back or jacket pocket just fine without a case, but when I tried a case I started leaving it behind as it was just that bit too bulky, it was easier that for the life of the product I simply take care of the darn thing as I do my phone. but there are times when you do need a stand (I’m using one as I type) for this I found the tiny,cheap but perfect Igo mobile phone stand to be just perfect (despite what the guy in the shop insisted)