Domino
Jul 19, 2011
Problems with charset in 8.5.1 environment
Strange behaviour managing XML file in Java agent
In this scenario, i've experienced some problems with UTF-8 charset in strings. In 6.5 environment everithing works fine.
This is my code in a Java agent:
org.w3c.dom.Document docXML = attachSegnatura.parseXML(false); XSLTResultTarget out = new XSLTResultTarget(); out.setFileName(path + "SegnaturaRT.xml"); attachSegnatura.transformXML(xsl, out); DOMParser parser = new DOMParser(); parser.parse(path + "SegnaturaRT.xml"); org.w3c.dom.Document docRT = ((DOMParser)parser).getDocument();
tFactory = TransformerFactory.newInstance(); StreamSource xslSS = new StreamSource(pathFile+"Segnatura.xsl"); StreamSource xslRT= new StreamSource(pathFile + "Segnatura.xml"); FileOutputStream fos = new FileOutputStream(pathFile + "SegnaturaRT.xml"); transformer = tFactory.newTransformer(xslSS); transformer.transform(xslRT, new StreamResult(fos)); transformer.reset(); fos.close(); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); docRT = dBuilder.parse(new File(pathFile + "SegnaturaRT.xml"));
Anybody experienced something like this?
Apr 06, 2011
DIIOP?? No more...
I'm porting servlet code running on 6.5 Domino Server in XPages.
Servlet comunicate with Domino through DIIOP, and need DIIOP to istantiate Session object:
lotus.Domino.session = NotesFactory.createSession(server,login, password);
Thanks to Karsten Lehmann for its great library:
http://www.mindoo.com/web/blog.nsf/dx/18.07.2009191738KLENAL.htm?opendocument&comments
Now i can initialize a session using:
lotus.Domino.session = DominoAccess.getCurrentSession();
No more DIIOP needed!!
Nov 03, 2010
Lotus Notes and chart in client: great stuff!!
A way to render charts in Lotus Notes Client through Google Charts
Working with the Lotus Notes Client I came across the necessity of working with graphs.
The opportunities were:
- Integrate with third-party products, which will require installation on your PC ( RMCHART (http://www.brothersoft.com/rmchart-35638.html) is a very good library);
- Using
Microsoft Excel, if it is installed on your PC, creating a template
that is then filled with data and processes them in a chart
Then I thought, why not use Google Charts?
So I did a test, that list step by step.
- In the form that contains my data to process I created a pass-thru <computedvalue> containing the URL of Google (ie "http://chart.apis.google.com/chart?cht=p3&chd=s:Uf9a&chs=250x100&chl=January|February|March|April")
- I opened the document with the form above, and I noticed a picture with a "red cross"

- Right click on the picture I noticed the option "Show images", selecting the image appears correctly
Everything ok, but how to avoid each time you select "Show images"?
If
you go on the properties of the document you will notice that there is
a field "$DelayedImages" to 1, when the red cross is shown on the
image
However if you have selected the option "Show Images" has a field "$DelayedImagesOK" set to "ok".
So, in document form, i've created a computed field "$DelayedImagesOK" with value" ok "and you're done!
This is the result
Oct 27, 2010
Forms with the same alias is *still* a bad practice (Xpages Bug)
Probably a bug found in XPages 8.5.2 engine
There is not to boast, but perhaps the development team RedTurtle found a bug in the engine of XPages 8.5.2.
It's happened during the development of an application where we had to connect a datasource to a Xpage. It
appears that, in case you have two forms with the same alias, the list
of available fields always refer to the first of two forms that is
found in the list (we know, it's a very bad practice assigning same aliases to different forms, but we inherit this scenario from someone else...)
Only renaming the alias you obtain the right binding of the fields, even if the engine allows you to refer to the two blur.
By
submitting the matter to two of the leading experts on the subject, Bob
Balfe and John Mackey, we had confirmation that the problem exists.
UI Architect for IBM Workplace Designer has been alerted and will investigate the problem.
You will be posted ...
Sep 10, 2010
"Received" field is big trouble for Lotusscript..
A bit of background when SMTP mail headers come in, they create multiple 'received' fields in mail document
This is done instead of putting multiple entries in a single field, but the problem comes from the fact that the notes mail document includes a 'Received' field for every server it has passed.
Lotus Notes give us a documented method that gets the text values of the Received items in a mail document.
stringArray = notesDocument.GetReceivedItemText( )
But sometimes it doesn't work...
Agent message: Received Item is not standard format - access with GetItemValue
Thanks to Raymond Neeves for his great function
After calling this, you can simply access all values of Received field with
Forall v In doc.Received
msgbox v
End Forall
Aug 30, 2010
New ideas from RedTurtle....
RedTurtle Technology seeks to contribute to improving Notes
Jul 02, 2010
Generating pdf with iText and Xpages
Brief tutorial to simply create PDF's inside XPages
Many thanks to John Mackey:
http://www.jmackey.net/groupwareinc/johnblog/johnblog.nsf/d6plinks/GROC-7G9GT4
and to Daniele Vistalli http://factor-y.com for this idea, for their help and the great powers.
Since Domino 8.5 is Eclipse based, you can switch to the Java perspective and add Java code to your project. The nsf database is the project. (If you haven't done this yet, it is interesting to switch perspectives and look around at the structure and the code.) By switching to the Java perspective, you open up your code to the importing or referencing of Java libraries, or the creation of your own classes.
Now we investigate how to create PDF using XPages. This tutorial summarize John's article, with some other things that you have to pay attention to.
Step by step.....
- Create your own .nsf
- Switch to the Java perspective by selecting: Window->Open Perspective->Other.
- Expand your project on the Left hand Project navigator. Select the WebContent/WEB-INF Folder
- right click and select New->Folder. Name the folder source, click Finish.
- right click on the source folder and select New->Package. Name the Package mypackage click Finish.
- right click on the mypackage package and select New->File. Enter Test.java for the name. Click Finish.
- Now double click on the Test.java and paste in the following code:
package mypackage;
import java.io.FileOutputStream;
import java.io.IOException;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;
/**
* First iText example: Hello World.
*/
public class Test {
public static void createPdf(String filename) throws Exception {
try {
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream(filename));
document.open();
document.add(new Paragraph("Hello World!"));
document.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
- select the project and then select Project->Properties from the menu (or right click)
- select the Java Build Path and click on Add Folder button. Select the new source folder. Click OK.
- In WebContent\WEB-INF add the folder called lib
- Right-click on it and select Import->File System->Browse and select itext jar (i.e iText-5.0.2.jar)
- import itext jar (i.e iText-5.0.2.jar) in your Java Build Path: Project->Properties->Java Build Path->Libraries->Add Jar and select jar from WebContent\WEB-INF
- Note: you have to deploy jar in your server, in data\domino\java and append this line in notes.ini, JavaUserClasses variable
JavaUserClasses=......;C:\Programmi\IBM\Lotus\Domino\data\domino\java\iText-5.0.2.jar
this will not cause security problem when you call iText methods to generate PDF
- Create a Script Library Server Side called SLCode and save this code on it
function create(){
mypackage.Test.createPdf("hello.pdf");
}
- Now create an xpage
- in Resources section, include SLCode library
- Drag a Button control in Xpage
- Goto Event section of this button, onClick event, and put this JSS code
create();
- Open your XPage in a browser and click the button: pdf will be created in domino directory on server
That's all!
Jun 26, 2010
System.getProperty() returns null
How to avoid a null pointer using System.getProperty() within a java agent.
Sometimes, for some reason, you have to do it. I'm talking about the use of System.setProperty() method within a java agent. If you don't pay attention it's easy to get a null pointer as result. Infact I got it.
After a quick search I found out a way to solve the issue:
I will use "jna.library.path" as example.
First of all add the following line in "java.policy" file (in the "jvm\lib\security" folder below the Domino program folder).
permission java.util.PropertyPermission "jna.library.path", "read,write";
After that, add the java code to your agent :
String jnaProperty = "jna.library.path";
if(System.getProperty(jnaProperty) == null) {
System.setProperty(jnaProperty,"your path");
}
Jun 17, 2010
Jun 01, 2010
Problem with documentcontext in Java Agent
In a Java agent, If you are accessing your document via agentContext.getDocumentContext(), I've found a problem in managing attachment with extractFile method
Error found is "a database handle to a remote database cannot be used by more than one thread"
This is my workaround.
Instead of doing:
AgentContext agentContext = session.getAgentContext(); lotus.domino.Document inDoc = agentContext.getDocumentContext(); Database db = agentContext.getCurrentDatabase();
try doing this :
AgentContext agentContext = session.getAgentContext(); lotus.domino.Document inDoc = agentContext.getDocumentContext(); String unid = inDoc.getUniversalID(); inDoc.recycle(); Database db = agentContext.getCurrentDatabase(); lotus.domino.Document inDoc2 = db.getDocumentByUNID( unid );
Now works!

