Top Banner
Transformations Smart Application Migration Oliver Busse, 31.03.2015, 13:30, Room D
33

Transformations

Jul 16, 2015

Download

Software

Oliver Busse
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Transformations

Transformations

Smart Application Migration

Oliver Busse, 31.03.2015, 13:30, Room D

Page 2: Transformations

Agenda

•About me

•What‘s this?

•Preamble

•Migrate database and user profiles• Legacy profile documents vs. Java Beans• Value lists made available over the whole application

•User and environment information• What can a user see and use?

•Extending Fulltext search to a facetted search• Filtering your data with meta tags

Page 3: Transformations

Oliver Busse

• „Bleeding Yellow“ since 2000• OpenNTF Board Member• IBM Champion for ICS in 2015• Engage.UG first-timer

Page 4: Transformations

Overview

•What‘s this?• Transforming & re-using commonly used legacy patterns in

XPages• Don‘t fear Java • Avoid @Formulas in SSJS• Ideas for best practices

•What‘s it not?• An XPages Introduction• A Java beginner‘s guide• A complete application migration strategy

Page 5: Transformations

Preamble

•Why not to use SSJS „excessively“?• SSJS is interpreted at runtime• SSJS is compiled at runtime (every time you call it!)• Compiled SSJS is hard to debug while executed

Page 6: Transformations

6#engageug

Migrating database and user profiles

Page 7: Transformations

What we find in legacy apps: profile documents

Disadvantages• You cannot see them without

using tools• You can edit and create them

only programmatically• Sometimes replication issues• Unwanted Caching ;-)

Advantages• Quick access without using

lookup views• Caching

Page 8: Transformations

What we missed in many cases

DatabaseScript != Global Declarations

Encapsuled, no access from outside(except Database Events)

Page 9: Transformations

Performance-Killer

Numerous usage of those formulas slow down the app

one of many...

Page 10: Transformations

Transformation

Item1=Values1Item2=Values2Item3=Values3

...

NotesDocument

Key1=ValueMap1Key2=ValueMap2Key3=ValueMap3

...

HashMap

NSF-based, view lookup Memory-based, direct access

Page 11: Transformations

Ingredients

•Transformation of profile documents to „standard“ documents

1. Create a corresponding lookup view2. Optional: corresponding forms for maintenance3. Create the Java Bean classes4. Define those Bean classes in faces-config.xml

Page 12: Transformations

Preparation: Lookup Views

•Key for Database Profiles = dbprofile

•Key for User Profiles = Canonical Name

•Key for Value Lists = free but unique

Page 13: Transformations

Preparation: Java Beans

• 3 Classes:• DatabaseProfileBean• AppConfigBean• UserProfileBean

• The DatabaseProfileBean initializes the document if it doesn‘t exist

• The UserProfileBean initializes the document when the user saves it for the first time

Page 14: Transformations

faces-config.xml<faces-config>

<!-- Database Profile Bean --><managed-bean>

<managed-bean-name>dbprofile</managed-bean-name><managed-bean-class>com.icsug.DatabaseProfileBean</managed-bean-class><managed-bean-scope>application</managed-bean-scope>

</managed-bean><!-- User Profile Bean --><managed-bean>

<managed-bean-name>userprofile</managed-bean-name><managed-bean-class>com.icsug.UserProfileBean</managed-bean-class><managed-bean-scope>session</managed-bean-scope>

</managed-bean><!-- Application Configuration --><managed-bean>

<managed-bean-name>application</managed-bean-name><managed-bean-class>com.icsug.AppConfigBean</managed-bean-class><managed-bean-scope>application</managed-bean-scope>

</managed-bean></faces-config>

Page 15: Transformations

Digression: Bean Scopes & Lifecycles

•Request• Lives beginning with the request to receiving the response

•View• Within a page until changing the page, even during partial

refreshes

•Session• Per user session

•Application• During the life time of th application (e.g. until server restart or

calling an initialization method)

Page 16: Transformations

DEMO

Page 17: Transformations

17#engageug

User and Environment Information

Page 18: Transformations

User and Environment Information

Name variations

Access Level

ACL Options notes.ini variables

EnvironmentBean

Page 19: Transformations

faces-config.xml: EnvironmentBean

19#engageug

<?xml version="1.0" encoding="UTF-8"?><faces-config>

<!-- Environment Bean --><managed-bean>

<managed-bean-name>env</managed-bean-name><managed-bean-class>com.icsug.EnvironmentBean</managed-bean-class><managed-bean-scope>view</managed-bean-scope>

</managed-bean>

</faces-config>

Page 20: Transformations

Example: Username Variations

<p><xp:label

value="#{javascript:env.userName}"id="label1">

</xp:label></p><p>

<xp:labelvalue="#{javascript:env.commonUserName}"id="label2">

</xp:label></p><p>

<xp:labelvalue="#{javascript:env.abbreviatedUserName}"id="label3">

</xp:label></p>

Page 21: Transformations

Example: ACL Options

The delete button is only visible if the user can delete documents

Page 22: Transformations

Even in themes!

22#engageug

<themeextends="flatly"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="platform:/plugin/com.ibm.designer.domino.style

kits/schema/stylekit.xsd"><!--display a submit type button only if user can create documents via ACL--><control>

<name>Button.Submit</name><property

type="boolean"><name>rendered</name><value>#{env.createDocuments}</value>

</property></control>

</theme>

Page 23: Transformations

DEMO

Page 24: Transformations

24#engageug

Extending Fulltext-Search to a Facetted Search

Page 25: Transformations

Facetted Search

„Faceted search, also called faceted navigation or faceted browsing, is a technique for accessing information organized according to a faceted classification system, allowing users to explore a collection of information by applying multiple filters.“

http://en.wikipedia.org/wiki/Faceted_search

Page 26: Transformations

Facetted Search

Page 27: Transformations

„Well-known“ Examples

amazing.com cyberharbor

muse

Page 28: Transformations

Facetted Search with Domino?

1. Fulltext Search

2. Filtering result from extra meta data

1. Meta data search with facet selection

2. Fulltext Search in results

Page 29: Transformations

FacettedSearchBean (Session scoped)

FacetsSearch Term

FacettedSearchBean

DocumentCollection(ArrayList<SearchResultEntry>)

Page 30: Transformations

30#engageug

DEMO

Page 31: Transformations

Facetted Search: Outlook & Alternatives

•Using OpenNTF API‘s Graph-DB functions

•Using a 3rd party Graph-DB like Apache Solr

31#engageug

Page 32: Transformations

Q & A

32#engageug

Page 33: Transformations

Resources

http://en.wikipedia.org/wiki/Faceted_search

http://lucene.apache.org/solr/

https://www.focul.net/focul-best-practice-faceted-filtering-xpages-using-java-beans/

https://bitbucket.org/zeromancer1972/icsug-2015-demo