Skip to main content

Review Hybris to find the relevant uses of the Media URLs

Overview

As part of the cold storage process proposal described here: https://rapha.fyi/docs/squads/dam/adr/adr003-unapproved-assets-cleanup

and in order to render the Cloudinary assets in the hybris FE, it should be useful to use different Cloudinary utilities to retrieve the full URL from cloudinary without saving it in Hybris. The idea will be the Cloudinary public ID in hybris, in order to use this utilities. This has different PROS and CONS.

So, it’s necessary to review the points in the hybris source code where an hybris media url is used, in order to assess the potential impact of this change.

At the moment hybris is sending the url of the medias as notifications in newstore when an image is changed.

Hybris Model Objects

The Hybris Media model objects saved in the DataBase (related or not with Amplience) are:

  • MediaModel: assets for products editable from HMC (normals, triptychMediaSet). The relevant attributes to modify are: internalUrl (full URL that points to the media) , videoThumnail (only populated for videos) and mediaFormat (contains a string for the type of the asset: image or video).

  • CMSMediaModel: assets for Hybris SmartEdit/CMS components editable from HMC or SmartEdit. The relevant attributes to modify are: url (full URL that points to the media), thumbnailUrl (only populated for videos) and mime (contains a string for the type of the asset: image or video).

These are the source of urls in Hybris, and therefore, will be referenced in several parts and extensions in Rapha Hybris Customisation. The purpose of this documentation is to enumerate what these parts are and what they can affect if the URL attributes (internalUrl or url) instead of being the full URL, store only the Cloudinary Public ID.

References & Usages

MediaModel

The internalUrl attribute is directly referenced in two Populators, that populate a couple of Java objects:

1 - ImageDTO: DTO that represents an asset in several layers of Hybris Monolith. This DTO is the one used mainly in the raphastorefront extension to render the images in the corresponding PDP and Product Related JSP TAGS.

2 - ProductDTO: DTO that represents a product in the cronjob RaphaProductModificationNotificationJob (productModificationNotificationCronJob), this cronjob is executed daily, and sends notifications to EXPONEA containing the daily product modifications (incluiding the images url). The notifications are sent through the corresponding Exponea MiddleWare Lambda.

3 - CommonImageDTO: DTO that represents a product in the notifications triggered by RaphaSaveProductInterceptor, this notification is triggered every time some specific modifications in the products are saved (name, category, description, summary and images), and sends notifications to NEWSTORE containing the corresponding info. The notifications are sent through the corresponding Newstore MiddleWare API Getaway Endpoint, this enpoints call the Hybris Enrichment Lambda.

4 - Special Mentions: Hybris Cronjobs: there are several cronjobs that uses the Media object url and they need the full url, for example:

  • generateGoogleMerchantFeed: generates a XML file for Google Merchant Center containing the products, containing the media urls.
  • wholesaleProductDataExportJob: generates ad CSV file for Wholesale orders, containing descriptions and media urls.
  • BVProductFeedExportJob: generates a XML file for Bazarvoice containing the products, containing the media urls.

5 - Special Mentions: Additional Product attributes: there are some products that are created mannually, like bundles that have been populated with a main image and a thumbnail image, instead of using gallery, mannequin and triptych images. Therefore, this must be taken into account in the future migration.

CMSMediaModel

The url attribute is directly referenced by different Smart Edit CMS populators, and are use exclusively to render images in the front end and smart edit, no integrations related.

Special Mentions: CMSParagraphComponentModel

The CMS Paragraph component is a Smart Edit CMS component in which the user references images directly by editing HTML, in this case the component saves HTML with the paragraph section structure, so images are displayed based on their full URL, and it would be more difficult to use public Cloudinary ID, since the type of image contained in the paragraph would not be known.

CMSParagraph1

CMSParagraph2

Note: There may be more uses of persisted urls in DB through the Hybris Suite & internal framework, but they haven't been found more direct references.

Conclusions

There are too many dependencies on the use of the full URL in hybris, so it should continue to be persisted, because the cost associated with replacing the current developments with the use of only the Cloudinary Public ID is high and very difficult to estimate in some of the cases.