ItemType
- ItemTypes are basically used to create models and its table in the database which helps you in implementation with these models. then you can apply different operation on models like : updating, deleting and so many operations.
- ItemTypes are the foundation of the Commerce Cloud Commerce Suite’s type system.
- Items are also commonly referred to as ComposedTypes.
- Items can be created with the help items.xml.
Example:
Item Type: Customer
<itemtype code="Customer" extends="User"
jaloclass="de.hybris.platform.jalo.user.Customer" autocreate="true"
generate="true">
<attributes>
<attribute autocreate="true" generate="true"
qualifier="customerID" type="java.lang.String">
<modifiers read="true" write="true" search="true" optional="true"/>
<persistence type="property"/>
</attribute>
</attributes>
</itemtype>
Item Type: Product
<itemtype code="Product" extends="GenericItem"
jaloclass="de.hybris.platform.jalo.product.Product" autocreate="true"
generate="true">
<deployment table="Products" typecode="1" propertytable="ProductProps"/>
<attributes>
<attribute autocreate="true" qualifier="code" type="java.lang.String" generate="true">
<persistence type="property"/>
<modifiers read="true" write="true" search="true" initial="true" optional="false" unique="true"/>
<custom-properties>
<property name="hmcIndexField">
<value>"thefield"</value>
</property>
</custom-properties>
</attribute>
<attribute autocreate="true" qualifier="name" type="localized:java.lang.String">
<modifiers read="true" write="true" search="true" optional="true"/>
<persistence type="property"/>
<custom-properties>
<property name="hmcIndexField">
<value>"thefield"</value>
</property>
</custom-properties>
</attribute>
<attribute autocreate="true" qualifier="unit" type="Unit" generate="true">
<persistence type="property"/>
<modifiers read="true" write="true" search="true" optional="true"/>
</attribute>
<attribute autocreate="true" qualifier="description" type="localized:java.lang.String">
<modifiers read="true" write="true" search="true" optional="true"/>
<persistence type="property">
<columntype database="oracle">
<value>CLOB</value>
</columntype>
<columntype database="sap">
<value>NCLOB</value>
</columntype>
<columntype>
<value>HYBRIS.LONG_STRING</value>
</columntype>
</persistence>
<custom-properties>
<property name="hmcIndexField">
<value>"thefield"</value>
</property>
</custom-properties>
</attribute>
<attribute autocreate="true" qualifier="thumbnail" type="Media">
<persistence type="property"/>
<modifiers read="true" write="true" search="true" optional="true"/></attribute>
<attribute autocreate="true" qualifier="picture" type="Media">
<persistence type="property"/>
<modifiers read="true" write="true" search="true" optional="true"/>
</attribute>
</attributes>
<indexes>
<index name="Product_Code">
<key attribute="code"/>
</index>
</indexes>
</itemtype>
Attributes:
- ItemTypes (and therefore Every items) may have many number of attributes.
- Attributes defined under any Itemtype are similer like columns in a table in DataBase.
- For creating Attribute , define it in Attribute Descriptors of Itemtype.
- Attribute can be accessed from its super ItemType for a child ItemType.
- you can restrict Attributes using modifiers given below:
- Read write initial optional search unique
Types Of Attributes:
- Property Attribute
- Dynamic Attribute