SlideShare une entreprise Scribd logo
1  sur  23
Blossom 2.0

    Tobias Mattsson, Senior Software     Magnolia International Ltd.
    Engineer




                                       Magnolia is a registered trademark owned by Magnolia
1    Version 1.1
                                                                            International Ltd.
Take advantage of 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


                                                  Magnolia is a registered trademark owned by Magnolia
2   Version 1.1
                                                                                       International Ltd.
How Blossom integrates Spring

                  Integrates Spring into the module mechanism
                   • Module Lifecycle

                  Integrates with Spring Web MVC
                  And additional bridging




                                               Magnolia is a registered trademark owned by Magnolia
3   Version 1.1
                                                                                    International Ltd.
Model View Controller Pattern

                  The controller receives input, performs requested operations and
    Controller
                  provides the resulting model. The view is responsible for providing
                  the UI representation of the model.

                  Keeps business logic separated from presentation.
       Model




       View




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

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

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

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




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

                  Template   Component




                             Component




                                         Magnolia is a registered trademark owned by Magnolia
6   Version 1.1
                                                                              International Ltd.
Blossom managed templates and

                                   Template       Component
                                              C                  C
                                              M                  M
                                              V                  V

                                                  Component
                                                                 C
                  Templates and components
                  are decoupled from view                        M
                  rendering                                      V




                                                        Magnolia is a registered trademark owned by Magnolia
7   Version 1.1
                                                                                             International Ltd.
The Blossom programming model

                  Based on annotations
                  Non-intrusive
                  Spring centric approach
                   • The controller is the template
                   • The controller is the component
                   • and they’re automatically available in Magnolia

                  Dialogs are created programmatically




                                                  Magnolia is a registered trademark owned by Magnolia
8   Version 1.1
                                                                                       International Ltd.
Example Template with Area

        @Controller
        @Template(id = "blossomSample:pages/main", title = "Main template")
        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/main.jsp";
                    }
              }

              ...
        }




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

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

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

            ...
     }




                                                           Magnolia is a registered trademark owned by Magnolia
10       Version 1.1
                                                                                                International Ltd.
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/promos.jsp";
            }

     }




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

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

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




                                                         Magnolia is a registered trademark owned by Magnolia
12   Version 1.1
                                                                                              International Ltd.
Blossom Managed Dialogs

                   Dialogs are created using code, not configuration
                   Based on annotations
                   Detected and automatically available in Magnolia
                   Validation of dialog input




                                                 Magnolia is a registered trademark owned by Magnolia
13   Version 1.1
                                                                                      International Ltd.
Blossom Managed Dialogs
       @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");
              }                             Text
              @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");
              }
       }




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

             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");
                 }
             }
                                             Text
             @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", "");
                 }
             }




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

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

                   @TabFactory("Meta")
                   public void metaTab(TabBuilder tab) {
                       tab.addEdit("description", "Description", "A concise page explanation");
                   }
                                                Text
                   @TabValidator("Meta")
                   public void validateMetaTab(DialogTab tab) {
                       if (tab.getSub("description").getValue().length() < 20)
                           AlertUtil.setMessage("Meta description needs to be longer");
                   }
            }




                                                                  Magnolia is a registered trademark owned by Magnolia
16   Version 1.1
                                                                                                       International Ltd.
Templates can contain dialog factories

            @Controller
            @Template(id=”blossomSample:pages/section” title="Section")
            public class SectionTemplate {

                   @RequestMapping("/section")
                   public ModelAndView handleRequest() {

                   }                            Text
                       return new ModelAndView("sectionTemplate.jsp");


                   @DialogFactory("section-properties")
                   public void propertiesDialog(DialogBuilder dialog) {
                       TabBuilder contentTab = dialog.addTab("Content");
                       contentTab.addEdit("title", "Title", "Title of this page");
                       TabBuilder metaTab = dialog.addTab("Meta");
                       metaTab.addEdit("description", "Description", "Page explanation");
                   }
            }




                                                                  Magnolia is a registered trademark owned by Magnolia
17   Version 1.1
                                                                                                       International Ltd.
Dynamic dialogs
       @Controller
       @Template(id=”blossomSample:components/book” title=“Book”)
       public class BookComponent {

             @Autowired
             private BookStoreWebService webService;

             @RequestMapping("/book")
                                             Text
             public ModelAndView handleRequest() {
                 Content content = MgnlContext.getAggregationState().getCurrentContent();
                 String bookId = content.getNodeData("id").getString();
                 ModelAndView mav = new ModelAndView("book.jsp");
                 mav.addAttribute("book", webService.getBook(bookId));
                 return mav;
             }

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




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

                   Best of both worlds approach
                   Magnolia and Spring constructs work side by side
                   Built-in support for Freemarker and JSP
                   Everything Spring supports work out-of-the-box,
                   such as JSON, PDF, XML and RSS




                                                  Magnolia is a registered trademark owned by Magnolia
19   Version 1.1
                                                                                       International Ltd.
Pre-executing a controller (component)


                                 Template         Component
                                             C                   C
                       C                     M                  M
                                             V                   V

                                                  Component
                                                                 C
               The pre-executed controller can
               choose to skip page rendering by                 M
               sending a redirect or directly                    V
               render something on its own




                                                         Magnolia is a registered trademark owned by Magnolia
20   Version 1.1
                                                                                              International Ltd.
Pre-executing a controller (component)

                                                                  Template   C         Component        C
                                                           C                 M                         M

                   <form>                                                    V                         V
                      <blossom:pecid-input />
                      <input type=”text” name=”email” />
                      ...                                                              Component        C
                   </form>
                                                                                                       M
                   Outputs:                                                                            V
                   <form>
                      <input type=”hidden” name=”_pecid”
                          value=”ff6cefa6-d958-47b1-af70-c82a414f17e1”/>
                      <input type=”text” name=”email” />
                      ...
                   </form>




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

                   Spring centric approach based on annotations
                   Novel features like pre-execution and dialog
                   validation
                   Code over configuration
                    • Versioning
                    • Collaboration

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




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

                   Documentation
                     • http://documentation.magnolia-cms.com/modules/
                          blossom.html

                   Wiki
                     • http://wiki.magnolia-cms.com/display/WIKI/Magnolia
                          +Blossom

                   Samples
                     • http://git.magnolia-cms.com/gitweb/?p=modules/blossom/
                          samples.git
                   Blog
                     • http://tobias-mattsson-magnolia.blogspot.se/

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

Contenu connexe

Similaire à Blossom 2.0 Spring Integration

Building Scalable JavaScript Apps
Building Scalable JavaScript AppsBuilding Scalable JavaScript Apps
Building Scalable JavaScript AppsGil Fink
 
20090410 J Spring Pragmatic Model Driven Development In Java Using Smart
20090410   J Spring Pragmatic Model Driven Development In Java Using Smart20090410   J Spring Pragmatic Model Driven Development In Java Using Smart
20090410 J Spring Pragmatic Model Driven Development In Java Using SmartSander Hoogendoorn
 
Sas® Macro Design Patterns
Sas® Macro Design PatternsSas® Macro Design Patterns
Sas® Macro Design PatternsMark Tabladillo
 
Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...Aditya Jha
 
Model2Roo - ACME
Model2Roo - ACMEModel2Roo - ACME
Model2Roo - ACMEjccastrejon
 
Framework Engineering
Framework EngineeringFramework Engineering
Framework EngineeringYoungSu Son
 
Getting Healthy with Magnolia, Blossom and Spring
Getting Healthy with Magnolia, Blossom and SpringGetting Healthy with Magnolia, Blossom and Spring
Getting Healthy with Magnolia, Blossom and SpringMagnolia
 
Анатолій Поляков — Subdomains everywhere
Анатолій Поляков — Subdomains everywhereАнатолій Поляков — Subdomains everywhere
Анатолій Поляков — Subdomains everywhereLEDC 2016
 
An overview of Scalable Web Application Front-end
An overview of Scalable Web Application Front-endAn overview of Scalable Web Application Front-end
An overview of Scalable Web Application Front-endSaeid Zebardast
 
JavaScript Framework Smackdown
JavaScript Framework SmackdownJavaScript Framework Smackdown
JavaScript Framework Smackdownmeghantaylor
 
GR8Conf 2011: Adopting Grails
GR8Conf 2011: Adopting GrailsGR8Conf 2011: Adopting Grails
GR8Conf 2011: Adopting GrailsGR8Conf
 
Adopting Grails - GR8Conf Europe
Adopting Grails - GR8Conf EuropeAdopting Grails - GR8Conf Europe
Adopting Grails - GR8Conf EuropeKlausBaumecker
 
JMP102 Extending Your App Arsenal With OpenSocial
JMP102 Extending Your App Arsenal With OpenSocialJMP102 Extending Your App Arsenal With OpenSocial
JMP102 Extending Your App Arsenal With OpenSocialRyan Baxter
 
Model-Driven Software Engineering in Practice - Chapter 10 - Managing models
Model-Driven Software Engineering in Practice - Chapter 10 - Managing modelsModel-Driven Software Engineering in Practice - Chapter 10 - Managing models
Model-Driven Software Engineering in Practice - Chapter 10 - Managing modelsJordi Cabot
 
Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatiasapientindia
 

Similaire à Blossom 2.0 Spring Integration (20)

Building Scalable JavaScript Apps
Building Scalable JavaScript AppsBuilding Scalable JavaScript Apps
Building Scalable JavaScript Apps
 
20090410 J Spring Pragmatic Model Driven Development In Java Using Smart
20090410   J Spring Pragmatic Model Driven Development In Java Using Smart20090410   J Spring Pragmatic Model Driven Development In Java Using Smart
20090410 J Spring Pragmatic Model Driven Development In Java Using Smart
 
Sas® Macro Design Patterns
Sas® Macro Design PatternsSas® Macro Design Patterns
Sas® Macro Design Patterns
 
Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...
 
rose
roserose
rose
 
Model2Roo - ACME
Model2Roo - ACMEModel2Roo - ACME
Model2Roo - ACME
 
Framework Engineering
Framework EngineeringFramework Engineering
Framework Engineering
 
Getting Healthy with Magnolia, Blossom and Spring
Getting Healthy with Magnolia, Blossom and SpringGetting Healthy with Magnolia, Blossom and Spring
Getting Healthy with Magnolia, Blossom and Spring
 
Composite WPF
Composite WPFComposite WPF
Composite WPF
 
Анатолій Поляков — Subdomains everywhere
Анатолій Поляков — Subdomains everywhereАнатолій Поляков — Subdomains everywhere
Анатолій Поляков — Subdomains everywhere
 
An overview of Scalable Web Application Front-end
An overview of Scalable Web Application Front-endAn overview of Scalable Web Application Front-end
An overview of Scalable Web Application Front-end
 
JavaYDL18
JavaYDL18JavaYDL18
JavaYDL18
 
JavaScript Framework Smackdown
JavaScript Framework SmackdownJavaScript Framework Smackdown
JavaScript Framework Smackdown
 
GR8Conf 2011: Adopting Grails
GR8Conf 2011: Adopting GrailsGR8Conf 2011: Adopting Grails
GR8Conf 2011: Adopting Grails
 
Adopting Grails - GR8Conf Europe
Adopting Grails - GR8Conf EuropeAdopting Grails - GR8Conf Europe
Adopting Grails - GR8Conf Europe
 
01slide
01slide01slide
01slide
 
01slide
01slide01slide
01slide
 
JMP102 Extending Your App Arsenal With OpenSocial
JMP102 Extending Your App Arsenal With OpenSocialJMP102 Extending Your App Arsenal With OpenSocial
JMP102 Extending Your App Arsenal With OpenSocial
 
Model-Driven Software Engineering in Practice - Chapter 10 - Managing models
Model-Driven Software Engineering in Practice - Chapter 10 - Managing modelsModel-Driven Software Engineering in Practice - Chapter 10 - Managing models
Model-Driven Software Engineering in Practice - Chapter 10 - Managing models
 
Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatia
 

Dernier

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 MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
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.pdfEnterprise Knowledge
 
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 WorkerThousandEyes
 
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 RobisonAnna Loughnan Colquhoun
 
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...Miguel Araújo
 
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 interpreternaman860154
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
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 MenDelhi Call girls
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Dernier (20)

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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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
 
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
 
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
 
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...
 
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
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

Blossom 2.0 Spring Integration

  • 1. Blossom 2.0 Tobias Mattsson, Senior Software Magnolia International Ltd. Engineer Magnolia is a registered trademark owned by Magnolia 1 Version 1.1 International Ltd.
  • 2. Take advantage of 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 Magnolia is a registered trademark owned by Magnolia 2 Version 1.1 International Ltd.
  • 3. How Blossom integrates Spring Integrates Spring into the module mechanism • Module Lifecycle Integrates with Spring Web MVC And additional bridging Magnolia is a registered trademark owned by Magnolia 3 Version 1.1 International Ltd.
  • 4. Model View Controller Pattern The controller receives input, performs requested operations and Controller provides the resulting model. The view is responsible for providing the UI representation of the model. Keeps business logic separated from presentation. Model View Magnolia is a registered trademark owned by Magnolia 4 Version 1.1 International Ltd.
  • 5. Template example @Controller @Template(id = "blossomSample:pages/main", title = "Main template") public class MainTemplate { @RequestMapping("/mainTemplate") public String render(Node page, ModelMap model) { return "pages/main.jsp"; } @TabFactory("Content") public void propertiesDialog(TabBuilder tab) { tab.addEdit("title", "Title", ""); } } Magnolia is a registered trademark owned by Magnolia 5 Version 1.1 International Ltd.
  • 6. Magnolia rendering sequence Template Component Component Magnolia is a registered trademark owned by Magnolia 6 Version 1.1 International Ltd.
  • 7. Blossom managed templates and Template Component C C M M V V Component C Templates and components are decoupled from view M rendering V Magnolia is a registered trademark owned by Magnolia 7 Version 1.1 International Ltd.
  • 8. The Blossom programming model Based on annotations Non-intrusive Spring centric approach • The controller is the template • The controller is the component • and they’re automatically available in Magnolia Dialogs are created programmatically Magnolia is a registered trademark owned by Magnolia 8 Version 1.1 International Ltd.
  • 9. Example Template with Area @Controller @Template(id = "blossomSample:pages/main", title = "Main template") 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/main.jsp"; } } ... } Magnolia is a registered trademark owned by Magnolia 9 Version 1.1 International Ltd.
  • 10. Example Component @Controller @Template(id = "blossomSample:components/shoppingCart", title = "Shopping Cart") @TemplateDescription("Shopping cart") public class ShoppingCartComponent { @RequestMapping("/shoppingCart") public String handleRequest() { ... return "components/shoppingCart.jsp"; } ... } Magnolia is a registered trademark owned by Magnolia 10 Version 1.1 International Ltd.
  • 11. 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/promos.jsp"; } } Magnolia is a registered trademark owned by Magnolia 11 Version 1.1 International Ltd.
  • 12. Area inheritance @Controller @Area("promos") @Inherits @AvailableComponentClasses({TextComponent.class, ShoppingCartComponent.class}) public static class PromosArea { @RequestMapping("/mainTemplate/promos") public String render() { return "areas/promos.jsp"; } } Magnolia is a registered trademark owned by Magnolia 12 Version 1.1 International Ltd.
  • 13. Blossom Managed Dialogs Dialogs are created using code, not configuration Based on annotations Detected and automatically available in Magnolia Validation of dialog input Magnolia is a registered trademark owned by Magnolia 13 Version 1.1 International Ltd.
  • 14. Blossom Managed Dialogs @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"); } Text @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"); } } Magnolia is a registered trademark owned by Magnolia 14 Version 1.1 International Ltd.
  • 15. Dialog inheritance 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"); } } Text @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", ""); } } Magnolia is a registered trademark owned by Magnolia 15 Version 1.1 International Ltd.
  • 16. Dialog validation @DialogFactory("page-properties") public class PagePropertiesDialog { @TabFactory("Meta") public void metaTab(TabBuilder tab) { tab.addEdit("description", "Description", "A concise page explanation"); } Text @TabValidator("Meta") public void validateMetaTab(DialogTab tab) { if (tab.getSub("description").getValue().length() < 20) AlertUtil.setMessage("Meta description needs to be longer"); } } Magnolia is a registered trademark owned by Magnolia 16 Version 1.1 International Ltd.
  • 17. Templates can contain dialog factories @Controller @Template(id=”blossomSample:pages/section” title="Section") public class SectionTemplate { @RequestMapping("/section") public ModelAndView handleRequest() { } Text return new ModelAndView("sectionTemplate.jsp"); @DialogFactory("section-properties") public void propertiesDialog(DialogBuilder dialog) { TabBuilder contentTab = dialog.addTab("Content"); contentTab.addEdit("title", "Title", "Title of this page"); TabBuilder metaTab = dialog.addTab("Meta"); metaTab.addEdit("description", "Description", "Page explanation"); } } Magnolia is a registered trademark owned by Magnolia 17 Version 1.1 International Ltd.
  • 18. Dynamic dialogs @Controller @Template(id=”blossomSample:components/book” title=“Book”) public class BookComponent { @Autowired private BookStoreWebService webService; @RequestMapping("/book") Text public ModelAndView handleRequest() { Content content = MgnlContext.getAggregationState().getCurrentContent(); String bookId = content.getNodeData("id").getString(); ModelAndView mav = new ModelAndView("book.jsp"); mav.addAttribute("book", webService.getBook(bookId)); return mav; } @TabFactory("Content") public void contentTab(TabBuilder tab) { tab.addSelect("id", "Book", "Select the book", webService.getBooks()); } } Magnolia is a registered trademark owned by Magnolia 18 Version 1.1 International Ltd.
  • 19. View Technologies Best of both worlds approach Magnolia and Spring constructs work side by side Built-in support for Freemarker and JSP Everything Spring supports work out-of-the-box, such as JSON, PDF, XML and RSS Magnolia is a registered trademark owned by Magnolia 19 Version 1.1 International Ltd.
  • 20. Pre-executing a controller (component) Template Component C C C M M V V Component C The pre-executed controller can choose to skip page rendering by M sending a redirect or directly V render something on its own Magnolia is a registered trademark owned by Magnolia 20 Version 1.1 International Ltd.
  • 21. Pre-executing a controller (component) Template C Component C C M M <form> V V <blossom:pecid-input /> <input type=”text” name=”email” /> ... Component C </form> M Outputs: V <form> <input type=”hidden” name=”_pecid” value=”ff6cefa6-d958-47b1-af70-c82a414f17e1”/> <input type=”text” name=”email” /> ... </form> Magnolia is a registered trademark owned by Magnolia 21 Version 1.1 International Ltd.
  • 22. Summary Spring centric approach based on annotations Novel features like pre-execution and dialog validation Code over configuration • Versioning • Collaboration Enables access to Spring features and technologies • Directly in templates, paragraphs and dialogs Magnolia is a registered trademark owned by Magnolia 22 Version 1.1 International Ltd.
  • 23. Resources Documentation • http://documentation.magnolia-cms.com/modules/ blossom.html Wiki • http://wiki.magnolia-cms.com/display/WIKI/Magnolia +Blossom Samples • http://git.magnolia-cms.com/gitweb/?p=modules/blossom/ samples.git Blog • http://tobias-mattsson-magnolia.blogspot.se/ Magnolia is a registered trademark owned by Magnolia 23 Version 1.1 International Ltd.

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n