onurkat's blog

my journey in software development

Implementing Custom Interceptors in SAP Hybris

SAP Hybris provides a robust platform for customization, and interceptors play a crucial role in extending and modifying the behavior of core models and services. This guide focuses on how to create and configure custom interceptors in Hybris.


What Are Interceptors?

Interceptors are hooks that allow developers to add custom logic at different lifecycle stages of a model, such as:

  • Before Save (PrepareInterceptor)
  • Validation (ValidateInterceptor)
  • After Save (AfterSaveEvent)
  • Remove (RemoveInterceptor)
Read more »

Understanding and Configuring Cronjob Triggers with Cron Expressions in SAP Hybris

In Hybris, cronjobs are essential for automating various backend processes, such as database cleanups, order processing, or generating reports. A crucial part of setting up a cronjob is configuring its cron expression. In this post, I will guide you through the process of setting up cron expressions and explain how they control the scheduling of cronjobs in Hybris.


What is a Cron Expression?

A cron expression is a string that represents a schedule for executing a task. It is widely used in UNIX-based systems and is also implemented in Hybris to define how often and when a cronjob should run.


Structure of a Cron Expression

A cron expression in Hybris consists of six fields, each representing a specific part of the schedule:

1
2
3
4
5
6
7
8
* * * * * *
| | | | | |
| | | | | +--- Day of the week (0 - 7) (Sunday = 0 or 7)
| | | | +----- Month (1 - 12)
| | | +------- Day of the month (1 - 31)
| | +--------- Hour (0 - 23)
| +----------- Minute (0 - 59)
+------------- Second (0 - 59)
Read more »

Dynamic attributes in Hybris (SAP Commerce) allow you to add flexibility to your models without having to modify the database schema. This guide will walk you through the complete cycle of creating and using dynamic attributes.

What is a Dynamic Attribute?

A dynamic attribute is a calculated property on a model that isn’t stored in the database but is computed at runtime. These attributes are useful when you need to provide values based on business logic without altering the model structure.

The Full Cycle of Creating a Dynamic Attribute in Hybris

Read more »

Hybris, SAP Commerce

Hybris is an e-commerce platform that was originally developed by a company called Hybris AG, which was later acquired by SAP in 2013. The platform is now known as SAP Commerce, but is still commonly referred to as Hybris.

Features

SAP Commerce/Hybris is a robust e-commerce platform that offers a wide range of features to help businesses sell their products online. Some of the key features of the platform include:

  • Product management: SAP Commerce/Hybris makes it easy to manage product catalogs and inventory levels, as well as create and manage product promotions.

  • Order management: The platform provides tools to manage the entire order process, from order creation to fulfillment and delivery.

  • Customer management: SAP Commerce/Hybris allows businesses to manage customer profiles and preferences, as well as provide personalized experiences based on customer data.

  • Marketing and personalization: The platform includes tools to create targeted marketing campaigns and personalized experiences for customers.

  • Multi-channel support: SAP Commerce/Hybris supports multiple channels, including web, mobile, and in-store, allowing businesses to reach customers wherever they are.

Read more »

1- Validating Email Addresses

Regex: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$

This regular expression can be used to validate email addresses in a form. It checks for a string of characters before the @ symbol, followed by a domain name and a top-level domain extension.

2- Matching URLs:

Regex: (http|https)://[a-zA-Z0-9./?=_-]+

This regular expression can be used to match URLs in a text file. It matches both http and https URLs and includes characters such as slashes, question marks, equal signs, and underscores.

3- Extracting Phone Numbers:

Regex: \d{3}-\d{3}-\d{4}

This regular expression can be used to extract phone numbers from a text file or a database. It matches a pattern of three digits, followed by a hyphen, three more digits, another hyphen, and four more digits.

Read more »

Sometimes computers freeze during development usually because our physical RAM isn’t enough for local development environment and there is a way to support our physical RAM with virtual RAM for Linux too.

By creating swap files, you can automatically move inactive pages in your RAM to these swap files when your RAM is almost full.
Since only the inactive pages are moved to this swap file, you will not lose your read-write speed by continuing to actively use your physical RAM and your computer will not freeze.

Simply put, swap files host unnecessary data from your RAM on your disk until it’s needed.

Read more »

Cool RegEx Examples

What is RegEx?

Regular expressions are useful in search and replace operations. The typical use case is to look for a sub-string that matches a pattern and replace it with something else.

Sometimes, learning how to write RegEx’es before you even need them can save you a lot of time.

Read more »

Hello world!

Who am I?

  • Onur Kat, a computer engineer from Istanbul, Turkey.

  • Currently, I’m working at Customertimes as Senior SAP CX (Hybris) Backend Developer.

Read more »
0%