Catalog Version API

The Catalog Version API provides information about a catalog version such as, the catalog version name, and page display condition details. SmartEdit uses the page display conditions during the page creation process to determine if a primary and/or variation page can be created. It also provides information about catalog versions that can be used as target catalog versions for clone operations.

Overview

The Catalog Version API provides information about a catalog version such as, the catalog version name, and page display condition details. SmartEdit uses the page display conditions during the page creation process to determine if a primary and/or variation page can be created. It also provides information about catalog versions that can be used as target catalog versions for clone operations.

The following code excerpt shows a GET request to retrieve catalog version information for a given catalog and version name:

Request
	GET {host}/cmswebservices/v1/sites/{siteId}/catalogs/{catalogId}/versions/{version}


Response 
	200 - OK
{
   "active" : true,
   "name" : {
      "de" : "Elektronikkatalog EU - Online",
      "ja" : "エレクトロニクス コンテンツ カタログ EU - Online",
      "en" : "Electronics Content Catalog EU - Online",
      "zh" : "电子产品内容目录 EU - Online"
   },
   "pageDisplayConditions" : [ {
      "options" : [ {
         "id" : "PRIMARY",
         "label" : "page.displaycondition.primary",
         "value" : "PRIMARY"
      } ],
      "typecode" : "ProductPage"
   }, {
      "options" : [ {
         "id" : "PRIMARY",
         "label" : "page.displaycondition.primary",
         "value" : "PRIMARY"
      } ],
      "typecode" : "CategoryPage"
   }, {
      "options" : [ {
         "id" : "PRIMARY",
         "label" : "page.displaycondition.primary",
         "value" : "PRIMARY"
      }, {
         "id" : "VARIATION",
         "label" : "page.displaycondition.variation",
         "value" : "VARIATION"
      } ],
      "typecode" : "ContentPage"
   } ],
   "uuid" : "electronics-euContentCatalog/Online",
   "version" : "Online"
}

The following code excerpt shows a GET request to retrieve catalog versions that can be used as target catalog versions for clone operations:

Request 
	GET {host}/cmswebservices/v1/sites/{siteId}/catalogs/{catalogId}/versions/{version}/targets?mode=cloneableTo


Response
	200 - OK
{
   "versions" : [ {
      "active" : false,
      "name" : {
         "de" : "Elektronikkatalog UK - Staged",
         "ja" : "エレクトロニクス コンテンツ カタログ UK - Staged",
         "en" : "Electronics Content Catalog UK - Staged",
         "zh" : "电子产品内容目录 UK - Staged"
      },
      "uuid" : "electronics-ukContentCatalog/Staged",
      "version" : "Staged"
   }, {
      "active" : false,
      "name" : {
         "de" : "Elektronikkatalog DE - Staged",
         "ja" : "エレクトロニクス コンテンツ カタログ DE - Staged",
         "en" : "Electronics Content Catalog DE - Staged",
         "zh" : "电子产品内容目录 DE - Staged"
      },
      "uuid" : "electronics-deContentCatalog/Staged",
      "version" : "Staged"
   }]
}

Facade

The Catalog Version API exposes the Catalog Version Facade to retrieve the catalog version information for a specific catalog name and catalog version, as well as all writable content catalog versions that can be used as target catalog versions for clone operations:

public interface CatalogVersionFacade { 
	CatalogVersionData getCatalogVersion(String catalogId, String versionId) throws CMSItemNotFoundException;
	List<CatalogVersionData> getWritableContentCatalogVersionTargets(String siteId, String catalogId, String versionId); 
}

Implementation

The Default Catalog Version Facades uses a Page Display Condition Service to determine which page types are supported and to provide page display information for each supported page type. The Page Display Condition Service uses a set of page type classes defined by the cmsSupportedPages bean (as shown in the Spring configuration in the cmsfacades-spring.xml file) to determine which page types are supported. Additionally, the Page Display Condition Service provides page display condition information for all supported page types by leveraging the services provided by the page variation resolver. (For more information about the page variation resolver, see Page Variation Resolver section in the Page API.)

The Default Catalog Version Facades uses the CMS Catalog Version Service to generate a list of all writable catalog versions that can be used as target catalog versions for clone operations. The getWritableContentCatalogVersionTargets function returns a result based on the catalog version provided. If the catalog version is active, the getWritableContentCatalogVersionTargets function returns a list of all child catalog versions (also known as sub-catalog versions) based on the catalog version information. If the catalog version is not active, the function returns a list of catalog versions based on the catalog information.

Beans

The Catalog Version API relies on the following DTO as shown in this code excerpt from the beans.xml file:

<bean class="de.hybris.platform.cmsfacades.data.CatalogVersionData">
	<property name="name" type="java.util.Map&lt;String, String&gt;" />
	<property name="active" type="Boolean" />
	<property name="version" type="String" />
	<property name="pageDisplayConditions" type="java.util.List&lt;de.hybris.platform.cmswebservices.data.DisplayConditionData>" />
	<property name="thumbnailUrl" type="String" />
	<property name="uuid" type="String" />
</bean>

<bean class="de.hybris.platform.cmsfacades.data.DisplayConditionData">
	<property name="typecode" type="String" />
	<property name="options" type="java.util.List&lt;de.hybris.platform.cmsfacades.data.OptionData>" />
</bean>

<enum class="de.hybris.platform.cmsfacades.page.DisplayCondition">
	<value>PRIMARY</value>
	<value>VARIATION</value>
</enum>
 
<bean class="de.hybris.platform.cmsfacades.data.OptionData">
	<property name="id" type="String" />
	<property name="label" type="String" />
</bean>

Spring Configuration

The Catalog Version API declares its Spring beans in the cmsfacades-spring.xml file.