This webinar is extremely useful for Java and Grails developers of all levels, as well as IT professionals and system integrators interested in application integration for business solutions.
How to Troubleshoot Apps for the Modern Connected Worker
Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails
1. Magnolia + Grails = Maglev
Peter Wayner WebCast
1 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
2. Maglev
Table-driven data with Grails
Template-driven pages with Magnolia
Peter Wayner WebCast
2 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
3. Is it possible to mix the ease of
Grails with the Magnolia?
3 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
4. Yes! With Maglev, a plugin
4 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
5. Why?
Grails is a Java-based Web App
Framework
Grails is open source
Grails is template-driven (GSP and JSP)
Grails is extendable with plugins.
5 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
6. Magnolia is Similar
Magnolia is a Java-based Content
Management System
Magnolia is open source
Magnolia is template-driven (Freemarker
and JSP)
Magnolia is extendable with plugins.
6 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
7. Invention
Developed by Kimmo Björnsson and Åke
Argéus, Lead Developers, Bonheur AB
They saw that the two tools that
complemented each other well.
They turned Magnolia into a plugin that
lives in Grails.
7 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
8. Let’s mix them together
Maglev bundles together all of Magnolia
into a Grails plugin.
It’s plugged into Grails, but Magnolia ends
up driving the front.
Grails handles the table-driven objects.
Magnolia handles the templates
8 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
9. Benefits
Rapid prototyping. Grails builds
databases quickly.
Data/Content integration. Magnolia knits
together content well.
Separation of code from presentation.
(Grails handles backend, Magnolia the
front.)
9 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
10. Example
Affiliate marketing for a web site needs a
table of URLs. If someone clicks on the
URL, the web site gets some revenue.
Lets store them in a table.
Display them in a Magnolia template.
10 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
11. Grails just needs an object definition
class AffiliateItem {
String name // The item being advertised.
Date dateCreated // When started.
String url // Where the item can be purchased.
String shortDescription // A short description.
String longDescription // A long description.
Date startDate // When available.
Date stopDate // The last day it is available.
}
11 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
12. Grails lets you add constraints
class AffiliateItem {
static constraints = {
name blank:false, unique:true
url url:true,blank:false, unique:true
shortDescription maxSize:26
longDescription widget:textarea
}
/// ….
12 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
13. Just add a controller
class AffiliateItemController{
static scaffold = true
}
13 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
14. One button and Grails Finishes
Grails builds CRUD (create, update,
delete) routines for object tables.
You start up Grails and it analyzes your
object definition.
Then it creates all of the code necessary
to let you build up tables filled with the
objects.
14 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
16. What the user sees
16 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
17. What Magnolia Does
Magnolia just needs a controller that can
search the tables for what it wants.
A template can format what is found.
17 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
18. MainTemplateController
import info.magnolia.module.blossom.annotation.Template
@Template(id = "grailsModule:pages/demoTemplate", title = "Demo template")
class MainTemplateController {
def index() {
[count:AffiliateItem.count(), items:AffiliateItem.list()]
}
}
18 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
19. MainTemplateController
There are some static methods for looking through the tables of
AffiliateItems.
import info.magnolia.module.blossom.annotation.Template
@Template(id = "grailsModule:pages/demoTemplate", title = "Demo template")
class MainTemplateController {
def index() {
[count:AffiliateItem.count(), items:AffiliateItem.list()]
}
}
19 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
20. MainTemplateController
The index method calls the static search methods and bundles
the results into a data structure for the template. You can add
extra search logic and filtering here.
import info.magnolia.module.blossom.annotation.Template
@Template(id = "grailsModule:pages/demoTemplate", title = "Demo template")
class MainTemplateController {
def index() {
[count:AffiliateItem.count(), items:AffiliateItem.list()]
}
}
20 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
21. MainTemplateController
The Template annotation connects the controller with the
templates.
import info.magnolia.module.blossom.annotation.Template
@Template(id = "grailsModule:pages/demoTemplate", title = "Demo template")
class MainTemplateController {
def index() {
[count:AffiliateItem.count(), items:AffiliateItem.list()]
}
}
21 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
22. Index.gsp
<div class="body">
There are <i> <%= count %></i> AffiliateItems
<ul>
<g:each in="${items}" var="x">
<li><a href=”${x.url}”>${x.name}</a> --
<i>${x.longDescription}</i></li> </g:each>
</ul>
</div>
22 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
23. Index.gsp
The count is just a number collected from the
AffiliateItem.count() static routine in the Controller.
<div class="body">
There are <i> <%= count %></i> AffiliateItems
<ul>
<g:each in="${items}" var="x">
<li><a href=”${x.url}”>${x.name}</a> --
<i>${x.longDescription}</i></li> </g:each>
</ul>
</div>
23 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
24. Index.gsp
Grails loops through the list of objects created by the
AffiliateItem.list() method in the Controller.
<div class="body">
There are <i> <%= count %></i> AffiliateItems
<ul>
<g:each in="${items}" var="x">
<li><a href=”${x.url}”>${x.name}</a> --
<i>${x.longDescription}</i></li> </g:each>
</ul>
</div>
24 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
25. Magnolia Takes Over
Index.gsp becomes a template for
Magnolia
Magnolia glues it together into the web
site like all of the other templates and
blocks
The Grails blocks sit next to the others.
25 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
26. What Next?
More complicated templates.
More logic in the Controllers.
Magnolia glues them all together in a nice
layout.
26 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
27. Resources
Introduction http://wiki.magnolia-cms.com/display/TALKOOT/Creating+Database-
driven+Web+Applications+with+Magnolia+CMS,+Groovy+and+Maglev
Maglev quickstart
https://github.com/Bonheur/maglev/wiki/Quick-
Start
Maglev downloads
https://github.com/Bonheur/maglev/downloads
Maglev JIRA site. http://jira.magnolia-
cms.com/browse/MAGLEV
http://www.magnolia-cms.com/community/magnolia-
conference/program/presentation-
day/presentations/bonheur-ab.html
27 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
28. 28 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
29. Section title with abstract
29 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
30. Section title
with image
30 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
31. List of points without subtopics
Lay the foundation for future success
Improve usability
Simplify customization
Lower the entry barrier
Don’t change what works
Provide a migration path
31 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
32. Title and bullets
Editor
• Exposed by View (HasEditors)
• Populate View with data
• Retrieve values entered by user
Driver
• Injects values into editors
• Updates underlying model (node, bean)
• Validates data
Used in various editable views
• DialogView, TreeView, ParagraphEditView…
32 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
33. Title and bullets – 2 columns
Enterprise Edition Community Edition
• Best choice for mission • Basic content
critical websites management
• Supported by the vendor functionality
• Advanced enterprise • Supported by the
features community
• Visible source via • Free for unlimited use
Magnolia Network • Open source
Agreement • Cost effective
• Cost effective • Double the Speed
• Double the Speed
33 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
34. Title, bullets & picture
POJOs (Definitions)
• Dialogs, trees, actions
• Vaadin independent
Contributed in various ways
• Configuration
• Annotations
• Programmatically
UI Builder builds the Vaadin
components
34 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
35. Title and picture horizontal
35 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
36. 1 2 3 4
Series 1, 2, 3, 4
Each step one slide
36 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
37. Where does great content come
from?
37 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
38. It takes about ten seconds to
explain how to create content!
38 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
39. Keyboard
LTR/RTL
Accessibility
Touch Mobile
Clouds
AdminCentral Configuration UI
Page editing Wizards
Authoring Development
Search Clipboard
Saved lists Developer mode
39 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
40. Final slide
First Last, Role DD.MM.YYYY at Venue/Customer
Magnolia International Ltd. first.last@magnolia-cms.com
www.magnolia-cms.com
40 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.