37
A Notes Developer's Journey into Java Tweet about this event And mention us: @Teamstudio @TLCCLTD Feb. 17, 2015

A Notes Developer's Journey into Java

Embed Size (px)

Citation preview

Page 1: A Notes Developer's Journey into Java

A Notes Developer's Journey into Java

Tweet about this event

And mention us: @Teamstudio @TLCCLTD

Feb. 17, 2015

Page 2: A Notes Developer's Journey into Java

@Teamstudio

teamstudio.com

@TLCCLTD

tlcc.com

Courtney CarterInbound Marketing Specialist

Teamstudio

Page 3: A Notes Developer's Journey into Java

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

Page 4: A Notes Developer's Journey into Java

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

Page 5: A Notes Developer's Journey into Java

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

Page 6: A Notes Developer's Journey into Java

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

Page 7: A Notes Developer's Journey into Java

Teamstudio Services

• Professional services for modernization, web

enablement, project management, development,

and administrationo 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/

Page 8: A Notes Developer's Journey into Java

• 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!

Page 9: A Notes Developer's Journey into Java

1

#XPages

Your Host Today:

Paul Della-NebbiaTLCC

@PaulDN

A Notes Developer’s Journey Into Java

Page 10: A Notes Developer's Journey into Java

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

• UserSelf-

Paced Courses

Mentoring

Instructor-Led

Classes

Application Development

and Consulting

Free Demo

Courses!

Page 11: A Notes Developer's Journey into Java

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

Page 12: A Notes Developer's Journey into Java

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)

Page 13: A Notes Developer's Journey into Java

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

Page 14: A Notes Developer's Journey into Java

Your Presenter Today:

6

#XPages

Howard GreenbergTLCC

@TLCCLtd

Page 15: A Notes Developer's Journey into Java

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

Page 16: A Notes Developer's Journey into Java

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

Page 17: A Notes Developer's Journey into Java

End Goal

• Improve Performance

• Simpler Implementation

• Reusable Architecture for future enhancements

– Mobile design

– Different layout using Bootstrap

9

Page 18: A Notes Developer's Journey into Java

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 XPage10

Page 19: A Notes Developer's Journey into Java

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/ConventionsFor 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

Page 20: A Notes Developer's Journey into Java

12

Sample Bean

Page 21: A Notes Developer's Journey into Java

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

Page 22: A Notes Developer's Journey into Java

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

Page 23: A Notes Developer's Journey into Java

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

Page 24: A Notes Developer's Journey into Java

Java Environment

• Domino Designer is built on Eclipse

– Full Java development platform

• Java Perspective

–Window, Open Perspective

16

Page 25: A Notes Developer's Journey into Java

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

Page 26: A Notes Developer's Journey into Java

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

Page 27: A Notes Developer's Journey into Java

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

Page 28: A Notes Developer's Journey into Java

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

Page 29: A Notes Developer's Journey into Java

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

Page 30: A Notes Developer's Journey into Java

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

Page 31: A Notes Developer's Journey into Java

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

Page 32: A Notes Developer's Journey into Java

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

Page 33: A Notes Developer's Journey into Java

Back End Profiler (XPages Toolbox) – Change Versions

25

Without Bean:2787 calls188ms

With Bean:146 calls0ms

Page 34: A Notes Developer's Journey into Java

26

Our Bean is roasted…(In other words, that is the end)

Page 35: A Notes Developer's Journey into Java

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

Page 36: A Notes Developer's Journey into Java

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

Page 37: A Notes Developer's Journey into Java

Upcoming Events:Entwickler Camp, March 2-4th, in Gelsenkirchen, GermanyEngage, March 30/31 in Ghent, Belgium

Question and Answer Time!

29

Teamstudio [email protected]

978-712-0924

TLCC [email protected] [email protected]

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