What is catalog aware ItemType and How to create it in Hybris?

Sometimes, it is required to define our custom item types as Catalog aware item types in order to make them eligible for synchronization.

While creating a data model for any project, where we might need some of your item types to be part of catalog. This means, you want them to synchronize, you want them to be associated with a catalog, content or product. Such item types are known as catalog aware.

It’s not just CMS item types or products, that needs synchronization. 

All OOTB CMS items and products are catalog aware.

We can achieve this either in HMC/Backoffice (Not persist for a long time) or by defining required attributes in items.xml file.

Step 1:

Mark your item as catalog item type, using custom property catalogItemType.

Step 2:

Choose attribute from item, which will qualify the  catalog associated using custom property catalogVersionAttributeQualifier.

Step 3:

Since each item in a catalog must be unique, we need to choose an attribute from item which is unique. This can be done using custom property uniqueKeyAttributeQualifier. (If there are multiple unique attributes then separate them by comma)

<itemtype code="MyCustomItemType" autocreate=”true” generate=”true”>

<deployment table=" MyCustomItemType " typecode="12500"/>

   <custom-properties>

      <!-- Defining the type as synchronizing capable here: -->

      <property name="catalogItemType">

         <value>java.lang.Boolean.TRUE</value>

      </property>

 

      <!-- defining catalog version attribute here: -->

      <property name="catalogVersionAttributeQualifier">

         <value>"catalogVersion"</value>

      </property>

      

      <!-- defining unique key attributes here; separate multiple attribute qualifiers by commas: -->

      <property name="uniqueKeyAttributeQualifier">

         <value>"code"</value>

      </property>

   </custom-properties>

   <attributes>

      <attribute qualifier="code" type="java.lang.String">

         <modifiers read="true" write="true" search="true" optional="false" unique=”true”/>

         <persistence type="property"/>

      </attribute>

  

      <attribute qualifier="catalogVersion" type="CatalogVersion">

         <modifiers read="true" write="true" search="true" optional="false"/>

         <persistence type="property"/>

      </attribute>

   </attributes>

 

</itemtype>

 


Can we run multiple hybris instances in one machine if yes then how?

Yes we can run as many hybris we want, till our machine memory permits. Hybris runs on a tomcat instance and is shipped with a bundled tomcat. 

To do so, we need to make each instance of tomcat to have its own ports to use. Make below ports unique for each instance. 

We should add below properties in the local property file of each instance with unique values.

tomcat.http.port=6001 

tomcat.ssl.port=6002 

tomcat.ajp.port=6009 

tomcat.jmx.port=6003 

tomcat.jmx.server.port=6004