Hybris: Jalo Layer:
The Jalo
Layer is the traditional hybris Commerce Suite functional layer. It combines
data model aspects and business logic aspects. "Jalo" is short for
"Jakarta Logic". "Jakarta" being the original name of the
hybris Platform.
Schematic Overview
The hybris Jalo Layer
offers an API to clients using the hybris Commerce Suite and abstracts from the
database. It also covers two major aspects of the hybris Commerce Suite:
·
Data
Model, which you can define
in the items.xml files in the form of types and
attributes.
·
Business
Logic, which you implement
in Java classes.
For each type defined
in the items.xml file, the hybris Commerce Suite's Build
Framework generates two Java files:
·
Abstract
Java class: Automatically
generated by the hybris Commerce Suite Build Framework and generated again on
every hybris Commerce Suite build. Abstract Java classes contain
automatically-generated getter and setter methods for the defined
type attributes in the items.xml file.
·
Non-Abstract
Java class: Extends from the
abstract Java class. Non-Abstract Java classes are only generated by the hybris
Commerce Suite Build Framework if they are non-existent. Non-Abstract Java
classes are not overwritten during hybris Commerce Suite builds.
Figure: Overview of
the Jalo Layer
See Also
The hybris Jalo Layer is a tight coupling
between data model and business logic, as the implemented business logic in
Java classes that are generated are based on the data model. If the data model
changes, your business logic might need adaption as well. For example, if you
rename a type, the Java classes have to be renamed too. For a more loose
coupling between data model and business logic, see ServiceLayer.
You can implement Java classes that are not
backed by the data model, but the instances are runtime objects only and are
not persistent. An example for such non-persistent Java classes is the JaloSession.
Using
the Jalo Layer
The basic workflow of
using the Jalo layer is as follows:
·
Define your data model
in terms of types and attributes using the items.xml file.
·
Build the hybris
Commerce Suite to have the Java classes generated.
·
Implement business
logic in the non-abstract Java class.
Usage
Example
This section demonstrates a concrete example
of using the hybris Jalo Layer.
The following items.xml file
sample defines the type MyType with a single String
attribute, MyAttribute:
<itemtype
code="MyType" autocreate="true" generate="true"
jaloclass="de.hybris.jalolayer.sample.MyType">
<attributes>
<attribute
type="java.lang.String" qualifier="MyAttribute">
<persistence
type="property" />
</attribute>
</attributes>
</itemtype>
Running a build of the hybris Commerce Suite
will result in two Java classes being generated:
Fully Qualified Java Class Name
|
Path and File Name
|
Description
|
de.hybris.jalolayer.sample.GeneratedMyType
|
gensrc/de/hybris/jalolayer/sample/GeneratedMyType.java
|
Abstract Java class, containing
getter and setter methods for MyAttribute such as:
·
public
String getMyAttribute(final SessionContext ctx)
·
public
String getMyAttribute()
·
public
void setMyAttribute(final SessionContext ctx, final String value)
·
public
void setMyAttribute(final String value)
|
de.hybris.jalolayer.sample.MyType
|
src/de/hybris/jalolayer/sample/MyType.java
|
Non-abstract Java class extendingGeneratedMyType.
Here you can implement your business logic and optionally override the getter
and setter methods for MyAttribute if you need special
business logic for that.
|
for more informayion about jalo layer goto wiki
hi good explanation
ReplyDeletehi good explanation
ReplyDeletegood job anna
ReplyDelete