ics user group dev day_2014 use notes objects in memory and other useful
1. Use Notes objects in memory and other useful Java tips for XPages development
Frank van der Linden
2. Me
•Java/XPages/Web/Domino developer
•Self employed at elstarIT
•OpenNTF director
•Speak at several national and international events
•IBM Champion 2013 and 2014
•Live in the Netherlands
•Work everywhere
@flinden68
http://www.elstarit.nl
http://nl.linkedin.com/in/flinden68
flinden68@elstarit.nl
3. Disclaimer
All the code and the demos in this session will use the Java Notes Objects which are part of the IBM/Lotus Notes product.
For a modern way of Java coding with Notes Objects please use the OpenNTF Domino API.
Or even better use OpenNTF essentials
4. Roadmap
•Notes objects in memory
•Use of JSON
•MVC/Managed beans
•Java tip for XPages
•Date checks
•Utility class
•Extending classes
•Unit test
•Finally
•Some bonus code
23. The requirements
•Needs to be Serializable
•At least one constructor without parameters
•Needs to be registratedin the Faces-config.xml
•Properties are private
•And have Getters and Setters
24. Faces-config.xml syntax
•In package-explorer, under WebContentWEB-INF
•Name of the bean
•Full qualified class name
•Scope of the bean
•Optional, initialize properties
25. Use the managed beans
•Do the calculation in the class
•Use Expression Language to access properties
•Minimize use of SSJS
•Some examples
31. Unit test
•Write code to test small portions of code, like methods
•Test if the code is doing what was intended
•Write better Java code
•Use Mock Framework, like EasyMockor Mockito, to simulate objects
32. Unit test for XPages
•More and more Java code in XPagesdevelopment
•Write Unit test for better code
•On OpenNTF Junit test for Xpagesproject (thanks Christian Guedemann)
33. And Finally
•Finally will always called, even after a catch
•Use it to recycle objects and close stream readers
34. Thank you
@flinden68
http://www.elstarit.nl
http://nl.linkedin.com/in/flinden68
flinden68@elstarit.nl
https://bitbucket.org/flinden68/bccon-java-demo/src