SAP Commerce(SAP Hybris) learning materials summary

Keywords: Java xml Attribute Junit

Version No.: v1.02
@TOC

Official help document for SAP

Installer-Recipe

  • Cannot be used for production purposes. Folder location: installer/recipes link Contains a description of all recipe s.

The concept of Extension and Addon

  • Several extensions are combined and published as module s.

An extension can contain business logic, type definitions, a web application, or a Hybris Management Console configuration. That way, you link up in one place all of the functionality that covers a certain field of use, for example a webshop.

Addon is a special extension that extends the function of Commerce Accelerator. This extension adds UI pages, but does not directly modify the implementation of Storefront.

AddOns extend the functionality of the SAP Commerce Accelerator. They are a type of extension that allow you to add front-end files such JSP, HTML, CSS, and JavaScript files, and images without modifying the storefront front-end files directly.

this link It contains a table to query the ID and description of Extension and Addon

An extension is an encapsulated piece of software that extends SAP Commerce functionality by either modifying existing features, or introduction new features.

Extension modules are structural elements of an extension.

Extension module is part of extension.

You can implement JUnit tests for the extension's core extension module. The files for these JUnit tests must be located in the testsrc directory of the extension.

Each extension has an extension module named core, which contains the extension's type system definition, items.xml, which is located in the resources folder. Naming conventions:

The name of this file is always defined accordingly: <$extension> -items.xml where <$extension> is the name of an extension.

The type related Java source code file is also located in the core extension module.

items.xml link.

  • web extension module: it is a part of extension and can be accessed through browser:

To launch a web extension module via your web browser, go to the URL path to Platform on the server/name of extension/starting page. For example, if you are running myExtension locally on default settings, the URL would be http://localhost:9001/myExtension.

Internationalization-and-localization

  • What is the core module of extension

A core module consists of an items.xml file (and therefore allows to add new types to the system), a manager class, classes for the JaLo Layer and the ServiceLayer and JUnit test classes. The following directories are required: /src, /resources, /testsrc.

While the Commerce Platform can run without any package, no package can run without the Commerce Platform.

Commerce platform is also composed of extension, called core extension. On top of these core extensions are build framework and tomcat server

Hybridis initialization and update process

What is Hybris initialization

Initialization drops existing type definitions from the database prior to rebuilding, so the entire type system is created from scratch. So during an initialization, type system definitions are created to match the type system definition in the items.xml files.

Update: the new type defined in items.xml will be applied to the type system.

Model

Generate types based on the definition of items.xml

Spring framework in SAP commerce

It is the foundation of Service Layer

Dependent Injection: the dependency of a component is not maintained by itself, but is configured externally.

Dependency injection is a software architecture pattern in which a component's dependencies are not managed by the component itself but are configured externally.

A so-called container (application context) reads the configuration file, resolves the dependencies, and puts together the objects. When the objects are ready, all the dependencies are already injected.

<bean class="de.hybris.platform.order.OrderService">
    <property name="stockService">
        <bean class="de.hybris.platform.stock.StockService"/>
    </property> 
</bean>

Location of xml file: ${hybris ﹣ bin ﹣ dir} / platform / ext / core / resources
Naming conventions:

There you find files with the name pattern |component|-spring.xml, where is something like product, order, i18n, security, and so on. For the beans themselves, a name pattern such as xyzService is recommended, such as: productService, catalogService, and so on.

The API of Service Layer is exposed through interface. The implementation of interface is Spring beans. id name can be found in SAP commerce API doc.

Accelerator

SAP Commerce Accelerator is a ready-to-use web implementation template that enables you to jumpstart your implementation and easily build and maintain a feature-rich and flexible commerce solution.

Service-Layer

It is a general term of three layers: ServiceLayer Framework (including the actual ServiceLayer, the Infrastructure Services, and the Business Services)

relies on so-called models, which are POJOs. Attributes on models have automatically generated getter and setter methods. Models are generated based on types.

Product model is the concept of service layer, which is automatically generated based on type, getter and setter
Type layer is also called items.xml

Hybris-Type-System

A type system is a template for an object. Every object in platform is an instance of type.

Types define persistent objects:

  • Attribute stores the data for the object.
  • Deployment definition database table
  • java class

A Type is the type definition in items.xml and its Java implementation.

An object instance of a type is called an item:

There are two types: system related types and business related types

System related types are composed of the following types:

Infrastructure types: ComposedTypes (also referred to as ItemTypes) set up type definitions and may carry attributes to hold information. In the end, every persistent object in the SAP Commerce is an instance of ComposedType or of one of its subtypes.

Business-related types: (like Order, Discount, Shoe) allow you to manage product and / or customer information so that you can run your business.

every object stored in SAP Commerce is an instance of a type. Even type definitions are instances of the type Type. This means that there are two aspects of a type definition: it is an item and, at the same time, it defines other items.

To differentiate between normal object instances and type definitions, non-type objects in Platform are referred to as items. The lower case spelling item refers to an object in Platform; the upper case spelling Item refers to the type definition.

Items in lower case represent non type object in platform, and items in upper case represent type definition.

The following code snippet defines an item called SpecialProduct that is a subtype of Product but its type is not defined as a ComposedType, but as a SpecialComposedType (via the metatype attribute). Instances of SpecialProduct are thus subtypes of Product, but the type definition is stored as a SpecialComposedType.

<item code="SpecialProduct"    metatype="SpecialComposedType"    extends="Product">

Type defines attribute, just like Java class defines fields. Attribute can be a compound type or a simple Java type.

Platform-Services-and-Utilities

backoffice

Information of other netizens

Three overview articles by Zhang Jonathan, Commerce developer of SAP Chengdu Research Institute:

Jerry Wang's article:

Other articles:

Posted by jscofield on Sat, 11 Apr 2020 18:48:57 -0700