Upload
teamstudio
View
425
Download
0
Tags:
Embed Size (px)
Citation preview
A Notes Developer's Journey into Java
Tweet about this event
And mention us: @Teamstudio @TLCCLTD
Feb. 17, 2015
@Teamstudio
teamstudio.com
@TLCCLTD
tlcc.com
Courtney CarterInbound Marketing Specialist
Teamstudio
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
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
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
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
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/
• 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!
1
#XPages
Your Host Today:
Paul Della-NebbiaTLCC
@PaulDN
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!
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
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)
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
Your Presenter Today:
6
#XPages
Howard GreenbergTLCC
@TLCCLtd
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
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
End Goal
• Improve Performance
• Simpler Implementation
• Reusable Architecture for future enhancements
– Mobile design
– Different layout using Bootstrap
9
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
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
12
Sample Bean
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
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
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
Java Environment
• Domino Designer is built on Eclipse
– Full Java development platform
• Java Perspective
–Window, Open Perspective
16
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
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
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
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
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
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
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
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
Back End Profiler (XPages Toolbox) – Change Versions
25
Without Bean:2787 calls188ms
With Bean:146 calls0ms
26
Our Bean is roasted…(In other words, that is the end)
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
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
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