unlock enterprise databases to create new online services with magnolia and grails
DESCRIPTION
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.TRANSCRIPT
![Page 1: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/1.jpg)
WebCastPeter Wayner
1
Magnolia + Grails = Maglev
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 2: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/2.jpg)
WebCastPeter Wayner
2
MaglevTable-driven data with GrailsTemplate-driven pages with Magnolia
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 3: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/3.jpg)
3
Is it possible to mix the ease of Grails with the
Magnolia?
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 4: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/4.jpg)
4
Yes! With Maglev, a plugin
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 5: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/5.jpg)
5
Grails is a Java-based Web App FrameworkGrails is open sourceGrails is template-driven (GSP and JSP)Grails is extendable with plugins.
Why?
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 6: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/6.jpg)
6
Magnolia is a Java-based Content Management SystemMagnolia is open sourceMagnolia is template-driven (Freemarker and JSP)Magnolia is extendable with plugins.
Magnolia is Similar
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 7: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/7.jpg)
7
Developed by Kimmo Björnsson and Åke Argéus, Lead Developers, Bonheur ABThey saw that the two tools that complemented each other well.They turned Magnolia into a plugin that lives in Grails.
Invention
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 8: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/8.jpg)
8
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
Let’s mix them together
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 9: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/9.jpg)
9
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.)
Benefits
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 10: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/10.jpg)
10
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.
Example
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 11: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/11.jpg)
11
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.
}
Grails just needs an object definition
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 12: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/12.jpg)
12
class AffiliateItem {
static constraints = {
name blank:false, unique:true
url url:true,blank:false, unique:true
shortDescription maxSize:26
longDescription widget:textarea
}
/// ….
Grails lets you add constraints
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 13: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/13.jpg)
13
class AffiliateItemController{
static scaffold = true
}
Just add a controller
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 14: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/14.jpg)
14
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.
One button and Grails Finishes
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 15: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/15.jpg)
15
package testgrails1
import org.springframework.dao.DataIntegrityViolationException
class AffiliateItemController {
static allowedMethods = [save: "POST", update: "POST", delete: "POST"]
def index() {
redirect(action: "list", params: params)
}
def list() {
params.max = Math.min(params.max ? params.int('max') : 10, 100)
[affiliateItemInstanceList: AffiliateItem.list(params), affiliateItemInstanceTotal: AffiliateItem.count()]
}
def create() {
[affiliateItemInstance: new AffiliateItem(params)]
}
def save() {
def affiliateItemInstance = new AffiliateItem(params)
if (!affiliateItemInstance.save(flush: true)) {
render(view: "create", model: [affiliateItemInstance: affiliateItemInstance])
return
}
flash.message = message(code: 'default.created.message', args: [message(code: 'affiliateItem.label', default: 'AffiliateItem'), affiliateItemInstance.id])
redirect(action: "show", id: affiliateItemInstance.id)
}
def show() {
def affiliateItemInstance = AffiliateItem.get(params.id)
if (!affiliateItemInstance) {
flash.message = message(code: 'default.not.found.message', args: [message(code: 'affiliateItem.label', default: 'AffiliateItem'), params.id])
redirect(action: "list")
return
}
[affiliateItemInstance: affiliateItemInstance]
}
def edit() {
def affiliateItemInstance = AffiliateItem.get(params.id)
if (!affiliateItemInstance) {
flash.message = message(code: 'default.not.found.message', args: [message(code: 'affiliateItem.label', default: 'AffiliateItem'), params.id])
redirect(action: "list")
return
}
[affiliateItemInstance: affiliateItemInstance]
}
def update() {
def affiliateItemInstance = AffiliateItem.get(params.id)
if (!affiliateItemInstance) {
flash.message = message(code: 'default.not.found.message', args: [message(code: 'affiliateItem.label', default: 'AffiliateItem'), params.id])
redirect(action: "list")
return
}
if (params.version) {
def version = params.version.toLong()
if (affiliateItemInstance.version > version) {
affiliateItemInstance.errors.rejectValue("version", "default.optimistic.locking.failure",
[message(code: 'affiliateItem.label', default: 'AffiliateItem')] as Object[],
"Another user has updated this AffiliateItem while you were editing")
render(view: "edit", model: [affiliateItemInstance: affiliateItemInstance])
return
}
}
affiliateItemInstance.properties = params
if (!affiliateItemInstance.save(flush: true)) {
render(view: "edit", model: [affiliateItemInstance: affiliateItemInstance])
return
}
flash.message = message(code: 'default.updated.message', args: [message(code: 'affiliateItem.label', default: 'AffiliateItem'), affiliateItemInstance.id])
redirect(action: "show", id: affiliateItemInstance.id)
}
def delete() {
def affiliateItemInstance = AffiliateItem.get(params.id)
if (!affiliateItemInstance) {
flash.message = message(code: 'default.not.found.message', args: [message(code: 'affiliateItem.label', default: 'AffiliateItem'), params.id])
redirect(action: "list")
return
}
try {
affiliateItemInstance.delete(flush: true)
flash.message = message(code: 'default.deleted.message', args: [message(code: 'affiliateItem.label', default: 'AffiliateItem'), params.id])
redirect(action: "list")
}
catch (DataIntegrityViolationException e) {
flash.message = message(code: 'default.not.deleted.message', args: [message(code: 'affiliateItem.label', default: 'AffiliateItem'), params.id])
redirect(action: "show", id: params.id)
}
}
}
Just some of the code built by Grails for free
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 16: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/16.jpg)
16
What the user sees
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 17: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/17.jpg)
17
Magnolia just needs a controller that can search the tables for what it wants.A template can format what is found.
What Magnolia Does
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 18: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/18.jpg)
18
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()]
}
}
MainTemplateController
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 19: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/19.jpg)
19
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()]
}
}
MainTemplateController
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 20: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/20.jpg)
20
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()]
}
}
MainTemplateController
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 21: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/21.jpg)
21
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()]
}
}
MainTemplateController
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 22: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/22.jpg)
22
<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>
Index.gsp
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 23: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/23.jpg)
23
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>
Index.gsp
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 24: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/24.jpg)
24
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>
Index.gsp
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 25: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/25.jpg)
25
Index.gsp becomes a template for MagnoliaMagnolia glues it together into the web site like all of the other templates and blocksThe Grails blocks sit next to the others.
Magnolia Takes Over
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 26: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/26.jpg)
26
More complicated templates.More logic in the Controllers.Magnolia glues them all together in a nice layout.
What Next?
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 27: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/27.jpg)
27
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
Resources
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 28: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/28.jpg)
28 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 29: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/29.jpg)
29 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
Section title with abstract
![Page 30: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/30.jpg)
30 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
Section titlewith image
![Page 31: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/31.jpg)
31
Lay the foundation for future successImprove usabilitySimplify customizationLower the entry barrierDon’t change what worksProvide a migration path
List of points without subtopics
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 32: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/32.jpg)
32
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…
Title and bullets
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 33: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/33.jpg)
33
Enterprise Edition
• Best choice for mission critical websites
• Supported by the vendor
• Advanced enterprise features
• Visible source via Magnolia Network Agreement
• Cost effective
• Double the Speed
Community Edition
• Basic content management functionality
• Supported by the community
• Free for unlimited use
• Open source
• Cost effective
• Double the Speed
Title and bullets – 2 columns
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 34: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/34.jpg)
34
POJOs (Definitions)
• Dialogs, trees, actions
• Vaadin independentContributed in various ways
• Configuration
• Annotations
• ProgrammaticallyUI Builder builds the Vaadin components
Title, bullets & picture
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 35: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/35.jpg)
35
Title and picture horizontal
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 36: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/36.jpg)
36 Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
Series 1, 2, 3, 4Each step one slide
1 2 3 4
![Page 37: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/37.jpg)
37
Where does great content come from?
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 38: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/38.jpg)
38
It takes about ten seconds to explain how to create
content!
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
![Page 39: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/39.jpg)
39
Clouds
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
DevelopmentAuthoring
Accessibility
Configuration UIWizards
Developer mode
AdminCentralPage editing
ClipboardSaved lists
Search
KeyboardLTR/RTL
MobileTouch
![Page 40: Unlock Enterprise Databases to Create New Online Services with Magnolia and Grails](https://reader037.vdocument.in/reader037/viewer/2022102901/554bd2a1b4c905706a8b4da4/html5/thumbnails/40.jpg)
DD.MM.YYYY at Venue/[email protected]
First Last, RoleMagnolia International Ltd.
40
www.magnolia-cms.com
Final slide
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.