Blossom on the web

27
Magnolia is a registered trademark owned by Magnolia International Ltd. Version 1.1 Tobias Mattsson, Senior Software Engineer 07.03.2014 at Magnolia Amplify Blossom on the Web Spring and Content Management 1 Thursday, 7 March 2013

description

At the heart of every organization are processes and data stored away in systems of record. Often, the related business logic is implemented with the Spring Framework. Magnolia CMS enables you to bring up this data for direct interaction with your customers, members or citizens through your interaction channels – the web, mobile and others – to generate significant additional value both for them and for your organization.

Transcript of Blossom on the web

Page 1: Blossom on the web

Magnolia is a registered trademark owned by Magnolia International Ltd.Version 1.1

Tobias Mattsson, Senior Software Engineer

07.03.2014 at Magnolia Amplify

Blossom on the WebSpring and Content Management

1

Thursday, 7 March 2013

Page 2: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.2

Spring Framework

Spring is a java based application framework• Focus on web applications and enterprise

applications• One of the most popular frameworks in the Java

space

Pioneered a broad feature set• Lightweight container• Dependency Injection (DI)• Aspect Oriented Programming (AOP)• Enterprise Service Abstraction

Thursday, 7 March 2013

Page 3: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.3

Spring is everywhere

2.5 million developers use Spring (two thirds!)

More than half of the Fortune 500 power their Java applications with Spring

More than 70 percent of enterprises cite improved productivity, faster project completion, improved portability and application quality as reasons for using Spring

Thursday, 7 March 2013

Page 4: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.

Spring projects

Spring Web MVC

Spring WebFlowSpring Security

Spring WebServicesSpring Social

• Twitter, Facebook, LinkedIn etc

Spring Data• MongoDB, Neo4j, Riak, Cassandra etc

4

Thursday, 7 March 2013

Page 5: Blossom on the web

Magnolia is a registered trademark owned by Magnolia International Ltd.Version 1.15

Spring and the CMS

Thursday, 7 March 2013

Page 6: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.6

Blossom integrates it for you

Integrates Spring into the Magnolia module mechanism

• Module Lifecycle

Extends Spring Web MVC for templatingAnd additional bridging

Thursday, 7 March 2013

Page 7: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.7

Spring Web MVC with Content

No configuration just code

Based on annotationsNon-intrusive

Spring centric approach• The controller is the template• The controller is the component• and they’re automatically available in Magnolia

Thursday, 7 March 2013

Page 8: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.

Spring Web MVC

8

@Controllerpublic class ExampleController {

@RequestMapping("/customers/list") public String render(ModelMap model) { model.put("title", "List of all customers"); model.put("customers", customerService.findAllCustomers()); return "customers/list"; }}

Thursday, 7 March 2013

Page 9: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.9

Templates

@Controller@Template(title = "Main template", id = "blossomSample:pages/main")public class MainTemplate {

@RequestMapping("/mainTemplate") public String render(Node page, ModelMap model) { return "pages/main.ftl"; }}

Thursday, 7 March 2013

Page 10: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.10

Areas

@Controller@Template(title = "Main template", id = "blossomSample:pages/main")public class MainTemplate {

@Controller @Area("main") public static class MainArea {

@RequestMapping("/mainTemplate/main") public String render() { return "areas/mainArea.ftl"; } }

...}

Thursday, 7 March 2013

Page 11: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.11

Components

@Controller@Template(title = "Shopping Cart", id = "blossomSample:components/shoppingCart")@TemplateDescription("Shopping cart")public class ShoppingCartComponent {

@RequestMapping("/shoppingCart") public String handleRequest() { ... return "components/shoppingCart.ftl"; }

...}

Thursday, 7 March 2013

Page 12: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.12

Specifying what goes into an area

@Controller@Area("promos")@AvailableComponentClasses({TextComponent.class, ShoppingCartComponent.class})public static class PromosArea {

@RequestMapping("/mainTemplate/promos") public String render() { return "areas/promosArea.ftl"; }

}

Thursday, 7 March 2013

Page 13: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.13

Inheritance

@Controller@Area("promos")@Inherits@AvailableComponentClasses({TextComponent.class, ShoppingCartComponent.class})public static class PromosArea { @RequestMapping("/mainTemplate/promos") public String render() { return "areas/promos.jsp"; }}

Thursday, 7 March 2013

Page 14: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.14

Dialogs

Dialogs are created using code, not configuration

Based on annotationsDynamic behavior

Validation of dialog inputDetected and automatically available in Magnolia

Thursday, 7 March 2013

Page 15: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.

Dialog factories

15

@DialogFactory("page-dialog")public class PageDialog {

@TabFactory("Content") public void contentTab(TabBuilder tab) { tab.addEdit("title", "Title", "Title of this page"); tab.addCheckbox("navigation", "Navigation", "Include page in menu"); }

@TabFactory("Meta") public void metaTab(TabBuilder tab) { tab.addEdit("author", "Author", ""); tab.addEdit("keywords", "Keywords", "Keywords for this page"); tab.addEdit("description", "Description", "Concise page explanation"); }}

Thursday, 7 March 2013

Page 16: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.

Dialog inheritance

16

public abstract class BaseDialog { @TabFactory("Meta") public void metaTab(TabBuilder tab) { tab.addEdit("keywords", "Keywords", "Keywords for this page"); tab.addEdit("description", "Description", "Concise page explanation"); }}

@DialogFactory("news-properties")@TabOrder("Content", “Meta”)public class NewsPageDialog extends BaseDialog { @TabFactory("Content") public void contentTab(TabBuilder tab) { tab.addEdit("subject", "Subject", "News subject"); tab.addDate("date", "Publication Date", "Date of publication"); tab.addFckEditor("text", "Text", ""); tab.addFile("image", "Image", ""); }}

Thursday, 7 March 2013

Page 17: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.

Inline dialogs

17

@Controller@Template(title = "Main template", id = "blossomSample:pages/main")public class MainTemplate {

@RequestMapping("/mainTemplate") public String render(Node page, ModelMap model) { return "pages/main.ftl"; }

@TabFactory("Content") public void propertiesDialog(TabBuilder tab) { tab.addEdit("title", "Title", ""); }}

Thursday, 7 March 2013

Page 18: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.

Inline dialogs

18

@Controller@Template(title = "Main template", id = "blossomSample:pages/main")public class MainTemplate {

@Controller @Area("main") public static class MainArea {

@TabFactory("Content") public void contentTab(TabBuilder tab) { tab.addEdit("borderWidth", "Border width", "Width of the border around the area"); }

@RequestMapping("/mainTemplate/main") public String render() { return "areas/mainArea.ftl"; } }

...}

Thursday, 7 March 2013

Page 19: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.

Dynamic dialogs

19

@Controller@Template(id="blossomSample:components/book", title="Book")public class BookComponent {

@Inject private BookStoreWebService webService;

@TabFactory("Content") public void contentTab(TabBuilder tab) { tab.addSelect("id", "Book", "Select the book", webService.getBooks()); }

@RequestMapping("/book") public String handleRequest(ModelMap model, Node content) { String bookId = content.getProperty("id").getString(); model.put("book", webService.getBook(bookId)); return "components/book.ftl"; }}

Thursday, 7 March 2013

Page 20: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.

Validation

20

@DialogFactory("page-properties")public class PagePropertiesDialog {

@TabFactory("Meta") public void metaTab(TabBuilder tab) { tab.addEdit("description", "Description", "A concise page explanation"); }

@TabValidator("Meta") public void validateMetaTab(DialogTab tab) { if (tab.getSub("description").getValue().length() < 20) AlertUtil.setMessage("Meta description needs to be longer"); }}

Thursday, 7 March 2013

Page 21: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.21

Pre-execution

Portal like semantics

Allows a component to fully process a requestDevelopers can implement backing logic entirely in the components

Thursday, 7 March 2013

Page 22: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.

View technologies

Best of both worlds approach

Magnolia and Spring constructs work side by sideBuilt-in support for Freemarker and JSP

Everything Spring supports work out-of-the-box, such as JSON, PDF, XML and RSS

22

Thursday, 7 March 2013

Page 23: Blossom on the web

Magnolia is a registered trademark owned by Magnolia International Ltd.Version 1.123

Blossom in the wild

Thursday, 7 March 2013

Page 24: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.24

Maglev - Magnolia and Grails

Brings Magnolia to the Grails platform

Development entirely in groovy and GSPGrails productivity

Builds on Blossom

Thursday, 7 March 2013

Page 25: Blossom on the web

Version 1.1Magnolia is a registered trademark owned by Magnolia

International Ltd.

Summary

Enables access to Spring features and technologies• Directly in templates, components and dialogs

Spring centric approach on templating• Based on annotations• Connects the CMS with Spring Web MVC

Code over configuration• Versioning• Collaboration

25

Thursday, 7 March 2013

Page 26: Blossom on the web

Magnolia is a registered trademark owned by Magnolia International Ltd.Version 1.126

Questions?

Thursday, 7 March 2013

Page 27: Blossom on the web

Magnolia is a registered trademark owned by Magnolia International Ltd.Version 1.1

www.magnolia-cms.com

Tobias Mattsson, Senior Software EngineerMagnolia International Ltd.

07.03.2013 at Magnolia [email protected]

27

Thanks for listening!

Thursday, 7 March 2013