SlideShare a Scribd company logo
Populators & Converters
Sakshi Narang
Prerequisite
● Basic knowledge of items.xml (Model concept)
● POJO Concept (Data concept)
Agenda
● Clarification about Model and Data(POJO)
● What's Populators and Converters?
● Approach to follow
● Flow of how to make a Populator (One example)
● Configurable Populators & Data Options
What's Model?
● Data stored in Hybris database
● 'Model.java' is made
● Done using items.xml
POJO?
● What's POJO
– Its a data object class which is used for the frontend.
– Its also used as a DTO.
● Why POJO
– To handle frontend
– To not hit database with every click of the end user
● How to make a POJO?
– Via bean.xml, ant all and its done.(Refer any bean.xml)
– Directly making data.java and
Converters
What does converter do?
– It creates new data objects(targets) and calls the
populators to populate these
– One converter can call many populators if the target of
those populators under the same category. Will see later
how list of populators are called in spring.xml using same
target.
– Conversion API is already written. We just need to use
those API in our code and do some configurations in
spring xml. (These configurations we will see in the Flow
Notes).
Populators
● It copies data from source business object to the facade
data object(POJO)
● Reverse Populator converts data into model(For Backend)
– Example: Address Form
● Populator converts model into data (For frontend)
Approach
● No converters written manually
– Should be Spring configured
– Should use: AbstractConverters as base class
● No populator should be called directly in the code.
– Converters should call them
● All conversion should be done in populators
● Conversion should be well encapsulated and
independent
Approach: Meaning of encapsulated
● Encapsulation implements data hiding
– Because data will not be accessed directly to other classes, it will be accessed via
method(getters and setters)
● What's Encapsulation
– Combining data & methods together as a single unit
● Why Encapsulation here
– The fields of the class cannot be made read-only or write-only.
– A class can have total control over what's stored in its fields.
– The users of a class don't know how the class stores its data. The class change the
data types of the field & the users of the class don't need to change any of their code.
● How to achieve this
– Make data declaration private
– Make getters and setters of each data
Flow
See Notes to check an example of flow of Populator
showing how description is seen in the frontend.
Configurable Populators & Data Options
● Vital for Performance and Bandwidth perspective
● These extend populators interface
● The configurable populators invoke populators that add
data for the given data options.
Bookmarks
● https://wiki.hybris.com/display/release5/How+to+Implement+Po
● https://wiki.hybris.com/display/release5/Converters+and+Popul
● https://help.hybris.com/6.1.0/hcd/8b937ff886691014815fcd31ff
Q&A

More Related Content

Similar to populators&Converters

React - The JavaScript Library for User Interfaces
React - The JavaScript Library for User InterfacesReact - The JavaScript Library for User Interfaces
React - The JavaScript Library for User Interfaces
Jumping Bean
 
Design patterns for fun & profit - CoderCruise 2018
Design patterns for fun & profit - CoderCruise 2018Design patterns for fun & profit - CoderCruise 2018
Design patterns for fun & profit - CoderCruise 2018
David Litvak Bruno
 
127556030 bisp-informatica-question-collections
127556030 bisp-informatica-question-collections127556030 bisp-informatica-question-collections
127556030 bisp-informatica-question-collections
Amit Sharma
 
Data Structure Notes unit 1.docx
Data Structure Notes unit 1.docxData Structure Notes unit 1.docx
Data Structure Notes unit 1.docx
kp370932
 
Obejct Oriented SCM - OOSCM
Obejct Oriented SCM - OOSCMObejct Oriented SCM - OOSCM
Obejct Oriented SCM - OOSCM
Hernan Wilkinson
 
Guvnor presentation jervis liu
Guvnor presentation jervis liuGuvnor presentation jervis liu
Guvnor presentation jervis liu
jbossug
 
The abstract art of software development
The abstract art of software developmentThe abstract art of software development
The abstract art of software development
Stephen Erdman
 
SH 1 - SES 6 - compass-tel-aviv-slides.pptx
SH 1 - SES 6 - compass-tel-aviv-slides.pptxSH 1 - SES 6 - compass-tel-aviv-slides.pptx
SH 1 - SES 6 - compass-tel-aviv-slides.pptx
MongoDB
 
Presto
PrestoPresto
Presto
Knoldus Inc.
 
Rules for Fools: The Rules Module
Rules for Fools: The Rules ModuleRules for Fools: The Rules Module
Rules for Fools: The Rules Module
Will Hall
 
From Good to SOLID: How to become a better PHP developer
From Good to SOLID: How to become a better PHP developerFrom Good to SOLID: How to become a better PHP developer
From Good to SOLID: How to become a better PHP developer
Katerina Trajchevska
 
Interop 2015: Hardly Enough Theory, Barley Enough Code
Interop 2015: Hardly Enough Theory, Barley Enough CodeInterop 2015: Hardly Enough Theory, Barley Enough Code
Interop 2015: Hardly Enough Theory, Barley Enough Code
Jeremy Schulman
 
Introduction to django
Introduction to djangoIntroduction to django
Introduction to django
Vlad Voskoboynik
 
SOLID refactoring - racing car katas
SOLID refactoring - racing car katasSOLID refactoring - racing car katas
SOLID refactoring - racing car katas
Georg Berky
 
Production-Ready BIG ML Workflows - from zero to hero
Production-Ready BIG ML Workflows - from zero to heroProduction-Ready BIG ML Workflows - from zero to hero
Production-Ready BIG ML Workflows - from zero to hero
Daniel Marcous
 
Why Concurrency is hard ?
Why Concurrency is hard ?Why Concurrency is hard ?
Why Concurrency is hard ?
Ramith Jayasinghe
 
Megastore by Google
Megastore by GoogleMegastore by Google
Megastore by Google
Ankita Kapratwar
 
Oracle plsql and d2 k interview question1
Oracle plsql and d2 k interview question1Oracle plsql and d2 k interview question1
Oracle plsql and d2 k interview question1
Arunkumar Gurav
 
Cs2305 programming paradigms lecturer notes
Cs2305   programming paradigms lecturer notesCs2305   programming paradigms lecturer notes
Cs2305 programming paradigms lecturer notes
Saravanakumar viswanathan
 
Concurrency - Why it's hard ?
Concurrency - Why it's hard ?Concurrency - Why it's hard ?
Concurrency - Why it's hard ?
Ramith Jayasinghe
 

Similar to populators&Converters (20)

React - The JavaScript Library for User Interfaces
React - The JavaScript Library for User InterfacesReact - The JavaScript Library for User Interfaces
React - The JavaScript Library for User Interfaces
 
Design patterns for fun & profit - CoderCruise 2018
Design patterns for fun & profit - CoderCruise 2018Design patterns for fun & profit - CoderCruise 2018
Design patterns for fun & profit - CoderCruise 2018
 
127556030 bisp-informatica-question-collections
127556030 bisp-informatica-question-collections127556030 bisp-informatica-question-collections
127556030 bisp-informatica-question-collections
 
Data Structure Notes unit 1.docx
Data Structure Notes unit 1.docxData Structure Notes unit 1.docx
Data Structure Notes unit 1.docx
 
Obejct Oriented SCM - OOSCM
Obejct Oriented SCM - OOSCMObejct Oriented SCM - OOSCM
Obejct Oriented SCM - OOSCM
 
Guvnor presentation jervis liu
Guvnor presentation jervis liuGuvnor presentation jervis liu
Guvnor presentation jervis liu
 
The abstract art of software development
The abstract art of software developmentThe abstract art of software development
The abstract art of software development
 
SH 1 - SES 6 - compass-tel-aviv-slides.pptx
SH 1 - SES 6 - compass-tel-aviv-slides.pptxSH 1 - SES 6 - compass-tel-aviv-slides.pptx
SH 1 - SES 6 - compass-tel-aviv-slides.pptx
 
Presto
PrestoPresto
Presto
 
Rules for Fools: The Rules Module
Rules for Fools: The Rules ModuleRules for Fools: The Rules Module
Rules for Fools: The Rules Module
 
From Good to SOLID: How to become a better PHP developer
From Good to SOLID: How to become a better PHP developerFrom Good to SOLID: How to become a better PHP developer
From Good to SOLID: How to become a better PHP developer
 
Interop 2015: Hardly Enough Theory, Barley Enough Code
Interop 2015: Hardly Enough Theory, Barley Enough CodeInterop 2015: Hardly Enough Theory, Barley Enough Code
Interop 2015: Hardly Enough Theory, Barley Enough Code
 
Introduction to django
Introduction to djangoIntroduction to django
Introduction to django
 
SOLID refactoring - racing car katas
SOLID refactoring - racing car katasSOLID refactoring - racing car katas
SOLID refactoring - racing car katas
 
Production-Ready BIG ML Workflows - from zero to hero
Production-Ready BIG ML Workflows - from zero to heroProduction-Ready BIG ML Workflows - from zero to hero
Production-Ready BIG ML Workflows - from zero to hero
 
Why Concurrency is hard ?
Why Concurrency is hard ?Why Concurrency is hard ?
Why Concurrency is hard ?
 
Megastore by Google
Megastore by GoogleMegastore by Google
Megastore by Google
 
Oracle plsql and d2 k interview question1
Oracle plsql and d2 k interview question1Oracle plsql and d2 k interview question1
Oracle plsql and d2 k interview question1
 
Cs2305 programming paradigms lecturer notes
Cs2305   programming paradigms lecturer notesCs2305   programming paradigms lecturer notes
Cs2305 programming paradigms lecturer notes
 
Concurrency - Why it's hard ?
Concurrency - Why it's hard ?Concurrency - Why it's hard ?
Concurrency - Why it's hard ?
 

populators&Converters

  • 2. Prerequisite ● Basic knowledge of items.xml (Model concept) ● POJO Concept (Data concept)
  • 3. Agenda ● Clarification about Model and Data(POJO) ● What's Populators and Converters? ● Approach to follow ● Flow of how to make a Populator (One example) ● Configurable Populators & Data Options
  • 4. What's Model? ● Data stored in Hybris database ● 'Model.java' is made ● Done using items.xml
  • 5. POJO? ● What's POJO – Its a data object class which is used for the frontend. – Its also used as a DTO. ● Why POJO – To handle frontend – To not hit database with every click of the end user ● How to make a POJO? – Via bean.xml, ant all and its done.(Refer any bean.xml) – Directly making data.java and
  • 6. Converters What does converter do? – It creates new data objects(targets) and calls the populators to populate these – One converter can call many populators if the target of those populators under the same category. Will see later how list of populators are called in spring.xml using same target. – Conversion API is already written. We just need to use those API in our code and do some configurations in spring xml. (These configurations we will see in the Flow Notes).
  • 7. Populators ● It copies data from source business object to the facade data object(POJO) ● Reverse Populator converts data into model(For Backend) – Example: Address Form ● Populator converts model into data (For frontend)
  • 8. Approach ● No converters written manually – Should be Spring configured – Should use: AbstractConverters as base class ● No populator should be called directly in the code. – Converters should call them ● All conversion should be done in populators ● Conversion should be well encapsulated and independent
  • 9. Approach: Meaning of encapsulated ● Encapsulation implements data hiding – Because data will not be accessed directly to other classes, it will be accessed via method(getters and setters) ● What's Encapsulation – Combining data & methods together as a single unit ● Why Encapsulation here – The fields of the class cannot be made read-only or write-only. – A class can have total control over what's stored in its fields. – The users of a class don't know how the class stores its data. The class change the data types of the field & the users of the class don't need to change any of their code. ● How to achieve this – Make data declaration private – Make getters and setters of each data
  • 10. Flow See Notes to check an example of flow of Populator showing how description is seen in the frontend.
  • 11. Configurable Populators & Data Options ● Vital for Performance and Bandwidth perspective ● These extend populators interface ● The configurable populators invoke populators that add data for the given data options.
  • 13. Q&A

Editor's Notes

  1. Its done using items.xml.Whatever we add in items.xml, respective model.java file is made which has its corresponding getters and setters.