Welcome to Chuck part II

From the last entry I realized I should have actually introduced Chuck!

Chuck has been a system level developer for many years writing to Lotus technologies in many laguages (C, C++, Java, LotusScript, and all web related languages). Chuck joined IBM (actually Iris Associates about seven years ago) and worked with me at Key Bank prior to that. Chuck currently works on the Lotus Expeditor team and is the primary developer for the Composite Application Infrastructure. He brings a wealth of experience and diversity to the blog and I look forward to seeing his activity here.

Idea Jam is a great site

Ideajam is a pretty cool looking site and it excels functionally just the same. The integration of Notes and JavaScript is excellent. What I like most is the charting UI under the statistics page – if you want cool charts and graphs get with Mark Barton as indicated at the bottom of the page.

My only suggestion is that if I vote and I am not logged in it should go to the login page however after I logged in my vote should be retained. currently it just sends me back to the page and I have to find the entry and vote again.

Tags: : :

Best way to represent a Notes Document as JSON?

I have been playing around with getting a JSON representation of a Notes Document (its data, not the Java class) and I am not sure how to write RichText fields to the JSON. Honestly, I am not even sure if it is worth doing it because I originally just wanted access to general data in the document from places like SWT views and local Portlets. But I would like to know if there is a method of putting the RichText into JSON and then having a component recreate the RichText on the other end? I currently use the “getMIMEEntity().getContentAsText()” but that does not seem to handle all of the character cases.

So I thought I would post a question to everyone, how would you do it using the Notes Java API's?


//Code from my conversion job
NotesThread.sinitThread();

// Create the notes session
Session session = NotesFactory.createSessionWithFullAccess();
Database db = getDatabase(url, session);

if (db == null) return Status.OK_STATUS;

//Construct our JSON object
JSONObject jObj = new JSONObject();

Document doc = getDocument(db, url, session);

if (doc == null) return Status.OK_STATUS;

Vector v = doc.getItems();
Iterator iter = v.iterator();

//Fill in the JSON object
while(iter.hasNext()){
Item i = (Item)iter.next();

if (i instanceof RichTextItem){
RichTextItem rt = (RichTextItem)i;
jObj.put(i.getName(), rt.getMIMEEntity().getContentAsText());
}else{
jObj.put(i.getName(), i.getText());
}
}

Tags: : : :

AD103 – Creating Eclipse-based Components for Composite Applications


Sesison details
Session track Track Two: Application Development
Session id AD103
Session name Creating Eclipse-based Components for Composite Applications
Session abstract This session will demonstrate the model view controller pattern common in Eclipse based components and link those concepts with proper componentization. We’ll deep dive dive on property broker integration, CAI architecture, and component recognition in the composite application editor.
Speakers Chuck Imperato
Robert Balfe

Hidden components

One aspect of composite applications is the ability to have hidden components. You can create a hidden component with Eclipse by creating a normal view and setting the “com.ibm.rcp.hidden” property to true in the composite application editor. This means your components “createPartControl()” is called but the visual piece is not actually shown. You will still have full access to any points of variability (component properties) like a visible component. These kinds of components can do some interesting things like:

– be driven by a visual component or user action
– call a web service and forward the response
– access back-end data
– run a job to do something in the back ground
– data transformations

I just wrote a neat little hidden component that takes the URL of a selected Notes document and forwards the data in that document on as JSON (an output property of the component). This means when the hidden component is wired to a Notes view it can be wired to another component (that may or may not have access to the Notes API's) and be able to process the JSON object of the Notes data. Since this functionality is a component, it only does the heavy lifting of cracking open the Notes document if it is wired to another component. Having this functionality in another component (and not built into the view) means this baggage only happens when the hidden component it wired to the view. The document in this case will get cracked open only if the hidden component is wired to another component itself.

I will be posting the code for this component soon. This is a small piece of what I will be presenting at Lotusphere this year.

Tags: : : :

Extending Notes Mail with composite applications

One cool thing about composite applications is you can literally mix the two worlds of Eclipse and Notes using them. In this demo I created a composite and used Lotus Script to define my actions. The actions then get associated with selected emails and are surfaced using Eclipse extensions to the Mail views. This is a great click to action story where we use Lotus Script and the Eclipse extensibility patterns to leverage current skills in new ways.

View Video here

The Lotus Script actions use JSON to receive all of the information about the currently selected email and then all of the criteria document is passed into the action via the JSON object. This makes for the Lotus Script side to be quite simple.