O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

A Notes Developer's Journey into Java

Beans and Java! We hear those buzz words all the time, but our XPages applications seem to work fine with Server Side JavaScript. Why should we use Java and managed beans? Come learn about one long-time Notes developer's journey using a Java Managed Bean and why. Discover how a Bean allowed the data to be cached in memory allowing for quick access to user-selected data subsets. Learn how different Java collections like HashMaps, ArrayLists and TreeSets can be used to build in-memory objects of your data. See how using a Managed Bean can simplify and greatly speed up your XPage! A comparison will be made of the performance savings before and after the implementation of the Managed Bean. Come get gently led down the path to the pot of Java waiting at the end of the rainbow!

Click here to download the sample application used in the webinar: http://www.tlcc.com/admin/tlccsite.nsf/pages/feb-java-webinar?opendocument

  • Entre para ver os comentários

A Notes Developer's Journey into Java

  1. 1. A Notes Developer's Journey into Java Tweet about this event And mention us: @Teamstudio @TLCCLTD Feb. 17, 2015
  2. 2. @Teamstudio teamstudio.com @TLCCLTD tlcc.com Courtney Carter Inbound Marketing Specialist Teamstudio
  3. 3. Who We Are • Teamstudio’s background is in creating tools for collaborative computing in mid-size and large enterprises, primarily for IBM Notes • Easy-to-use tools for developers and administrators • 1600+ active customers, 53 countries • Offices in US, UK, and Japan • Entered mobile space in 2010 with Unplugged: easy mobilization of Notes apps to Blackberry, Android and iOS
  4. 4. Teamstudio Unplugged • Your mobile Domino server: take your IBM Notes apps with you! • End-users access Notes applications from mobile devices whether online or offline • Leverages the powerful technology of XPages
  5. 5. Unplugged Templates • Continuity – Mobile offline access to BCM programs • OneView Approvals – Expense approvals; anywhere, anytime • CustomerView – lightweight CRM framework for field sales and field service teams • Contacts – customer information database • Activities – customer activity log • Media – mobile offline file storage and access
  6. 6. XControls • Set of Controls for IBM Domino XPages developers working on new XPages apps and on app modernization projects • Re-write of the Teamstudio Unplugged Controls project, but adds full support for PC browser-based user interfaces as well as mobile interfaces • Enables XPages developers to create controls that are responsive • Learn more: http://xcontrols.org
  7. 7. Teamstudio Services • Professional services for modernization, web enablement, project management, development, and administration o Modernization Services o Unplugged Developer Assistance Program o Application Upgrade Analysis o Application Complexity Analysis o Application Usage Auditing • http://www.teamstudio.com/solutions/services/
  8. 8. • Usage Auditing promotion: o Now through Mar. 31, 2015, sign up for a free demo of Usage Auditing, and be entered to win a Nexus 6. • Engage: Mar. 30-31, 2015 o Come see us in Ghent, Belgium for a chance to win an iPhone 6!
  9. 9. 1 #XPages Your Host Today: Paul Della-Nebbia TLCC @PaulDN A Notes Developer’s Journey Into Java
  10. 10. How can TLCC Help YOU! 2 • Private classes at your location or virtual •XPages Development •Support Existing Apps •Administration • Let us help you become an expert XPages developer! • Delivered via Notes • XPages • Development • Admin • User Self- Paced Courses Mentoring Instructor- Led Classes Application Development and Consulting Free Demo Courses!
  11. 11. TLCC Java Courses and Package for XPages Developers Java 1 for XPages Development (9.0) • Covers the Java Language Java 2 for XPages Development • Debugging • Expression Language • JavaBeans and Managed Beans • Third Party Java Libraries • Exporting to PDF and Excel files • On Sale for $599, save $300 Java for XPages Package • Has both Java courses • On Sale for only $999, save $700 3 Click here for more information on the Java courses Sale prices good through 3/15/2015
  12. 12. Upcoming and Recorded Webinars 4 • March 17th - Presenting Data - Two Alternatives to the View Control www.tlcc.com/xpages-webinar View Previous Webinars (use url above)
  13. 13. Asking Questions – Q and A at the end 5 Use the Orange Arrow button to expand the GoToWebinar panel Then ask your questions in the Questions pane! We will answer your questions verbally at the end of the webinar
  14. 14. Your Presenter Today: 6 #XPages Howard Greenberg TLCC @TLCCLtd
  15. 15. Intro - A Notes Developer’s Journey into Java • Been doing object oriented programming with LotusScript • Used Java before in agents and web services, and snippets in XPages • Helped write TLCC’s Java courses since R5 7 Join me on my journey with a Java Managed Bean
  16. 16. TLCC Catalog – “Before” • User chooses a version • Then load the category names into scoped variables XPages, LotusScript, etc. • User then selects type or category • Repeat control figures out what to show – Uses FT search • Change anything and it all reloads • Hard to control order 8
  17. 17. End Goal • Improve Performance • Simpler Implementation • Reusable Architecture for future enhancements – Mobile design – Different layout using Bootstrap 9
  18. 18. Solution – Managed Bean • Rough idea of what was needed… • Data kept in memory – Be careful here • Return a collection of Strings for Types and Categories for each version • Be able to get a collection of all courses for: – A specific version – A type within that version (Dev or Admin) – A category for that version (XPages, Java, etc.) – A category within that type for that version • Then for each course return information to display – Name – Price – Short Description – And more from the view columns – But NOT the actual catalog document contents • that is another XPage 10
  19. 19. What is a Java Bean? A JavaBean is a Java class that: • Uses getter and setter methods to access its property elements • Encapsulates many objects into a single bean object JavaBean Requirements/Conventions For a Java class to be considered a "bean" it must: • Have a public no-argument constructor (or no constructors) • The class properties (fields) must be defined as private • Uses public method calls that start with get, set, or is • Implements java.io.Serializable interface to be technically qualified as a JavaBean – Important for XPages if they are serialized to disk – Reminder!!! Don’t EVER store a Domino object in a bean or scoped variable 11
  20. 20. 12 Sample Bean
  21. 21. What is a Managed Bean? • Bean registered with defined scope in the runtime framework – getter and setter methods are called directly – No need to instantiate an object variable for the bean • Follows all of the same conventions as a Java Bean • Programming a Java Bean is the same as a Managed Bean – Nothing in the Java source defines a "Managed Bean“ • For XPages, defined in Faces-config 13
  22. 22. Objects • Versions – collection of versions, each version holds a types object – R9, R85, R8 • Types – each type holds a Categories object that has the categories for that type – Dev or Admin • Categories – each category holds a CourseList – XPages, Java, LotusScript • CourseList – Holds a collection of courses • Course – Holds details about a particular course 14
  23. 23. Object Definition •Name •Price •etc Course •ArrayList •Holds Courses Course List •LinkedHashMap •Key: Category Name •Value: CourseList for that category CategoryTable •LinkedHashMap •Key: Type Name •Value: CategoryTable TypeTable 15
  24. 24. Java Environment • Domino Designer is built on Eclipse – Full Java development platform • Java Perspective –Window, Open Perspective 16
  25. 25. Java Useful Collections - ArrayList • ArrayLists are like Arrays but: – Part of the Collection class – Don’t have to set a size like Arrays – Can use Generics • ArrayList<Course> CourseList = new ArrayList<Course>(); – Add using: • add(object) – CourseList.add(newCourse) • addAll(collection of objects) –CourseList.addAll(setOfCourses) – Useful in Repeats! • Pass an ArrayList to a repeat value property 17
  26. 26. Java Collections - LinkedHashMap • Holds a key – value pair • Maintains Insertion Order • Create: – LinkedHashMap<String, CoursesList> CatTable; • Set and access a value: – CatTable.put(“XPages Courses”, CourseList); – CatTable.get(“XPages Courses”) • To loop through: – All entries: CatTable.entrySet() – Keys only: CatTable.keyset() – Values only: CatTable.values() 18
  27. 27. Choosing a Collection • Key considerations – Automatic Sorting • TreeSet, TreeMap – Maintains Insertion Order • LinkedHashSet, Linked HashMap – Holds Key,Value pairs • HashMap, TreeMap, LinkedHashMap – Duplicates • ArrayList • Most Often Used! – ArrayList – LinkedHashMap – TreeMap 19
  28. 28. Which Collection to Use? A Handy Flow Chart 20 http://www.sergiy.ca/guide-to-selecting-appropriate-map-collection-in-java/ http://www.janeve.me/articles/which-java-collection-to-use
  29. 29. Managed Beans in XPages • Implemented in faces-config.xml • Choose scope (or don’t: then bean gets instantiated on every access) • Can set values of properties in faces-config via managed-property • Initialize values using: – Constructor in bean (remember, no arguments) – Using the setters – Managed-property in faces-config file • Bean reloads if you change Java code (no need to restart HTTP) <managed-bean> <description>description</description> <managed-bean-name>beanName</managed-bean-name> <managed-bean-class>beanClass</managed-bean-class> <managed-bean-scope>beanScope</managed-bean-scope> </managed-bean> 21
  30. 30. Accessing Beans in XPages via SSJS • No need to declare or instantiate bean – beanName.getPropertyName(); – beanName.setPropertyName(); • Examples: – catalogBean.getTypes(); – catalogBean.getAllCoursesByCategory(typeVal, interestVal); 22
  31. 31. Accessing a Bean via Expression Language • Preferred way (compared to SSJS) – beanName.propertyName • Don’t add get or is in front of name, watch case – (use leading lowercase even though method has uppercase) – If Java code was “public List<String> getTypes(){…” catalogBean.types • Can not pass in parameters 23
  32. 32. Performance Gains (total load time) 24 Task Before Bean After Bean Initial Access 1,350ms 598ms Change versions 657ms 231ms Select type 352ms 235ms Choose category 352ms 120ms
  33. 33. Back End Profiler (XPages Toolbox) – Change Versions 25 Without Bean: 2787 calls 188ms With Bean: 146 calls 0ms
  34. 34. 26 Our Bean is roasted…(In other words, that is the end)
  35. 35. TLCC Java Courses and Package for XPages Developers Java 1 for XPages Development (9.0) • Covers the Java Language Java 2 for XPages Development • Debugging • Expression Language • JavaBeans and Managed Beans • Third Party Java Libraries • Exporting to PDF and Excel files • On Sale for $599, save $300 Java for XPages Package • Has both Java courses • On Sale for only $999, save $700 27 Click here for more information on the Java courses Sale prices good through 3/15/2015
  36. 36. Questions???? 28 Use the Orange Arrow button to expand the GoToWebinar panel Then ask your questions in the Questions panel! Remember, we will answer your questions verbally
  37. 37. Upcoming Events: Entwickler Camp, March 2-4th, in Gelsenkirchen, Germany Engage, March 30/31 in Ghent, Belgium Question and Answer Time! 29 Teamstudio Questions? contactus@teamstudio.com 978-712-0924 TLCC Questions? howardg@tlcc.com paul@tlcc.com 888-241-8522 or 561-953-0095 Howard Greenberg #XPages @TLCCLtd @Teamstudio @PaulDN Paul Della-Nebbia Courtney Carter To learn more about Java in XPages: Special offer for webinar attendees on TLCC’s Java Package

×