SlideShare une entreprise Scribd logo
1  sur  35
Grails – In Depth Graeme Rocher, CTO – G2One Inc TS-5764
[object Object]
Your Speaker ,[object Object],[object Object],[object Object],[object Object],[object Object]
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What is Groovy? ,[object Object],[object Object],[object Object]
What is Grails? ,[object Object],[object Object],[object Object]
Solid Foundations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Why Groovy & Grails? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Getting Started ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Grails – The Basics ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],> grails create-app gtunes > cd gtunes > grails run-app > grails run-war  // or > grails war
Getting Started with Grails Creating and Running
A Grails Project Ant Build JAR files Grails Sources Web Sources Java Sources
Grails Headline Features ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Grails – The Platform ,[object Object],[object Object],[object Object]
Easy ORM with GORM class Album { String title String artist Date releaseDate static hasMany = [songs:Song] } class Song { String title Double duration } table - album table - song GORM classes, also known as domain  classes, go in the domain directory id title artist release_date id title duration album_id
GORM in Action Querying and Persistence with GORM
The Grails Console Activate with:  grails console
Persistence Methods ,[object Object],[object Object],[object Object],[object Object],new  Album(title:"Tourist",  artist:"Athlete") .addToSongs(title:"Wires", duration:4.20) . save() def  album = Album. get(1) album.title ="Hot Fuss"  album. save() album. delete()
Dynamic Finders & Criteria def albums = Album. list () def recentAlbums =  Album. findAllByReleaseDateGreaterThan (new Date()-7) def albumsStartingWithA = Album. findAllByTitleLike ( "A%") def albumsWithSongsAboutSummer = Album. withCriteria { songs { like("title", "%Summmer%") } } List all records Form method expressions Use “like” queries Construct criteria on the fly to query associations
GORM Features ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],+
Easy MVC with Grails ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Mapping URLs to Controllers ,[object Object],[object Object]," /$controller/$action?/$id? ”() UrlMappings file defines the default mapping, but is completely configurable
Controllers in Action Easy MVC with Grails
Grails Controllers class AlbumController { def  search  = { def albums= Album.findByTitleLike( "%${params.q}%" )  [albumResults:albums]   } } Return a model  as a map Actions are properties assigned a block or closure Controllers go in the “controllers” directory
Trivial Tag Libraries ,[object Object],[object Object],def  cache = {attrs,body->  def  content= store[ attrs.id ] if (!content) content =  body() store[ attrs.id ]= content  } out  << content  } <g: cache  id= &quot;test&quot;> expensive lazy loaded content goes here </g: cache > Write to the response Read tag attributes Invoke the body Tag name matches closure name Pass tag attributes Tag libraries go in the taglib directory
Web Services ,[object Object],[object Object],[object Object],[object Object],[object Object]
RESTful URL Mappings ,[object Object],&quot; /$controller/$id? &quot; { action =  [GET:&quot;show&quot;, POST:&quot;update&quot;, PUT:&quot;save&quot;] } Defined in URLMappings.groovy file
RESTful Marshalling Easy Web Services with Grails
RESTful Marshalling ,[object Object],[object Object],import grails.converters.* … def album = Album.get(params.id) render album as XML def album =  new Album(params.album) send XML to the response Read XML from the request when the root node is <album>
Content Negotiation ,[object Object],def a = Album.get(params.id) withFormat  { html  album:a xml  { render a as XML } json  { render a as JSON } } Request format obtained from ACCEPT header Different response sent based on content type Supported content types configurable in Config.groovy
Easy Ajax with Adaptive Tags ,[object Object],[object Object],< g:remoteLink  action=&quot;showAlbum&quot; /> < g:formRemote  action=&quot;updateAlbum&quot; /> < g:remoteField  action=&quot;changeTitle&quot; update=&quot;titleDiv&quot; name=&quot;title&quot;  value=&quot;${album?.title}&quot;/>
Ajax Plug-ins a Plenty ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Summary ,[object Object],[object Object],[object Object],[object Object]
For More Information ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Grails – in Depth Graeme Rocher TS-5764

Contenu connexe

Tendances

Eat my data
Eat my dataEat my data
Eat my data
Peng Zuo
 

Tendances (20)

Tracking huge files with Git LFS (GlueCon 2016)
Tracking huge files with Git LFS (GlueCon 2016)Tracking huge files with Git LFS (GlueCon 2016)
Tracking huge files with Git LFS (GlueCon 2016)
 
Smoking docker
Smoking dockerSmoking docker
Smoking docker
 
GraphQL IN Golang
GraphQL IN GolangGraphQL IN Golang
GraphQL IN Golang
 
Web Development in Perl
Web Development in PerlWeb Development in Perl
Web Development in Perl
 
Modern Perl Web Development with Dancer
Modern Perl Web Development with DancerModern Perl Web Development with Dancer
Modern Perl Web Development with Dancer
 
Parse, scale to millions
Parse, scale to millionsParse, scale to millions
Parse, scale to millions
 
All That Jazz
All  That  JazzAll  That  Jazz
All That Jazz
 
Using Ant To Build J2 Ee Applications
Using Ant To Build J2 Ee ApplicationsUsing Ant To Build J2 Ee Applications
Using Ant To Build J2 Ee Applications
 
Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version control
 
Composer the right way - SunshinePHP
Composer the right way - SunshinePHPComposer the right way - SunshinePHP
Composer the right way - SunshinePHP
 
Value protocols and codables
Value protocols and codablesValue protocols and codables
Value protocols and codables
 
Composer - Package Management for PHP. Silver Bullet?
Composer - Package Management for PHP. Silver Bullet?Composer - Package Management for PHP. Silver Bullet?
Composer - Package Management for PHP. Silver Bullet?
 
Eat my data
Eat my dataEat my data
Eat my data
 
Tracking huge files with Git LFS - LinuxCon 2016
Tracking huge files with Git LFS - LinuxCon 2016Tracking huge files with Git LFS - LinuxCon 2016
Tracking huge files with Git LFS - LinuxCon 2016
 
Rush, a shell that will yield to you
Rush, a shell that will yield to youRush, a shell that will yield to you
Rush, a shell that will yield to you
 
POE
POEPOE
POE
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with Perl
 
BASH Variables Part 1: Basic Interpolation
BASH Variables Part 1: Basic InterpolationBASH Variables Part 1: Basic Interpolation
BASH Variables Part 1: Basic Interpolation
 
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
 
Building Awesome CLI apps in Go
Building Awesome CLI apps in GoBuilding Awesome CLI apps in Go
Building Awesome CLI apps in Go
 

En vedette

Mazen doumani dental anatomy
Mazen doumani dental anatomyMazen doumani dental anatomy
Mazen doumani dental anatomy
mazen doumani
 
Harvard Library UX Methods Workshop w/Matt Reidsma
Harvard Library UX Methods Workshop w/Matt ReidsmaHarvard Library UX Methods Workshop w/Matt Reidsma
Harvard Library UX Methods Workshop w/Matt Reidsma
harvardlibraryux
 
Tooth Morphology Basics
Tooth Morphology BasicsTooth Morphology Basics
Tooth Morphology Basics
hchidmd
 

En vedette (20)

Grails: a quick tutorial (1)
Grails: a quick tutorial (1)Grails: a quick tutorial (1)
Grails: a quick tutorial (1)
 
Gorm
GormGorm
Gorm
 
Mazen doumani dental anatomy
Mazen doumani dental anatomyMazen doumani dental anatomy
Mazen doumani dental anatomy
 
Why UX in libraries is a thing now
Why UX in libraries is a thing nowWhy UX in libraries is a thing now
Why UX in libraries is a thing now
 
Morphology of human permanent dentition
Morphology of human permanent dentitionMorphology of human permanent dentition
Morphology of human permanent dentition
 
Harvard Library UX Methods Workshop w/Matt Reidsma
Harvard Library UX Methods Workshop w/Matt ReidsmaHarvard Library UX Methods Workshop w/Matt Reidsma
Harvard Library UX Methods Workshop w/Matt Reidsma
 
Tooth Morphology Basics
Tooth Morphology BasicsTooth Morphology Basics
Tooth Morphology Basics
 
Morphology of tooth
Morphology of tooth Morphology of tooth
Morphology of tooth
 
The Creative Brief: A Research Project
The Creative Brief: A Research ProjectThe Creative Brief: A Research Project
The Creative Brief: A Research Project
 
The Staggering Cost of Teacher Attrition
The Staggering Cost of Teacher AttritionThe Staggering Cost of Teacher Attrition
The Staggering Cost of Teacher Attrition
 
The 50 Most Influential Education Brands on LinkedIn
The 50 Most Influential Education Brands on LinkedInThe 50 Most Influential Education Brands on LinkedIn
The 50 Most Influential Education Brands on LinkedIn
 
What is UX and how can it help your organisation?
What is UX and how can it help your organisation?What is UX and how can it help your organisation?
What is UX and how can it help your organisation?
 
Design, Promote, Repeat: How Long-Term Marketing Strategies Lead to Success
Design, Promote, Repeat: How Long-Term Marketing Strategies Lead to SuccessDesign, Promote, Repeat: How Long-Term Marketing Strategies Lead to Success
Design, Promote, Repeat: How Long-Term Marketing Strategies Lead to Success
 
What Analytics Won't Tell You: Get Essential Insights for Content and Design
What Analytics Won't Tell You: Get Essential Insights for Content and DesignWhat Analytics Won't Tell You: Get Essential Insights for Content and Design
What Analytics Won't Tell You: Get Essential Insights for Content and Design
 
Digital Darwinism and the Dawn of Generation C
Digital Darwinism and the Dawn of Generation CDigital Darwinism and the Dawn of Generation C
Digital Darwinism and the Dawn of Generation C
 
How to do lean planning
How to do lean planningHow to do lean planning
How to do lean planning
 
How to write a good business letter
How to write a good business letter   How to write a good business letter
How to write a good business letter
 
The Sketchnote Mini-Workshop
The Sketchnote Mini-WorkshopThe Sketchnote Mini-Workshop
The Sketchnote Mini-Workshop
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
 
Digital in 2016
Digital in 2016Digital in 2016
Digital in 2016
 

Similaire à JavaOne 2008 - TS-5764 - Grails in Depth

Ratpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web AppsRatpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web Apps
James Williams
 
Agile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with NetbeansAgile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with Netbeans
Carol McDonald
 
cdac@parag.gajbhiye@test123
cdac@parag.gajbhiye@test123cdac@parag.gajbhiye@test123
cdac@parag.gajbhiye@test123
Parag Gajbhiye
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
Ortus Solutions, Corp
 
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009
marpierc
 

Similaire à JavaOne 2008 - TS-5764 - Grails in Depth (20)

Ratpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web AppsRatpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web Apps
 
Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007
 
Agile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with NetbeansAgile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with Netbeans
 
Grails 0.3-SNAPSHOT Presentation WJAX 2006 English
Grails 0.3-SNAPSHOT Presentation WJAX 2006 EnglishGrails 0.3-SNAPSHOT Presentation WJAX 2006 English
Grails 0.3-SNAPSHOT Presentation WJAX 2006 English
 
Groovy - Grails as a modern scripting language for Web applications
Groovy - Grails as a modern scripting language for Web applicationsGroovy - Grails as a modern scripting language for Web applications
Groovy - Grails as a modern scripting language for Web applications
 
SVCC Intro to Grails
SVCC Intro to GrailsSVCC Intro to Grails
SVCC Intro to Grails
 
Introduction to Grails Framework
Introduction to Grails FrameworkIntroduction to Grails Framework
Introduction to Grails Framework
 
Introduction To Ant
Introduction To AntIntroduction To Ant
Introduction To Ant
 
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume LaforgeGroovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
 
cdac@parag.gajbhiye@test123
cdac@parag.gajbhiye@test123cdac@parag.gajbhiye@test123
cdac@parag.gajbhiye@test123
 
Using and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareUsing and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middleware
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005
 
Demystifying Maven
Demystifying MavenDemystifying Maven
Demystifying Maven
 
Groovy and Grails
Groovy and GrailsGroovy and Grails
Groovy and Grails
 
Sprockets
SprocketsSprockets
Sprockets
 
Groovy for Java Developers
Groovy for Java DevelopersGroovy for Java Developers
Groovy for Java Developers
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and docker
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
 
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
 

Plus de Guillaume Laforge

Groovy 2.0 update at Devoxx 2012
Groovy 2.0 update at Devoxx 2012Groovy 2.0 update at Devoxx 2012
Groovy 2.0 update at Devoxx 2012
Guillaume Laforge
 
Groovy 1.8 et 2.0 au BreizhC@mp 2012
Groovy 1.8 et 2.0 au BreizhC@mp 2012Groovy 1.8 et 2.0 au BreizhC@mp 2012
Groovy 1.8 et 2.0 au BreizhC@mp 2012
Guillaume Laforge
 
Groovy 1.8 and 2.0 at GR8Conf Europe 2012
Groovy 1.8 and 2.0 at GR8Conf Europe 2012Groovy 1.8 and 2.0 at GR8Conf Europe 2012
Groovy 1.8 and 2.0 at GR8Conf Europe 2012
Guillaume Laforge
 
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011
Guillaume Laforge
 
GPars et PrettyTime - Paris JUG 2011 - Guillaume Laforge
GPars et PrettyTime - Paris JUG 2011 - Guillaume LaforgeGPars et PrettyTime - Paris JUG 2011 - Guillaume Laforge
GPars et PrettyTime - Paris JUG 2011 - Guillaume Laforge
Guillaume Laforge
 

Plus de Guillaume Laforge (20)

Lift off with Groovy 2 at JavaOne 2013
Lift off with Groovy 2 at JavaOne 2013Lift off with Groovy 2 at JavaOne 2013
Lift off with Groovy 2 at JavaOne 2013
 
Groovy workshop à Mix-IT 2013
Groovy workshop à Mix-IT 2013Groovy workshop à Mix-IT 2013
Groovy workshop à Mix-IT 2013
 
Les nouveautés de Groovy 2 -- Mix-IT 2013
Les nouveautés de Groovy 2 -- Mix-IT 2013Les nouveautés de Groovy 2 -- Mix-IT 2013
Les nouveautés de Groovy 2 -- Mix-IT 2013
 
Groovy 2 and beyond
Groovy 2 and beyondGroovy 2 and beyond
Groovy 2 and beyond
 
Groovy 2.0 update at Devoxx 2012
Groovy 2.0 update at Devoxx 2012Groovy 2.0 update at Devoxx 2012
Groovy 2.0 update at Devoxx 2012
 
Groovy 2.0 webinar
Groovy 2.0 webinarGroovy 2.0 webinar
Groovy 2.0 webinar
 
Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012
 
Groovy update at SpringOne2GX 2012
Groovy update at SpringOne2GX 2012Groovy update at SpringOne2GX 2012
Groovy update at SpringOne2GX 2012
 
JavaOne 2012 Groovy update
JavaOne 2012 Groovy updateJavaOne 2012 Groovy update
JavaOne 2012 Groovy update
 
Groovy 1.8 et 2.0 au BreizhC@mp 2012
Groovy 1.8 et 2.0 au BreizhC@mp 2012Groovy 1.8 et 2.0 au BreizhC@mp 2012
Groovy 1.8 et 2.0 au BreizhC@mp 2012
 
Groovy 1.8 and 2.0 at GR8Conf Europe 2012
Groovy 1.8 and 2.0 at GR8Conf Europe 2012Groovy 1.8 and 2.0 at GR8Conf Europe 2012
Groovy 1.8 and 2.0 at GR8Conf Europe 2012
 
Groovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume Laforge
Groovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume LaforgeGroovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume Laforge
Groovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume Laforge
 
Going to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific LanguagesGoing to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific Languages
 
Groovy 2.0 - Devoxx France 2012
Groovy 2.0 - Devoxx France 2012Groovy 2.0 - Devoxx France 2012
Groovy 2.0 - Devoxx France 2012
 
Whats new in Groovy 2.0?
Whats new in Groovy 2.0?Whats new in Groovy 2.0?
Whats new in Groovy 2.0?
 
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011
 
GPars et PrettyTime - Paris JUG 2011 - Guillaume Laforge
GPars et PrettyTime - Paris JUG 2011 - Guillaume LaforgeGPars et PrettyTime - Paris JUG 2011 - Guillaume Laforge
GPars et PrettyTime - Paris JUG 2011 - Guillaume Laforge
 
Groovy Update - Guillaume Laforge - Greach 2011
Groovy Update - Guillaume Laforge - Greach 2011Groovy Update - Guillaume Laforge - Greach 2011
Groovy Update - Guillaume Laforge - Greach 2011
 
Gaelyk update - Guillaume Laforge - SpringOne2GX 2011
Gaelyk update - Guillaume Laforge - SpringOne2GX 2011Gaelyk update - Guillaume Laforge - SpringOne2GX 2011
Gaelyk update - Guillaume Laforge - SpringOne2GX 2011
 
Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...
Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...
Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...
 

Dernier

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Dernier (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

JavaOne 2008 - TS-5764 - Grails in Depth

  • 1. Grails – In Depth Graeme Rocher, CTO – G2One Inc TS-5764
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. Getting Started with Grails Creating and Running
  • 12. A Grails Project Ant Build JAR files Grails Sources Web Sources Java Sources
  • 13.
  • 14.
  • 15. Easy ORM with GORM class Album { String title String artist Date releaseDate static hasMany = [songs:Song] } class Song { String title Double duration } table - album table - song GORM classes, also known as domain classes, go in the domain directory id title artist release_date id title duration album_id
  • 16. GORM in Action Querying and Persistence with GORM
  • 17. The Grails Console Activate with: grails console
  • 18.
  • 19. Dynamic Finders & Criteria def albums = Album. list () def recentAlbums = Album. findAllByReleaseDateGreaterThan (new Date()-7) def albumsStartingWithA = Album. findAllByTitleLike ( &quot;A%&quot;) def albumsWithSongsAboutSummer = Album. withCriteria { songs { like(&quot;title&quot;, &quot;%Summmer%&quot;) } } List all records Form method expressions Use “like” queries Construct criteria on the fly to query associations
  • 20.
  • 21.
  • 22.
  • 23. Controllers in Action Easy MVC with Grails
  • 24. Grails Controllers class AlbumController { def search = { def albums= Album.findByTitleLike( &quot;%${params.q}%&quot; ) [albumResults:albums] } } Return a model as a map Actions are properties assigned a block or closure Controllers go in the “controllers” directory
  • 25.
  • 26.
  • 27.
  • 28. RESTful Marshalling Easy Web Services with Grails
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35. Grails – in Depth Graeme Rocher TS-5764