Explain Commerce & Accelerator?
✓ Creating New Addon = Are used to extend Hybris functionalities without changing its source code.
✓ Q: What we can do inside addon?
o Add frontend files (JSP / HTML / CSS & JS)
o Generate / Customize Façade transferred objects (DTO)
o Generate / Customize the data model
o Declare new Spring Services / Facades / Customize existing
o Declare new Controllers / Customize existing
o Declare new Converters / Populators or customize existing
✓ We can generate new extension (Called chennaaddon & Package = com.chenna.chennaaddon) based on
yaddon template with extgen.
Add entries in “localextensions.xml”. ant clean all.
Q: How to install your addon into the designated storefront extension. For this we use ant: -
Let’s say: - our addon = chennaaddon & storefront extension = yacceleratorstorefront. Then do below:-
Q: What addon install target does: -
o Generate a new project.properties file from project.properties.template inside your addon.
o Configure chennaaddon web spring configuration chennaaddon-web-spring.xml into
yacceleratorstorefront.additionalWebSpringConigs
o Add chennaaddon into extensioninfo.xml for yacceleratorstorefront
o Add chennaaddon to addons.less for yacceleratorstorefront
Q: How to uninstall an Addon: -
Q: What are the files in New Addon extension under its acceleratoraddon folder?
o acceleratoraddon/web/webroot/_ui/responsive/common/css/chennaaddon.css
o acceleratoraddon/web/webroot/WEB-INF/_uisrc/responsive/less/chennaaddon.less
Create new JSP file under acceleratoraddon/web/webroot/WEBINF/views/responsive/pages/layout,
chennaAddonLayout.jsp: -
Create new controller under com.chenna.chennaaddon.controllers.pages (You may need to add the
folder acceleratoraddon/web/src under your java build path source): -
Contact us for more information [email protected] (Java–Salesforce–SAP Portal–UI5/Fiori–Hybris)
Update chennaaddon/resources/chennaaddon/web/spring/chennaaddon-web-spring.xml to add a
context component-scan element:
Build platform & start server. Check the results electronics storefront.
Q: Explain OCC Webservices?
✓ Omni Commerce Connect (OCC) module is a set of API that expose services & data from Hybris. All Web
Services (WS) are Restful & support JSON & XML format. WS are build with Spring MVC FWK, using
controllers, facades & converters.
✓ Q: What are the extensions OCC module contains?
o commercewebservicescommons
o ycommercewebservices
▪ Authentication uses OAuth2 framework.
▪ Object can be cached using Ehcache, cache is configured for each controller & method
with @Cacheable annotation
o ycommercewebserviceshmc
o ycommercewebservicestest
Contact us for more information [email protected] (Java–Salesforce–SAP Portal–UI5/Fiori–Hybris)
Note: - All extensions starting with y are templates & are made to be reused as templates. So, to add /
change WS, you will need to generate new commerce WS extension from ycommercewebservices
template.
✓ Q: What are the versions of WS?
o V1 = It’s old version released with Hybris 5.1. Features = (1) Stateful (2) Format (XML / JSON).
o V2 = Current version released with Hybris 5.4. Features = (1) Stateless (2) Restful (3) Data
creation.
✓ Q: What are the types of requests?
o GET = Request to get data
o POST = Request to create data
o PUT = Request to update data
o HEAD = Request to get information about the data (number of elements for example)
Note: - Remember that OCC doesn’t use normal users, it has its own data type to manage credentials,
have a look at OAuthClientDetails.
✓ Q: How to install OCC? = To activate & use OCC module you need to activate below extensions: -
o ycommercewebservices
o ycommercewebserviceshmc
o ycommercewebservicestest
o commercewebservicescommons
o webservicescommonsbackoice
o cmswebservices
Note: - If you have created your own WS extensions from y templates, then delete reference to the WS
templates from your localextensions.xml file.
Once you have updated your Hybris installation with required extensions you would be able to manage
the OAuthClientDetails and see current OAuthAccessToken from the backoffice: -
✓ Q: Explain OAUTH? = Hybris WS authentication is based on OAuth, each call to OCC WS have to go
through a complex authentication mechanism. 1st user will be authenticated (verifying credentials) then
user is authorized (decide whether or not user can perform a given action).
Authorization happens in HTTP layer & Service layer, each of them applying its own set of verification.
Contact us for more information [email protected] (Java–Salesforce–SAP Portal–UI5/Fiori–Hybris)
✓ Q: What are OCC user roles? =
Authentication Type Role
Anonymous A non-authenticated principal is assigned a built-in ANONYMOUS role by
default.
Client Defining clients remember to assign either ROLE_CLIENT or
ROLE_TRUSTED_CLIENT to them. Every client application authenticated
using an OAuth2.
Customers By default, CUSTOMERGROUP & CUSTOMERMANAGERGROUP roles used.
Users who were authenticated using OAuth2 token in PWD flow.
Guest It can be done by calling /customers/current/guestlogin in v1 or
/users/anonymous/carts/{guid}/email in v2.
For such users, a built-in GUEST role is assigned.
Anonymous users who provided their own e-mail address.
✓ Q: How to get the token? = 1st you need to have OAuth clients configured, you can check this from
backoffice (System OAuth OAuth Clients). If you don’t have any & could import 1 provided with
cmswebservices extension inside impex file sampledata-oauthclients.impex.
✓ Q: Explain Curl? = Allow connections to SSL sites without certs -X POST: –request COMMAND Specify
request command to use.
✓ Q: Postman Post Request =
https://localhost:9002/authorizationserver/oauth/token?client_id=trusted_client&client_secret=secre
t&grant_type=client_credentials
Q: Explain Creating / Customizing webservices (WS)?
✓ Q: What is the best way to “add multiple WS (or) Customize multiple existing WS”?
Generate new extension from ycommercewebservices template (like same as developing new
storefront from yacceleratorstorefront template).
Note: - Alternative is to create new addon to extend existing API or add new one, this could be a valid
solution in some cases.
✓ Steps to generate a new extension from ycommercewebservices extension:
o ant extgen
o Please choose a template for generation = ycommercewebservices
o Please choose the name of your extension = mywebservices
o Please choose the package name of your extension = com.chenna.webservices
o Next steps: - (1) Add your new extension (mywebservices …) in "localextensions.xml" (2) Please
remove all template extensions (ycommercewebservices …) (3) Make sure the applicationserver
is stopped (4) Perform 'ant clean all' (5) Restart the applicationserver
Contact us for more information [email protected] (Java–Salesforce–SAP Portal–UI5/Fiori–Hybris)
✓ Now let’s add new WS under version 2 structure, our WS will give a list of String of all running cronjob
codes. For this we need to create a new class CronJobsController under web/src source folder: -
Now we need to create java bean CronJobListWsDTO using mywebservices-beans.xml file: -
Now do “ant clean all” & start your server. Call our newly created webservice to see the results: -
Goto Postman & Hit URL = https://localhost:9002/mywebservices/v2/electronics/cronjobs/running
Note: - Don’t forget that you 1st to generate a token as ROLE_TRUSTED_CLIENT in order to call new WS
since we have declared it with @Secured(“ROLE_TRUSTED_CLIENT”).
✓ Q: How to cache a WS?
o 1st Create a new cache config for our cronjob controller, open the file
mywebservices/web/webroot/WEB-INF/cache/ehcache.xml & add: -
o Then update our controller to be Cacheable. In this example we cache answer for 1 key & for 30
seconds, you can find more complex examples in other controllers: -
Contact us for more information [email protected] (Java–Salesforce–SAP Portal–UI5/Fiori–Hybris)
Q: Explain CMS Navigation Bar?
✓ Hybris Accelerator CMS extension offers items to configure the top navigation nodes: -
o NavigationBarCollectionComponent = An item used to display top navigation menu, it holds a
collection of NavigationBarComponents
o NavigationBarComponents = Main item type, this represents a section of the top navigation
menu, can hold a CMSNavigationNodes (to display sub link) & a CMSLinkComponents
o CMSNavigationNodes = Represents architecture of navigation menu, each node can have parent
nodes & children nodes
o CMSLinkComponents = Represents a link, with a name and a URL
Q: Explain Order Splitting?
✓ It is part of Order Management Module & is responsible of splitting orders into different consignments
based on implementation splitting strategy.
✓ Q: What is service responsible for splitting orders into different consignments?
de.hybris.platform.ordersplitting.orderSplittingService =
This service contains a list of splitting strategies to apply on a given order.
A strategy needs to implement de.hybris.platform.ordersplitting.strategy.SplittingStrategy
✓ Q: What are out of the box strategies?
o splitByAvailableCount
o splitByDeliveryMode
o splitByPoS
o splitByNamedDeliveryDate
o splitByEntryDeliveryAddress
o splitByWarehouse
✓ Q: How to implement a new strategy?
Use “de.hybris.platform.ordersplitting.strategy.AbstractSplittingStrategy”
This helps by doing most of the work, all you have to do is to implement getGroupingObject (to select
the attribute to group order entries) and afterSplitting to create consignment.
Contact us for more information [email protected] (Java–Salesforce–SAP Portal–UI5/Fiori–Hybris)
Q: Explain Promotion?
✓ Hybris V6 introduced a major change with the new Promotion Engine (Running with new rule engine).
Legacy Promotion Module uses deprecated Jalo Layer, but new Promotion Engine uses services layer
and is highly flexible.
✓ For backward compatibility reasons Hybris V6 both legacy Promotion Module & new Promotion Engine
are available, all new promotion implementation should be done using the Promotion Engine.
✓ The rule engine is based on Drools.
Q: Explain Payment?
✓ Hybris provides a module to integrate external payment gateways such as CyberSource. This module is
designed to seamlessly integrate any PSP into your checkout flow.
✓ Since Hybris V6, CyberSource payment integration is not part of the Commerce Accelerator, so you need
to add the CyberSource extension.
✓ Q: What are the major steps when we integrate a new payment provider?
o Authorization = Authorized amount of money remains locked on card’s account until it is
captured or authorization is reversed (cancelled) or authorization is expired.
o Capture = Capturing an authorization means authorized amount of money is actually transferred
from card holder account to merchant account. Capture operation requires a previous successful
authorization that has not yet expired.
o Partial Capture = Capture only a fragment of the reserved amount
o Void = Cancel an ongoing authorization
o Follow on refund = Refund money to the customer’s bank account for an order
o Standalone refund = Refund money to customer’s bank account when not attached to any
transactions or orders
o Is applicable = Command to check if payment provider can execute a given command
When you have implemented all commands for Ur payment service provider, create a new bean
using de.hybris.platform.payment.commands.factory.impl.DefaultCommandFactoryImpl,
and inject all your commands in it.
Hybris can have multiple PSP configured at the same time, it’s up to the checkout low to give the
customer the option to choose the final PSP (Payment Service Provider).
Q: Explain Internationalization?
✓ Internationalization means making your software compatible with different currencies, countries….
localization means providing the appropriate resources for a specific language.
✓ Q: What are the Hybris supported out of the box: -
o Languages (localizations of business objects)
o Countries and Regions (tax regulations)
o Currencies (currency formats, rounding)
o Time Zones (online / offline dates, order dates)
o Number Formats (separation characters)
o Language fallbacks
Contact us for more information [email protected] (Java–Salesforce–SAP Portal–UI5/Fiori–Hybris)
o Tenant-specific settings
o Localized API for the service layer
o Compatible UI to manage localized attributes
✓ Q: What are the services to work with internationalization & localization are available?
o de.hybris.platform.servicelayer.i18n.I18NService = Service to work with Java internationalization
objects(Locale, Currency, TimeZone)
o de.hybris.platform.servicelayer.i18n.CommonI18NService = Service to work with Hybris
localization objects (LanguageModel, CurrencyModel, CountryModel, RegionModel), those items
can be used to create a Java Locale object.
o de.hybris.platform.servicelayer.i18n.L10NService = Provides methods localized resources bundle
o de.hybris.platform.commerceservices.i18n.CommerceCommonI18NService = provides
localization objects for the current base site.
Q: Explain Request handling?
✓ Hybris accelerators are built on top of Spring MVC, this will handle all HTTP requests you make to Hybris.
✓ dispatcherServlet (org.springframework.web.servlet.DispatcherServlet ) is responsible of handling &
dispatching requests for all incoming requests it receives.
Unique entry point is configured for each extension web module, by default it’s the name of extension.
You can change from your configuration (they are intentionally empty):
1 chennastorefront.webroot =
2 storefrontContextRoot =
✓ Below is how Spring MVC handles requests: -
Contact us for more information [email protected] (Java–Salesforce–SAP Portal–UI5/Fiori–Hybris)
Q: Explain Request filters?
✓ Request filters are handled by DelegatingFilterProxy.
It delegates to an implementation of javax.servlet.Filter that’s registered as a bean in Spring App context
✓ Q: What are the OOB filters configured in Accelerators?
o cmsSiteFilter
o storefrontFilter
o urlEncoderFilter
o springSecurityFilterChain
o anonymousCheckoutFilter
o cartRestorationFilter
o customerLocationRestorationFilter
✓ Filter entry point is configured inside your web application web.xml file: -
✓ Q: How to Create a new request filter?
Create a new class (XXX) that extends GenericFilterBean & write logic in doFilter() method.
Then update your storefront spring-ilter-config.xml file with created Filter class (XXX).
✓ Order you place your filter matters as they are executed in the list order.
Q: Explain Hot Folders?
✓ Hybris provides different ways to import data, one of them is a hot folder.
Hot folder means that when you transfer a file into a specific folder with matching name it will
automatically be processed by Hybris.
✓ Hot folder functionality is located inside acceleratorservices Ext, it’s based on Spring Integration FWK.
✓ Q: What actions are executed when you transfer a file into a hot folder?
o An inbound channel detects a new file matching a pattern (file:inboundchannel-adapter)
o An outbound channel moves the file to a new folder (file:outbound-gateway)
o Activators setup the headers (int:service-activator)
o Resolve mapping between the file name & the type to import
o Generate the impex
o Run the impex
o Cleanup
Q: Explain Data Modeling?
✓ Hybris gives you the ability to extend the existing model definition, this way you can completely
customize the Hybris platform with your own types & attributes and your own relations between types.
✓ All types definition are done using XML item files, from extensions with a core module
(resources/chennaextension-items.xml): -
Contact us for more information
[email protected] (Java–Salesforce–SAP Portal–UI5/Fiori–Hybris)
✓ In *-items.xml file you can declare different item types: -
o Atomic Types = Basic Types available in Hybris (Number, String, Date....)
o Collection Types = It can be Collection (Unordered), List (Ordered), Set (Unique).
Note: - Collection is kept in DB by saving a csv list of instance pks.
Example: - Create a wish list of set Products for Customers: -
After performing updating User table would look like this = |p_wishlist|text|YES||NULL||
Note: - If you query a Customer who has 3 products in his wish list =
select p_uid, p_wishlist from users where p_uid = "hybris";
Then you can see size of the Set (3) and the 3 Products PKs.
o Enumeration Types = Similar to Java Enumerations & used to declare collection of constants.
Hybris enumerations can be dynamic (means U can add values during runtime, In Java enum not).
o Map Types = Are collections of key / value pairs & used under Hybris for localized elements.
Example: - When we use localized:java.lang.String, below is example extracted from *-items.xml:
o Relation Types = Used to represent n:m relations. Internally Hybris links both element via an
instance of a helper type called LinkedItem.
LinkedItem holds 2 attributes: - SourceItem & TargetItem. When Hybris runs a search query on
either side of relation it returns a java Collection that contain all values.
Contact us for more information [email protected] (Java–Salesforce–SAP Portal–UI5/Fiori–Hybris)
o Item Types = Are main type used to build Hybris platform. All types are derived of a
ComposedType. It holds metadata about the types like the item’s type code, JNDI deployment
location, DB table deployment and the type’s java class.
Exercise & Design your own data types? = Create Blog, so employees add Blog about new Products & company.
✓ Posts = Represent content of each blog entry. Each post is linked to a blog linked to 1 / More CMSSites,
each post can have comments linked to users.
Step 1 = Create new enum types for post status (draft, published, deleted) & for comment status
(pending, approved, blocked) = …/chennatrainingcore/resources/chennatrainingcore-items.xml
Step 2 = Create new item types = ChennaPost, ChennaBlog & ChennaPostComment.
When you create new item types it is mandatory to specify a deployment table, or the build would fail.
Q: How to deactivate checking build? = build.development.mode=false
Contact us for more information [email protected] (Java–Salesforce–SAP Portal–UI5/Fiori–Hybris)
✓ Step 3 = Create relations between Blog & CMSSIte
✓ Step 4 = Now perform ant all / ant clean all. Hybris platform, build framework will:
o Generate Model classes for the service layer (for example BlogModel)
o Abstract Jalo layer classes, starting with Generated (for example GeneratedBlog)
o Non abstract Jalo layer classes, with the same name as the item type (for example Blog)
Jalo is deprecated since Hybris V4.3, however not all logic has been moved to the service layer. If you
don’t plan to use the Jalo layer with your item types you can use generate=“false”.
✓ Step 5 = Now perform Update operation from hAC.
Q: How to check created item types / tables? = Use backoffice / Check in DB.
Contact us for more information [email protected] (Java–Salesforce–SAP Portal–UI5/Fiori–Hybris)
✓ Step 6 = How to insert / import data?
Q: How to extend existing types?
✓ Hybris not only gives creating new types. It also allows to extend core item types (User, Product, …).
✓ This is the great feature from Hybris. No need to build from scratch. You can just do on top of existing.
✓ Example: - User will have BOD attribute. Product will have boolean attribute to activate (or not).
Note: - Now perform Update operation & goto Backoffice / DB and see new attribute been added.
Q: Explain Localized Attributes?
✓ It gives ability to dynamically serve different content (text / image / link / …) based on user language.
✓ Example: - Let’s say, Product name is localized attribute: -
Note: - When an item type has a localized attribute, then Hybris will automatically create an extra
database table ending with lp. Example if Product type has the table productslp.
Each localized attribute of an item is grouped in this table and linked to a language through LANGPK.
The model service will create getters and setters like below: -
Contact us for more information [email protected] (Java–Salesforce–SAP Portal–UI5/Fiori–Hybris)
Q: How to declare localized attributes? = Localized attributes are maps & declared under core-items.xml:
Q: Explain Enumerations?
✓ Hybris provides attributes with a predefined list of possible values. It’s similar to Java Enum but DB Level.
✓ Enum in Hybris could be Dynamic. If you configure your enum not to be dynamic then Hybris will use
standard Java enum instead hybris enum.
✓ You can add new values from different extension if needed. Example: - OrderStatus enum is defined in
core extension, but from my extension (chennaaddon) we can add new values: -
✓ Enumeration Service = Hybris provides a service to deal with enumeration
de.hybris.platform.enumeration.EnumerationService
Q: Explain Dynamic attributes?
✓ Sometimes, we need dynamic attributes on Data Model objects (Which are not persisted to DB).
✓ Q: What are the usages of Dynamic Attributes?
o Format data like addresses / names
o Create a calculated field
o Combine multiple non-dynamic attributes
✓ Q: When not to use a dynamic attribute?
o Integrate your model with any external systems or database
o Trigger any intensive operation, it would slow down the platform as getters & setters are
frequently called by the cache mechanism
o Implement your own SQL query
✓ Q: Steps in Implementing a dynamic attribute?
o Create a value provider, it musts implement ‘DynamicAttributeHandler’ interface
o Write the logic for the getter not setter
o Write the value provider using Spring
o Add value provider under your item xml definition file, setting persistence to dynamic with
attribute handler parameter equal to your spring bean
o If you just need getter and not the setter you can customize the modifier attribute
Contact us for more information [email protected] (Java–Salesforce–SAP Portal–UI5/Fiori–Hybris)
Q: Explain Deployment?
✓ DB Table = Deployment & specified in “items.xml” file.
✓ Every type must have a deployment table to store its instance.
✓ Types inherits deployment tables from their super types. Top most deployment = GenericItem (Default).
So if we don’t specify deployment then instances are deployed in table as “GenericItem”.
Example: - Users & Products types in Hybris are subtypes of “GenericItem”. If we don’t specify
deployment then attributes will be created in 1 DB Table = GenericItem.
Having Single DB table with lot of columns will be challenging. So best would be specifying Deployment.
✓ If we don’t declare deployment for new item type (extending GenericItem) will lead build fail =
[ycheckdeployments] No deployment defined for relation in file.
If you want to force this behavior then use build.development.mode=true
Q: Explain Indices?
✓ Hybris allows us to add DB indices on item types. Indices have name & 1 / more keys (Composite indices).
Hybris will run the following SQL command (may vary upon the targeted database, here we use HSQL):
CREATE UNIQUE INDEX blogIDX_11001 ON BLOG (P_CODE, P_ACTIVE);
Q: Explain Types in DB?
✓ Hybris generates SQL commands based on DB (Oracle / MySQL / MSSQL / …) specified. There is OOB
mapping for this in “core-advanced-deployment.xml”.
Contact us for more information [email protected] (Java–Salesforce–SAP Portal–UI5/Fiori–Hybris)