361 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Tools we use to build web apps
Sun, Sep 21st 2014 86
Status report / collection of web and mobile development frameworks and tools
Fri, Jun 27th 2014 50
Now on OpenNTF: Open Eclipse Update Site - based on IBM’s template but with extended functionality
Fri, Dec 6th 2013 72
Now on OpenNTF: Mindoo XPages2Eclipse - Eclipse APIs for XPiNC applications!
Thu, Nov 28th 2013 35
New on OpenNTF: Plugin to close XPiNC applications from CSJS code / to detect Notes ID changes
Mon, Sep 9th 2013 29
New on OpenNTF: Geospatial indexing for IBM Notes/Domino data
Tue, Jul 30th 2013 38
XSS security fix in Domino R9 HTTP server may break existing web applications
Mon, Jun 3rd 2013 29
Top 10
Tools we use to build web apps
Sun, Sep 21st 2014 86
Now on OpenNTF: Open Eclipse Update Site - based on IBM’s template but with extended functionality
Fri, Dec 6th 2013 72
Status report / collection of web and mobile development frameworks and tools
Fri, Jun 27th 2014 50
Notes 8.5.1: The new Java UI classes and Domino Designer extensibility API
Sun, Oct 11th 2009 44
New on OpenNTF: Geospatial indexing for IBM Notes/Domino data
Tue, Jul 30th 2013 38
XPages series #9: How to debug an XPages application
Tue, Jul 20th 2010 35
Now on OpenNTF: Mindoo XPages2Eclipse - Eclipse APIs for XPiNC applications!
Thu, Nov 28th 2013 35
Fast Notes view reading via Java API:New ViewNavigator cache methods in 8.5.3
Thu, Jan 17th 2013 34
The View article: Add LSDoc Support to Domino Designer on Eclipse with Custom Plug-ins (download link included)
Thu, Jul 22nd 2010 31
XPages series #14: Using MongoDB’s geo-spatial indexing in XPages apps part 2
Fri, Apr 27th 2012 29


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
30 hits



Recent Blog Posts
86


Tools we use to build web apps
Sun, Sep 21st 2014 4:08p   Karsten Lehmann
In a recent comment in this blog, Andrew Magerman asked what frameworks I use to build web applications and whether we have looked into Angular. Since the answer got too long for a simple comment and might be interesting for others, I created this blog article. Server side I am using my own regexp based templating system, which simply fills some placeholders in static HTML and JS files and sends them to the browser, e.g. to compute URLs, to insert translated phrases and include content of ot [read] Keywords: domino ibm application applications database desktop development facebook integration java javascript mobile network server twitter
50


Status report / collection of web and mobile development frameworks and tools
Fri, Jun 27th 2014 2:34a   Karsten Lehmann
The last post in this blog has been written 6 months ago. Although I have had several ideas for new posts, project work and family life got in the way (our son was born last September). At Mindoo, we have been incredibly busy working on development projects and product prototypes. Some of them are still IBM Domino based with Responsive Web Design using Bootstrap and jQuery or Sencha's ExtJS, others are pure JSF applications using the Primefaces framework. In other projects, we produced E [read] Keywords: domino ibm notes notes client applications database development interface java mobile server twitter wiki
72


Now on OpenNTF: Open Eclipse Update Site - based on IBM’s template but with extended functionality
Fri, Dec 6th 2013 11:23a   Karsten Lehmann
I just created a new project on OpenNTF called "Open Eclipse Update Site". The Open Eclipse Update Site database is based on the OpenNTF project "Eclipse Update Site (updatesite.ntf)" from IBM with additional functionality, e.g. Mac Notes Client support (no SWT error messages like in the original template) View action to delete selected features from the database (no need to delete all like in the original template) Support for headless builds (automatic generation of update site, e.g. [read] Keywords: agent ibm notes notes client ntf database eclipse mac openntf server
35


Now on OpenNTF: Mindoo XPages2Eclipse - Eclipse APIs for XPiNC applications!
Thu, Nov 28th 2013 12:07p   Karsten Lehmann
I just created a new project on OpenNTF: Mindoo XPages2Eclipse. Our toolkit, which provides extensive Eclipse APIs to XPages developers in the IBM Notes Client (XPiNC), is now available for free! Here is the project description: XPages2Eclipse is a language extension for XPages-development within the Lotus Notes Client Find out how XPages2Eclipse simplifies the development of XPages-applications for the IBM Lotus Notes Client considerably. With the help of this extensive toolkit you w [read] Keywords: domino ibm lotus lotusscript notes notes client symphony xpages application applications css desktop development dojo eclipse integration java javascript linux mac mobile openntf server wiki
29


New on OpenNTF: Plugin to close XPiNC applications from CSJS code / to detect Notes ID changes
Mon, Sep 9th 2013 2:26p   Karsten Lehmann
There is a new project on OpenNTF that I created a few days ago: Mindoo Xulrunner Prefs.js Management Plugin. It's nothing big, only a small Eclipse plugin that can be installed in the Notes Client to manage the preferences of the Xulrunner engine that renders XPages in the Notes Client (XPiNC). The main purpose for this is to set the property "dom.allow_scripts_to_close_windows" to false on a number of machines (the plugin can be deployed via policy). This enables XPages applications to [read] Keywords: ibm notes notes client xpages application applications community eclipse javascript openntf password xml
38


New on OpenNTF: Geospatial indexing for IBM Notes/Domino data
Tue, Jul 30th 2013 5:08p   Karsten Lehmann
Last weekend I created a new project on OpenNTF.org, which is part of a pretty big "pet project" that I have been working on for several month and that will hopefully be ready for primetime someday. My original plan was to submit this pet project for the last XPages development contest, either in addition to or instead of the Mindoo FTP Server, but the project got bigger and bigger over time - and an FTP server was finally easier to polish and explain than my other idea. This idea has to [read] Keywords: domino ibm notes xpages apple applications database development google interface openntf server wiki




29


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
28


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
22


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
23


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




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