SmartNSF - 100% Smart - and in Color!
June 13, 2017
This webinar is brought to you as part of the
free monthly webinar series from:
Howard Greenberg
@TLCC
Courtney Carter
@Teamstudio
Christian Güdemann
@guedeWebGate
Martin Jinoch
@mjinoch
teamstudio.com/blog
TLCC Courses
• The Leader in Notes and Domino Training since
1997
• Self Paced Distance Learning Courses for
Notes/Domino
– XPages, Development, and Administration (user too!)
• OnSite Private Classes
• Mentoring/Consulting Services
• Free demo courses
– Intro. To XPages Development
– Application Development 1
1
XPages Courses!
FREE !! Introduction to XPages Development
JavaScript for XPages Development
XPages Development 1
XPages Development 2
Rapid XPages Development using Application
Layout and Dojo UI Controls
Java 1 for XPages Developers
Java 2 for XPages Developers
Don’t Miss MWLUG!!!
August 8-10, 2017
Optional Trip to the Air and Space Museum on Friday
Alexandria, VA (just outside D.C.)
40 sessions and workshops!!!
application development, system administration, best practices in
social collaboration, customer business cases, and innovation.
ALL FOR $75!!!
http://www.mwlug.com
Recorded Webinars
www.tlcc.com/xpages-webinar
View Previous Webinars
Asking Questions – Q and A at the end
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
SmartNSF - 100% Smart - and in color!
Christian Guedeman Martin Jinoch
@guedeWebGate
@mjinoch
SmartNSF
100% smart and in Color
Agenda and Co
• You ask Why..?

• Lets Start!

• Strategies for Views and Docs

• It‘s Groovy Baby! – 7 Events to go

• Documentation? What a question... Lets Swagger
You ask Why???
• It all began with the Domino, Detail and Devil Problem aka:





BUSINESS LOGIC is EVERYWHERE
The difference between …
• Business Logic

• Your rules and dependency about your business like:

• If you want to register a new customer, please provide the VAT Number

• No Company without Contact

• Business Logic is independent from the client

• Application behaviour

• Covers questions about “How can I register a new customer”

• Type-a-head for numbers and values

• Is client agnostic (Web Client acts different then Mobile Client)
The Inspiration
How can I convert a simple NSF into a micro-service within minutes?
(To protect the business logic)
app.get('/', function (req, res) {
res.send('Hello World!')
})
app.post('/', function (req, res) {
res.send('Got a POST request')
})
app.put('/user', function (req, res) { res.send('Got a PUT request at /
user')
})
app.delete('/user', function (req, res) { res.send('Got a DELETE request
at /user') })
router.GET('topics') {
strategy(DOCUMENTS_BY_VIEW) {
viewName('($All)')
}
mapJson 'id', json:'id', type:'STRING', isformula:true,
formula:'@DocumentUniqueID'
mapJson "date", json:’date',type:'DATETIME', isformula:true,
formula:'@Created'
mapJson "Subject", json:'topic', type:'STRING'
mapJson "author", json:'author', type:’STRING’, isformula:true,
formula:'@Name([CN]; From)'
}
Let’s go
https://openntf.org/main.nsf/project.xsp?r=project/SmartNSF
Some words about REST
• The power of the „methods”:

• GET -> Give me (one or more objects)

• POST -> Create a new object

• PUT -> Replace the object

• UPDATE -> Update the properties that we submit

• DELETE -> Delete the object

• We do only simple GET, POST and DELETE (for today only)
Show me the view (not the money) but fast!
router.GET(‘topics’) {

strategy(VIEWENTRIES_PAGED) {
viewName('(ByDate)')

}

mapJson '$120', json:'topic', type:’STRING'

mapJson 'author', json:'author', type:’STRING'

mapJson 'date', json:’date', type:'DATETIME'
}
Route for a document
router.GET('topics/{id}') {
strategy(DOCUMENT_BY_UNID) {
keyVariableName('id')

}

mapJson 'date', json:’date',type:'STRING', isformula:true, formula:'@Text(@Created)'
mapJson 'Subject', json:'topic', type:'STRING'
mapJson 'author', json:'author', type:’STRING', isformula:true, formula:'@Name([CN]; From)'
mapJson 'body', json:'content', type:'MIME'
mapJson 'categories', json:'categories', type:'ARRAY_OF_STRING'
}
Strategies
• DOCUMENT_BY_UNID

• DOCUMENT_FROM_VIEW_BY_KEY

• DOCUMENTS_BY_SEARCH_FT_PAGED

• DOCUMENTS_BY_FORMULA_PAGED

• DOCUMENTS_BY_VIEW_PAGED

• DOCUMENTS_FROM_VIEW_BY_KEY_PAGED

• VIEWENTRIES_PAGED

• VIEWENTRIES_BY_CATEGORY_PAGED (available since Beta 4)

• ATTACHMENT

Note: All DOCUMENTS* and VIEWENTRIES* strategies also have non paged versions. Use with
caution, these return the complete dataset at once.
Strategies
• All _PAGED Strategies

• Using start and count as URL Parameters

• Are designed to deliver a fast user experience

• All VIEWENTRIES Strategies

• Are using a view as model

• Do not have a direct access to the document

• Are quite fast

• All DOCUMENT Strategies

• Are slower then the VIEWENTRIES strategies but….

• Let you evaluate complex @Formulas for mapJson mapping
Power of events
• Every Route supports these events

• VALIDATE

• PRE_LOAD_DOCUMENT

• POST_LOAD_DOCUMENT

• POST_NEW_DOCUMENT

• PRE_SAVE_DOCUMENT

• POST_SAVE_DOCUMENT

• PRE_SUBMIT
Groovy in event’s context and Model
• Every Event has a closure

• In each closure the context and the document model are submitted

• Btw. the closure gives you access to the full Java Stack!
Open API Specification, Swagger….
• You wont believe, but your Code is documented! - Built in!
Call to action
• Download the project

• Enter OpenNTF’s Slack space and

become part of #smartnsf

• Documentation: 

https://wiki.openntf.org/display/XRAPI



• Start participating!
Questions????
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
@guedeWebGate
@mjinoch
@TLCCLtd
@Teamstudio
Upcoming Events:
MWLUG in Alexandria, VA on August 8-10, 2017
Question and Answer Time!
Teamstudio Questions?
contactus@teamstudio.com
978-712-0924
TLCC Questions?
howardg@tlcc.com
888-241-8522 or 561-953-0095
Howard Greenberg Courtney CarterChristian Guedeman Martin Jinoch

SmartNSF - 100% Smart - and in Color!

  • 1.
    SmartNSF - 100%Smart - and in Color! June 13, 2017
  • 2.
    This webinar isbrought to you as part of the free monthly webinar series from:
  • 3.
    Howard Greenberg @TLCC Courtney Carter @Teamstudio ChristianGüdemann @guedeWebGate Martin Jinoch @mjinoch
  • 4.
  • 5.
    TLCC Courses • TheLeader in Notes and Domino Training since 1997 • Self Paced Distance Learning Courses for Notes/Domino – XPages, Development, and Administration (user too!) • OnSite Private Classes • Mentoring/Consulting Services • Free demo courses – Intro. To XPages Development – Application Development 1 1
  • 6.
    XPages Courses! FREE !!Introduction to XPages Development JavaScript for XPages Development XPages Development 1 XPages Development 2 Rapid XPages Development using Application Layout and Dojo UI Controls Java 1 for XPages Developers Java 2 for XPages Developers
  • 7.
    Don’t Miss MWLUG!!! August8-10, 2017 Optional Trip to the Air and Space Museum on Friday Alexandria, VA (just outside D.C.) 40 sessions and workshops!!! application development, system administration, best practices in social collaboration, customer business cases, and innovation. ALL FOR $75!!! http://www.mwlug.com
  • 8.
  • 9.
    Asking Questions –Q and A at the end 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
  • 10.
    SmartNSF - 100%Smart - and in color! Christian Guedeman Martin Jinoch @guedeWebGate @mjinoch
  • 11.
  • 12.
    Agenda and Co •You ask Why..? • Lets Start! • Strategies for Views and Docs • It‘s Groovy Baby! – 7 Events to go • Documentation? What a question... Lets Swagger
  • 13.
    You ask Why??? •It all began with the Domino, Detail and Devil Problem aka:
 
 
 BUSINESS LOGIC is EVERYWHERE
  • 14.
    The difference between… • Business Logic • Your rules and dependency about your business like: • If you want to register a new customer, please provide the VAT Number • No Company without Contact • Business Logic is independent from the client • Application behaviour • Covers questions about “How can I register a new customer” • Type-a-head for numbers and values • Is client agnostic (Web Client acts different then Mobile Client)
  • 15.
    The Inspiration How canI convert a simple NSF into a micro-service within minutes? (To protect the business logic) app.get('/', function (req, res) { res.send('Hello World!') }) app.post('/', function (req, res) { res.send('Got a POST request') }) app.put('/user', function (req, res) { res.send('Got a PUT request at / user') }) app.delete('/user', function (req, res) { res.send('Got a DELETE request at /user') }) router.GET('topics') { strategy(DOCUMENTS_BY_VIEW) { viewName('($All)') } mapJson 'id', json:'id', type:'STRING', isformula:true, formula:'@DocumentUniqueID' mapJson "date", json:’date',type:'DATETIME', isformula:true, formula:'@Created' mapJson "Subject", json:'topic', type:'STRING' mapJson "author", json:'author', type:’STRING’, isformula:true, formula:'@Name([CN]; From)' }
  • 16.
  • 17.
    Some words aboutREST • The power of the „methods”: • GET -> Give me (one or more objects) • POST -> Create a new object • PUT -> Replace the object • UPDATE -> Update the properties that we submit • DELETE -> Delete the object • We do only simple GET, POST and DELETE (for today only)
  • 18.
    Show me theview (not the money) but fast! router.GET(‘topics’) { strategy(VIEWENTRIES_PAGED) { viewName('(ByDate)') } mapJson '$120', json:'topic', type:’STRING' mapJson 'author', json:'author', type:’STRING' mapJson 'date', json:’date', type:'DATETIME' }
  • 19.
    Route for adocument router.GET('topics/{id}') { strategy(DOCUMENT_BY_UNID) { keyVariableName('id') } mapJson 'date', json:’date',type:'STRING', isformula:true, formula:'@Text(@Created)' mapJson 'Subject', json:'topic', type:'STRING' mapJson 'author', json:'author', type:’STRING', isformula:true, formula:'@Name([CN]; From)' mapJson 'body', json:'content', type:'MIME' mapJson 'categories', json:'categories', type:'ARRAY_OF_STRING' }
  • 20.
    Strategies • DOCUMENT_BY_UNID • DOCUMENT_FROM_VIEW_BY_KEY •DOCUMENTS_BY_SEARCH_FT_PAGED • DOCUMENTS_BY_FORMULA_PAGED • DOCUMENTS_BY_VIEW_PAGED • DOCUMENTS_FROM_VIEW_BY_KEY_PAGED • VIEWENTRIES_PAGED • VIEWENTRIES_BY_CATEGORY_PAGED (available since Beta 4) • ATTACHMENT
 Note: All DOCUMENTS* and VIEWENTRIES* strategies also have non paged versions. Use with caution, these return the complete dataset at once.
  • 21.
    Strategies • All _PAGEDStrategies • Using start and count as URL Parameters • Are designed to deliver a fast user experience • All VIEWENTRIES Strategies • Are using a view as model • Do not have a direct access to the document • Are quite fast • All DOCUMENT Strategies • Are slower then the VIEWENTRIES strategies but…. • Let you evaluate complex @Formulas for mapJson mapping
  • 22.
    Power of events •Every Route supports these events • VALIDATE • PRE_LOAD_DOCUMENT • POST_LOAD_DOCUMENT • POST_NEW_DOCUMENT • PRE_SAVE_DOCUMENT • POST_SAVE_DOCUMENT • PRE_SUBMIT
  • 23.
    Groovy in event’scontext and Model • Every Event has a closure • In each closure the context and the document model are submitted • Btw. the closure gives you access to the full Java Stack!
  • 24.
    Open API Specification,Swagger…. • You wont believe, but your Code is documented! - Built in!
  • 25.
    Call to action •Download the project • Enter OpenNTF’s Slack space and
 become part of #smartnsf • Documentation: 
 https://wiki.openntf.org/display/XRAPI
 
 • Start participating!
  • 26.
    Questions???? Use the OrangeArrow button to expand the GoToWebinar panel Then ask your questions in the Questions panel! Remember, we will answer your questions verbally
  • 27.
    @guedeWebGate @mjinoch @TLCCLtd @Teamstudio Upcoming Events: MWLUG inAlexandria, VA on August 8-10, 2017 Question and Answer Time! Teamstudio Questions? contactus@teamstudio.com 978-712-0924 TLCC Questions? howardg@tlcc.com 888-241-8522 or 561-953-0095 Howard Greenberg Courtney CarterChristian Guedeman Martin Jinoch