During the last months, my development team is getting the requirement to provide means to sells product groups with a special real-time calculation of the price, the offer of additional services or definition of the components of the article in each order. Because these features are expensive to develop on our legacy e-shop, Hybris can't offer these features out-of-the-box, developers with Hybris experience are scarce and it takes around seven months for a Java developer to fully understand the limitations of Hybris' persistence layer, I am looking for alternatives to implement these requirements using Java frameworks and tools which are common in the IT market.

While we are using Spring Boot, Tymeleaf and JQuery for the frontend, I am looking now for a framework for the administration of the system (backend) which offers the same features as HMC with the same or less development effort for Java developers

To improve the initial performance of your Backoffice application, you can use the defined bean backofficeWarmUpTypeFacadeCaches. This bean is responsible for prefilling caches in the TypeFacade. You can configure which types should be prefetched introducing property typeNames.

You can disable this functionality by setting up the parameter fill.typefacade.cache.on.startup to "false" in your "local.properties" file.

The property afterInitializationEndBackofficeListener referes to the bean afterInitializationEndBackofficeListener defined in the "backoffice-spring.xml" file. The purpose of the bean is to listen to the system event AfterInitializationEndEvent and allow the bean warmUpTypeFacadeCaches to update its cache after the system initialization.

Please refer to the official documentation for more details on Backoffice extension customization.

 
 

Here are some examples of what can be query with FlexibleSearch. Please feel to send me complex queries which could help others understand the syntax.

When Hybris was first released in 1997, the first version Enterprise JavaBeans (EJB) was still immature and Hibernate ORM didn't exist. So Hybris developed its own proprietary persistence mechanism which generates Java classes from an xml file. These classes and their relations can easily stored into a relational database. As this is the only persistence mechanism supported by Hybris, every backend developer working with the e-commerce suite must understand how it works and its limitations.

Impex is the main way to import data into the Hybris eCommerce Suite. It is based on CSV and offer additional features like scripting, handling of maps and collections and removal of items.

Web Services

Here are some key concepts and useful notes regarding this extension which complement the Hybris documentation.

Concepts

Key Features

  • Caching
    • ETAG header. This is the default Jersey functionality and it reduces the bandwidth required for the requests. The workload is the same. It must be enabled.
    • The second Hybris caching strategy uses the If-Modified-Since HTTP header and it is inplemented.
    • The calculation of the ETAG can be expensive for complex responses.
    • A custom caching strategy could be implemented
  • Filtering of attributes (Attribute Selector)
    • Using query parameters or a property file a set of attributes of the resource may be returned.
    • The representation (detail or reference) of the complex attributes can be changed. The usefulness of this functionality is limited because only two levels of resources can be represented
  •  JSON:
    • Returns the body in JSON if the request contains the HTTP header Accept with the value application/json.
  • Localization: The header Accept-Language is used to determined the language.
  • Paging and Filtering of elements (Extended Collection)
    • Using query parameters the number of elements of collections and relations can be limited.
    • The number of elements returned per page may be random due to security constraints.
    • The filtering of relations allows a WHERE clause for the flexible search query. 
    • If the property given in *_sort doesn't exist in the elements, the whole object must be comparable.
  • Security
    • Each request must send the user and the password because RESTful services are stateless.
    • The user must be a member of the group webservicegroup when the hMC security strategy is turned on.
    • The read and change rights may be configurated using hMC (default) or property files.
    • It is possible to change the password or request a new one using REST.
  • Web Service Nature Ant Target:

Useful Tips

  • You can get the WADL using the url http://localhost:9001/trainingwebservices/rest/application.wadl where trainingwebservices is the name of your custom extension.
  • Virtual Resources and DTOs which aren't associated with a model go in the directory customextension/web/src. The spring bean definition of the virtual resource goes in customextension/resources/customextension-web-spring.xml
  • Custom Resources and custom DTOs which overwrite the ones generates by Hybris go in the directory customextension/custom/src
  • Customization of DTOs: Don't forget to add the platformwebservices extension as a dependency to your custom extension! If you forget and create the directory custom/src in your custom extension to overwrite a DTO, you will get the misleading error:

[yjavac] Compiling 2336 source files to /home/arobirosa/Documents/no_backup/hybris_certification/hybris/bin/ext-platform-optional/platformwebservices/web/webroot/WEB-INF/classes
[yjavac] ----------
[yjavac] 1. ERROR in /home/arobirosa/Documents/no_backup/hybris_certification/hybris/bin/ext-platform-optional/platformwebservices/web/src/de/hybris/platform/webservices/objectgraphtransformer/VariantAttributesConverter.java (at line 64)
[yjavac] dto.setVariantAttributes(targetVariantAttributes);
[yjavac] ^^^^^^^^^^^^^^^^^^^^
[yjavac] The method setVariantAttributes(List) is undefined for the type VariantProductDTO
[yjavac] ----------
[yjavac] ----------
[yjavac] 2. ERROR in /home/arobirosa/Documents/no_backup/hybris_certification/hybris/bin/ext-platform-optional/platformwebservices/web/src/de/hybris/platform/webservices/resources/methods/PostCartToCarts.java (at line 49)
[yjavac] for (final CartEntryDTO entry : dto.getEntries())
[yjavac] ^^^^^^^^^^^^^^^^
[yjavac] Type mismatch: cannot convert from element type AbstractOrderEntryDTO to CartEntryDTO
[yjavac] ----------
[yjavac] ----------
[yjavac] 3. ERROR in /home/arobirosa/Documents/no_backup/hybris_certification/hybris/bin/ext-platform-optional/platformwebservices/web/src/de/hybris/platform/webservices/resources/methods/PutCartToCarts.java (at line 47)
[yjavac] for (final CartEntryDTO entry : dto.getEntries())
[yjavac] ^^^^^^^^^^^^^^^^
[yjavac] Type mismatch: cannot convert from element type AbstractOrderEntryDTO to CartEntryDTO
[yjavac] ----------
[yjavac] 3 problems (3 errors)
 

Limitations

  • The PUT and POST requests doesn't seem to support a JSON body. A 400  Bad Request error is generated and there isn't any consumes annotation allowing JSON requests in the abstractResource class.

Based on Hybris version: 5.3

These JavaBeans are a new type of DTOs which can be extended by any extension and they are called DataObjects by Hybris. It allows a custom extension to modify the POJOs (which are DTOs) used by the facades of the Hybris extensions without writing a subclass of the POJO, of the facade and writing a new converter. This means, that if the facade uses a JavaBean, you can extend it without touching the Hybris code.

It triggers actions or shows CMS content to different groups of customers based on their behavior, interests, wishlists and historical data. Using targeted personalization the behavior of the customers can be measured and rewarded. You can show them special promotions, suggest them products, send them personalized emails or adapt the content and products of the web site to their interests.