332 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Jobs | Twitter | Bookmarks | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
XSS security fix in Domino R9 HTTP server may break existing web applications
Mon, Jun 3rd 2013 312
Entwicklercamp 2013 slides about "Dojo 1.8 and AMD" now available in English
Fri, May 24th 2013 107
My EntwicklerCamp 2013 slides: Dojo 1.8 and AMD (German)
Wed, Mar 13th 2013 284
Quick tip: Fixing Dojo drag and drop issues in a Windows 8 VMWare on the Mac
Wed, Mar 6th 2013 179
Download links for IBM Connect 2013 session slides
Thu, Jan 31st 2013 198
Fast Notes view reading via Java API:New ViewNavigator cache methods in 8.5.3
Thu, Jan 17th 2013 169
Our session got accepted for IBM Connect: BOF211 Leverage OSGi plug-ins in Your XPages Applications!
Wed, Jan 9th 2013 121
Top 10
XSS security fix in Domino R9 HTTP server may break existing web applications
Mon, Jun 3rd 2013 312
My EntwicklerCamp 2013 slides: Dojo 1.8 and AMD (German)
Wed, Mar 13th 2013 284
Notes 8.5.1: The new Java UI classes and Domino Designer extensibility API
Sun, Oct 11th 2009 204
Customer project: Dojo 1.8 based portal on top of XPages and Domino 8.5.3
Tue, Sep 18th 2012 200
Download links for IBM Connect 2013 session slides
Thu, Jan 31st 2013 198
Quick tip: Fixing Dojo drag and drop issues in a Windows 8 VMWare on the Mac
Wed, Mar 6th 2013 179
Fast Notes view reading via Java API:New ViewNavigator cache methods in 8.5.3
Thu, Jan 17th 2013 169
XPages series #14: Using MongoDB’s geo-spatial indexing in XPages apps part 1
Fri, Apr 27th 2012 163
XPages series #15: Free FTP server on top of Domino’s OSGi framework
Sun, Nov 4th 2012 161
XPages series #12: XAgents and performance bottlenecks
Sun, Jul 17th 2011 155


XPages series #14: Using MongoDB’s geo-spatial indexing in XPages apps part 2
Karsten Lehmann    

This is part 2 of an article about using MongoDB in Notes/Domino. Click here for part 1.


Diving into the code: client side

The UI stuff is stored in an NSF database with basic page layout defined in an XPage and the client-side application logic code stored as Dojo class file in the Java perspective of Domino Designer.



The Dojo class location is defined and the class is loaded with the following code in the XPage "start.xsp":

<xp:this.resources>
        <xp:dojoModulePath prefix="mongo">
                <xp:this.url><![CDATA[#{javascript:'/dojo/mongo';}]]></xp:this.url>
        </xp:dojoModulePath>
                <xp:dojoModule name="mongo.test.PageHandler">
        </xp:dojoModule>
</this.resources>


After that, the class can be instantiated in a script block:

<xp:scriptBlock type="text/javascript">
        <xp:this.value><![CDATA[
        dojo.addOnLoad(function() {
                window.pageHandler=new mongo.test.PageHandler();
                window.pageHandler.init();
        });
        ]]></xp:this.value>
</xp:scriptBlock>


In the init() method, the page handler class registers event code for the form fields and buttons in the UI and creates the Dojo grid components (dojox.grid.LazyTreeGrid) to display the database content.

Now let's take a look at two UI operations in detail, to see how the UI communicates with the server-side code.

Adding data to the database

When places get added through the Administration tab, we first use the servlet "/mongogeo" to convert the addresses into coordinates:



What we get back is the JSON response of  the Google Geocoding API. It does not only contain the coordinates of an address, but other quite useful information like the name of the federal state, the country code and coordinates of a bounding box (for general addresses like city names that don't have exact coordinates).

Next, a POST operation to "/mongotest/addplaces" creates the actual place documents in the database followed by a reload operation of our Dojo grid to reflect the new data in the UI:



Query the database

The REST service "/mongotest/queryplaces" is used both for reading all places (on the Administration tab) and finding the nearest places for a certain position (on the Search tab). For the latter, we specify additional longitude/latitude arguments in the URL:

http://localhost/dev/ec12/nosql/mongodb/geo.nsf/mongotest/queryplaces?distance=3&longitude=8.3799444&latitude=49.009148&type=Shop&start=0&count=100

Dynamic sorting can be applied to the result with and without longitude/latitude arguments by specifying a sort parameter.
If no sort parameter and no position is specified, places are sorted by name as default sorting. For queries with longitude/latitude parameters, the distance between both points is used as default sorting.

http://localhost/dev/ec12/nosql/mongodb/geo.nsf/mongotest/queryplaces?distance=3&longitude=8.3799444&latitude=49.009148&type=Shop&start=0&count=100&sort=name

In the UI, data can be sorted by clicking one of the grid column headers.




Enough technical details, let's come to an end with this long blog article! :-)

If you would like to try out the sample in your own environment, here are the setup instructions:


Setup instructions - Prerequisites

I expect that you have downloaded and installed the latest version of MongoDB for your operating system. The sample was built for version 2.0.3 and I just found out that 2.0.4 is already available.

The server code is using localhost and port 27017 by default, but this can be changed by setting the environment variable NOSQL_MONGO_SERVER to something like "hostname1,hostname2:27123,hostname3", a comma separated list with hostname and optional port. The Mongo driver will use the list of servers for failover in case a server goes down.

Plugin installation

Download and extract the archive file from the specified download link.

Then follow the instructions in the Domino wiki article XPages Extension Library Deployment in Domino 8.5.3 and IBM XWork Server to create an NSF based update site database on the Domino server and import the update site from the download archive into the update site database, followed by a HTTP task restart (restart task http).

Database installation

Copy the sample database from the download archive to your Domino server and sign it with your Notes ID. Now open the database in the browser.

There is a section "Initialization" on the Administration tab which lets you import a set of default addresses (from Mindoo's home town Karlsruhe, Germany). This step is optional.

Download link

Click here to download the sample application



Phew... That was a long text. Thanks for reading until here!

And stay tuned for an article about my second demo from Entwicklercamp 2012:

Using Neo4J to solve the travelling salesman problem in XPages apps



---------------------
http://www.mindoo.com/web/blog.nsf/dx/27.04.2012190009KLEMXN.htm
Apr 27, 2012
107 hits



Recent Blog Posts
312


XSS security fix in Domino R9 HTTP server may break existing web applications
Mon, Jun 3rd 2013 3:36p   Karsten Lehmann
Last week we noticed that two of our web applications did not work as expected after upgrading our servers to Domino R9. We tracked down the issue and found the problem: In one REST API call, we have a query string parameter that contains a Domino fulltext query to filter the entries of a Notes view. Domino now reported that the query syntax was wrong. The same code had worked in 8.5.3. The reason is that the Domino R9 HTTP server contains a security fix to prevent applications from being v [read] Keywords: domino ibm lotus notes application applications javascript security server xml
107


Entwicklercamp 2013 slides about "Dojo 1.8 and AMD" now available in English
Fri, May 24th 2013 12:56p   Karsten Lehmann
My slides about "Dojo 1.8 and AMD" are now available in English. I have updated my original blog article: My EntwicklerCamp 2013 slides: Dojo 1.8 and AMD [read] Keywords: dojo
284


My EntwicklerCamp 2013 slides: Dojo 1.8 and AMD (German)
Wed, Mar 13th 2013 8:12a   Karsten Lehmann
The closing session of EntwicklerCamp 2013 has just finished. Here are the slides for my EntwicklerCamp 2013 session about "Dojo 1.8 and AMD": Download archive: Slides as ZIP-Archive To all English speaking readers: Google Translate is your friend - the slides are in German :-) My plan is to translate them to English though and publish my demos as soon as possible. [read] Keywords: archive dojo google
179


Quick tip: Fixing Dojo drag and drop issues in a Windows 8 VMWare on the Mac
Wed, Mar 6th 2013 11:59p   Karsten Lehmann
I am currently setting up a new dev environment with Windows 8 and Notes/Domino 9 to work on demos for my Dojo 1.8/AMD session at Entwicklercamp next week. To my surprise, I noticed yesterday, that drag and drop operations on Dojo widgets did not work as expected. For example, I could not drag the splitters of a BorderContainer layout widget and the columns of a LazyTreeGrid could not get resized. It seemed as if mouse events got lost, but I only got that effect in Firefox and Chrome. In IE, [read] Keywords: domino notes dojo firefox mac vmware widget widgets
198


Download links for IBM Connect 2013 session slides
Thu, Jan 31st 2013 7:23a   Karsten Lehmann
As in previous years, I copied the download URLs of all the already available session slides from the socialbizonline.com website. Unfortunately, a lot of slides are still missing and some are only provided in black and white mode with 2-on-1 page. Use your preferred download manager to download the files. I use DownThemAll for this purpose. You need to be logged in to the website to access the files. Here are the download links: Connect2013_PDFs.html And here is the spreadsheet I u [read] Keywords: ibm lotusphere ods firefox
169


Fast Notes view reading via Java API:New ViewNavigator cache methods in 8.5.3
Thu, Jan 17th 2013 8:27a   Karsten Lehmann
Preface A posting about new API methods in 8.5.3 may look a bit weird, now that the Notes/Domino R9 beta is already out for one month. I wanted to blog about this topic for one year now, actually since last year's Lotusphere conference, where the new API methods got presented by IBM (in session "AD112 What's new in the IBM Lotus Domino Objects: Version 8.5.3 in Demos"), but could not find the time and have always expected that IBM dev would write a wiki article about it - which they haven [read] Keywords: acl domino ibm ldd lotus lotusphere lotusscript notes notesdomino xpages application applications database development java javascript server wiki




121


Our session got accepted for IBM Connect: BOF211 Leverage OSGi plug-ins in Your XPages Applications!
Wed, Jan 9th 2013 12:50a   Karsten Lehmann
Today we got the information that our Birds of a Feather session submission (BOF) has been accepted for IBM Connect 2013. Here is the abstract: BOF211 Leverage OSGi plug-ins in Your XPages Applications! Tammo Riedinger, Mindoo GmbH; Karsten Lehmann, Mindoo GmbH Hear how XPages apps can be extended with your own visual controls and data can be leveraged from external databases! We want to talk about code sharing of libraries between multiple XPages apps, Notes Client plugins and standal [read] Keywords: domino ibm lotus notes notes client xpages applications exchange exchange server
161


XPages series #15: Free FTP server on top of Domino’s OSGi framework
Sun, Nov 4th 2012 5:02p   Karsten Lehmann
Last week we had a conference call with IBM. They provide free VMware images of several IBM products for business partners to be used for demo and development purpose, including IBM Connections 4, already set up for the well known Renovations company. Those images very pretty large, with several GB's of data and the fastest and easiest way to get our hands on the images was to set up an FTP server and have the IBM'ers upload the files. That was a good occasion to build a small proof-of-c [read] Keywords: connections domino ibm ldd lotus notes xpages application applications archive database development eclipse java openntf password server twitter vmware xml
121


Session accepted for Entwicklercamp 2013: Dojo 1.8 and AMD
Sun, Sep 30th 2012 1:57p   Karsten Lehmann
I just received confirmation that my session submission for next years developer conference Entwicklercamp 2013 in Gelsenkirchen (11th - 13th of March) got accepted. The session is about the new Dojo toolkit 1.8 that we have already used in a customer project since its release in August 2012. Sessions at Entwicklercamp are held in German language, so here is the translated abstract and the original one in German. Dojo 1.8 and AMD The session provides an introduction to web application [read] Keywords: application applications development dojo mobile
200


Customer project: Dojo 1.8 based portal on top of XPages and Domino 8.5.3
Tue, Sep 18th 2012 2:54a   Karsten Lehmann
The last months have been incredibly busy for us at Mindoo and I could not find much time for blogging. Tweeting about my findings on the web is just so much easier than to write a complete blog article. We spent most of our time working on web applications for desktop browsers and the iPad (including Retina support), based on our favorite web toolkits Ext.JS from Sencha as well as the Dojo toolkit. Since we like cutting edge development, we prefer to use the latest versions of toolkits. F [read] Keywords: domino ibm lotus notes richtext xpages application applications blogging css database desktop development dojo eclipse exchange exchange java javascript mobile portlet security server twitter widget




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