I'm asked to develop an automated mail alert in Lotus notes using Java.
The hard part is that the mail content will be tables and each table will be placed inside a tab. I used richtext programming to create tabs first and then iterated each tab, inserted a table and then inserted data into the table.
The problem I face is when I try to format the tables inside the tabs. For example, O need to apply different colors to each column of the table which I couldn't. Let me know if there is any other way to generate the automated email.
I use Eclipse IDE and back end is Oracle 11g. The following link is where I got the idea of how to insert a table and tabbed table: http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=%2Fcom.ibm.designer.domino.main.doc%2FH_APPENDTABLE_METHOD_RTITEM_JAVA.html
The Note Java classes offer pretty limited functionality for formatting tables. If you want more control, the easiest option would bue the Midas Rich Text LSX from Genii Software, however that is commercial software and it is generally used in LotusScript. Off the top if my head, I don't know if it's supported for Java.
Another option is to use DXL. What I would probably do is manually create an email containing a table with the exact look and feel that I want, export that email to DXL, and then write my code to insert my data into the DXL and then import the DXL into the document that I'm mailing.
IMHO the pragmatic way is to use HTML and MIME, and prepare the tables and tabs using hHTML and the NotesMime classes. Here's a link: http://www-01.ibm.com/support/docview.wss?uid=swg21098323
Why not use the Java interface in Notes to pull information into that environment rather than push the information/format into Notes? The Notes designer is Eclipse based. Plus with the recent changes in Notes external db access is simplified.
I am just trying to think a different direction but still using Java. The Notes side might be faster for you.
Related
I am hoping someone can help me on this one as i have been trying to find the solution for a long time without success.
I have a polygon shape-file which i am displaying on browser using geoserver . I have color-coded the polygons (by creating an SLD file) based on the values of one of the attributes(say "count") in the shape-file.
My problem is that i want to update the "count" attribute (which is an integer) regularly(on a daily basis) and hence i want to reflect this change in the geoserver. I am getting the values for "count" attribute through a java service which i have up and running . But so far , i have not been able to find out a way through which i can update a single attribute(for all features) in a shape-file through java . The geoTools library helps me to read a shape-file but i could not find a way to modify an attribute using this library .
How do i go about this?Please help me with the following questions:
Is geoserver a correct choice for my use case?
Is there some way to update an attribute of a shape-file using java.?
Should i continue using a shape-file or move to POSTGIS?
Can we update attributes of features in POSTGIS using java.?
If you only need to show one layer, and that layer is not very big (what is the size of the shapefile?) i will convert the file to geojson and show it directly in the browser.
Geoserver is commonly used with shapefiles when the underlying data does not change. If not is common to use postgis
Sure. Geotools can do it. But geoserver can also do it using WFS-T. Just enable it and use POST request or the geotools wrapper to update the data.
I think that the best option is create a new user for you backed process and add a security rule that allows wfs.Transaction only for that user. You can use basic http authentication in your backed process to launch a POST http request that update the shapefile.
It depends. If is one shapefile and it doesn't change a log (once a day) i will probably use in this order:
geojson directly show in the browser (without geoserver) -> shapefile + geoserver -> postgis + geoserver
Of course. A postgis layer is only a postgresql table with a column of type geometry. You can update your table as you can update any other table in postgresql.
I can't provide a full example right now to update a shapefile with geotools but check2 this links.
Open the shapefile as show in the access section in the second link
Open a transaction as show in the first link
Use the setAttribute methods of the feature instances
Close the transaction
A few things:
I would not use a shapefile for doing this but rather a real DBMS like postgis. Shapefile are good for serving read-only datasets not for concurrent changes. Having this in mind if we are talking about a low traffic site with infrequent updates (yes, one a day is infrequent) shapefile should be ok.
You can modify shapefile with GeoTools as well. This link might help. Something similar can be done to update a column in Postgis or you can do it directly.
You can use WFS-T for the update with both Shapefile and Postgis. Notice that by default WFS-T is enabled in GeoServer and it is open to everybody, you might want to change that (i.e. enable authentication at the very least for write operations)
Hope this helps,
Simone.
I want to export data from a Lotus Notes database .nsf that lives on my local computer. I want to write a java program that will connect to this .nsf lotus notes database and export data from a view/form.
I am not sure how to do that ? Is there a sample code that i can refer too or a JDBC-ODBC driver ?
You actually have two issues/questions.
1) How to use Java to connect to a Notes database
2) How to export data from documents (let's use the correct terminology, form is a design element, data is stored in documents)
For 1) there is plenty of sample code available, like the link poisonedYouth referenced in his response.
For 2) I would suggest looking at the samples in the Domino Designer help. You need to undertand that Domino Object Model (DOM) first, and know how that data is stored.
But you would probably do something like this:
Create a new NotesSession object
Get a NotesDatabase object from the session
Get a NotesView object from the database
Now you can do it different ways, depending on éxactly what you want to do and things like what items are being displayed in the view.
If all fields you want to export are displayed in the view, I would do this:
Get a NotesViewEntryCollection document from the view
Use GetFirstEntry and GetNextEntry methods to loop through the collection and get the individual entries
Use the ColumnValues property of the NotesViewEntry object to get the values displayed in the view, then export those values the way you want it.
If you don't have all the values displayed in the view, use this (slower) method:
Use the GetFirstDocument and GetNextDocument methods to loop through all NotesDocuments in the view
For each document, read the field values using GetItemValues (remember that all field values are returned as an array, even if they only contain one value) and export them the way you like.
Exporting data from Notes is a very common process, and you should be able to find plenty of code.
I have a tool available(it is not open source, though) here: http://www.texasswede.com/websites/texasswede.nsf/Page/Notes%20XML%20Exporter
I also posted code on my blog that you can look at and modify: http://blog.texasswede.com/export-notes-view-to-excel-with-multi-value-fields/
I found an article with topic "Writing standalone Java code that connects to IBM Lotus Domino"
http://www-10.lotus.com/ldd/dominowiki.nsf/dx/06082009125716AMWEB7TU.htm
I recommend trying IBM Security Directory Integrator (former Tivoli Directory Integrator, or TDI). It's a integration tool especially built for your purpose.
SDI operates using so-called assembly lines where you have one or more sources and one or more destinations. In between you can manipulate your data to your hearts desire.
Some versions of TDI/SDI are free with the newest versions of IBM Domino.
Check out these sites for more info:
http://www.tdi-users.org/twiki/bin/view/Integrator/WebHome
http://www.ibm.com/developerworks/downloads/tiv/tdi/
http://www-03.ibm.com/software/products/en/directoryintegrator
Good luck!
Ove
I am collecting data from a website and trying to save it to a database (or something similar that is very accessible) rather than having a heap of files on my desktop or in a folder.
There are many pages that I need to look at (1900 to be exact). I want to save time in getting this data, and decided to make a Java program to do this.
This is basically what I am trying to do.
Visit the webpage: www.TestWebsite.com/items/0
Save the (Name, Description, Image(png)) into one array/class to a Database.
Repeat until I get up to: www.TestWebsite.com/items/1899
I want to be able to access this data offline without having to need to go online to view it.
Any ideas on how I should start. I have made a basic webpage viewer, I am just missing the step in between saving the strings and images to a database.
I appreciate any help!
Actually just did this the other day. I used jsoup to scrap the webpages I needed and wrote to my local database. awesomely easy framework for webpage parsing.
It's fairly straightforward, but you'll need to learn a little SQL if you haven't already.
You'll also have to pick a database platform - I'd suggest SQLite for such a purpose, since the data is for personal use and it's lightweight and easy to set up.
Here's a tutorial on using JDBC (Java Database Connectivity) to talk with a SQLite database: http://en.wikibooks.org/wiki/Java_JDBC_using_SQLite. It goes from setup to inserting data, so once you've completed that it should be straightforward to modify your webpage viewing code to grab the data you need and shove it into the DB.
Good luck!
I have just started working with GWT. I was wondering how I can dynamically move widgets on fly (at web page on client browser) for example to move a row of table up and down, or upload a excel file and display its content right away....something like a dashboard I am talking about. Are there any comprehensive tutorial to refer.
Have a look at the gwt-dnd lib:
http://code.google.com/p/gwt-dnd/
GWT is made for doing the kind of things you are describing. To move widgets you can either set their position or dynamically modify their css. To move rows around in a table look at the api of whatever table class you are using. To upload an excel file do a google search for 'gwt upload' and there will be some instructions - but to display the file you will need to convert it (probably to xml). Converting the file on the server will depend on which server you are using - I also have seen a 3rd party widget that will do that for you.
If youre looking for transition effects or animations , than check out gwtquery. Its really similar to jquery and has pretty simple good examples to start with.
In my java application I am connecting to Microsoft Excel with Jacob libraries. Everything is fine but I do not know how I can catch com events when any changes in Excel page occurs by using Jacob libraries. For example, In my project I connect database takes table values and copy these values into cells of an excel page. Whenever a cell value is changed, the table value is also changed. That's I want synchronization between java and Microsoft Excel application by Jacob.
Don't use Java to achieve that. See this question: Excel OnChange event, with emphasis on this answer. You should access your database using com directly from Excel. That's easy using ADO. This ADO tutorial from w3schools looks also fine.
If the task is too complex to perform directly from Excel you may think of putting a small marker somewhere (e.g. in the database) that the data changed and process this marker from other app, possibly java app. The difficulty is that the credentials to access the database must be hardcoded in the Excel sheet. But you can create a separate database user with narrow database permissions.
Seeing your comment I also tried using Change event of Excel to detect changes done by other users. My experience on Excel 2003 shows that this works only locally. That is the event is fired only for the user that made the change. If many users have the worksheet open they don't receive Change event caused by changes from other users. So your approach is unfeasible. You may test it with Excel 2010, but my impression is that the events in general work only locally. Couldn't find anything on the net about it. Only this general article: Track changes in a shared workbook.