SAP Commerce(SAP Hybris)學習資料彙總

i042416發表於2020-04-11

版本號:v1.02 @ TOC

SAP官方幫助文件

Installer-Recipe

  • 不能用於生產用途。資料夾位置:installer/recipes. 這個 連結包含了所有recipe的說明。

Extension和Addon的概念

  • 若干extensions組合在一起,以module的形式釋出。
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是一種特殊的extension,擴充套件了Commerce Accelerator的功能。這種extension新增了UI頁面,但又沒有直接修改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.

這個 連結包含了一個表格,可以查詢Extension和Addon的ID和description.

  • 總體架構
  • Extension專題 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是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.
每個extension都有一個名叫 core的 extension module,包含了該extension的type system definition,items.xml, 位於resources資料夾內。命名規範: The name of this file is always defined accordingly: <$extension> -items.xml where <$extension> is the name of an extension. 與型別相關的Java source code檔案也位於core extension module內。

items.xml的 連結. * web extension module: 是extension的一部分,可以透過瀏覽器訪問:

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 Web application filter  如何建立新的extension

Internationalization-and-localization

  • 什麼是extension的core module: 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也是由extension組成的,稱為core extension. 在這些core extension之上才是build framework,和tomcat server.

Hybris-initialization和update過程

什麼是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: items.xml裡定義的新型別,會施加到型別系統裡。

Model

基於items.xml的定義生成types.

SAP-Commerce裡的Spring框架

是Service Layer的foundation.

Dependent Injection: 元件的依賴不是其自身維護,而是配置在外部。

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>

xml檔案的位置:${HYBRIS_BIN_DIR}/platform/ext/core/resources 命名規範:

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.

Service Layer的API透過interface暴露出來。interface的實現就是Spring beans,id name可以從SAP commerce API doc裡找到。

SAP Commerce(SAP Hybris)學習資料彙總


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

是三層的統稱: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.

ProductModel是service layer的概念,基於type自動生成,getter和setter. Type layer也就是items.xml.

Hybris-Type-System

型別系統是物件的模板。platform裡每個物件都是型別的例項。

Types定義了持久化物件:

  • Attribute儲存物件的資料。
  • Deployment定義資料庫表
  • java class

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

SAP Commerce(SAP Hybris)學習資料彙總


An object instance of a type is called an item: 型別分兩種:System-related types and business-related types.

System-related 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.


SAP Commerce(SAP Hybris)學習資料彙總


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代表platform裡non-type物件, 大寫的代表型別定義。

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">

型別定義attribute,如同Java 類定義fields, attribute可以是複合型別或者簡單Java型別。

Platform-Services-and-Utilities

backoffice

其他網友的資料

SAP成都研究院Commerce開發人員Zhang Jonathan的三篇概述文章:

Jerry Wang的文章:

其它文章:


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2685556/,如需轉載,請註明出處,否則將追究法律責任。

相關文章