||Xpages and Java tip:- how to save a Java object to a Notesdocument
Using replaceItemValueCustomData and getItemValueCustomData to store Java objects in NotesDocuments.
When using Java to save information from Java objects to documents in Xpages you probably came across the question: I have an Java object but I can’t save it easily to a document. For example, in my case I had a java.util.ArrayList containing java.util.HashMap objects that I would like to save to a notesdocument.
In this case I thought I had to convert my data somehow to a java.lang.Vector of strings and save it to a multivalue field in the Notes Document, so I could retrieve it back later, convert the Vector of strings somehow to my ArrayList of Hashmaps….
And then I came across ‘notesdocument.replaceItemValueCustomData’ and ‘notesdocument.getItemValueCustomData’. This function is capable to put my Arraylist without any conversion in the notesdocument. When I need it later, it is pretty easy to retrieve it back using this function and it’s returning the exact same object I saved in the document!
You can save this kind of data to any field in your Notes Document. The result is an ‘Arbitrary Data’ type of field.
Do not expect to save lot’s of exotic classes and objects to a NotesDocument this way because the field is limited to 64KB. Also, it is not very easy to retrieve these values in Lotusscript but it is not impossible, Stephan Wissel blogged about this a while ago.
Here is a code example:
Aug 05, 2011
Sorry, no records were found!
| Recent Blog Posts