Wednesday, August 10, 2016

Enabling Taxonomies for Content Type RXTs


The Problem
Those who have tried out the G-REG 5.3.0 will notice that content type RXTs strangely do not have a way for users to categorize assets using Taxonomies.The list of affected RXTs include:

  • Swagger
  • WSDL
  • WADL
  • Policy
  • Schema
Although, there is currently no way to enable this functionality at creation time (short of writing a custom create page), it is possible to access this feature using the edit page. However, we run into another hurdle as the edit page is not present for content type RXTs.





The Solution
It is thankfully not that hard to enable the update page.The Enterprise Store (ES) Extension framework auto generates create, update and delete pages for all the asset types deployed to the G-REG server.Hence, we just need to enable the update button and the ES will take care of rendering the page for us.This auto generated page


The bit of code which hides the edit page is shown below (swagger/asset.js) [1] :

The above snippet of code is present in each of the content type asset extensions:

  • <CARBON_HOME>/repository/deployment/server/jaggeryapps/publisher/extensions/assets/swagger/asset.js
  • <CARBON_HOME>/repository/deployment/server/jaggeryapps/publisher/extensions/assets/wsdl/asset.js
  • <CARBON_HOME>/repository/deployment/server/jaggeryapps/publisher/extensions/assets/wadl/asset.js
  • <CARBON_HOME>/repository/deployment/server/jaggeryapps/publisher/extensions/assets/policy/asset.js
  • <CARBON_HOME>/repository/deployment/server/jaggeryapps/publisher/extensions/assets/schema/asset.js
In order to enable to the update button comment out the following bit of code:



You should now be able presented with the update button and the update page:



The update page with the Taxonomy:




References
[1] https://github.com/wso2/product-greg/blob/v5.3.0-rc2/modules/es-extensions/publisher/asset/swagger/asset.js#L352

No comments:

Post a Comment