liferayliferay-7liferay-ide

Liferay 7 Eclipse IDE override default categories behaviour


I need to create a portlet in order to change the default category behaviour/interface in Liferay 7.
My objective is to duplicate assetcategory table, expand and change its columns, and use this new table as a reference for categories within Liferay backend.

Therefore there are three key points my portlet has to update:

  1. The category organization UI to create/update category tables on DB. I’m able to create a new Liferay module project (panel-app template) which can present the UI backend interface from the side menu and interact with the DB.
  2. Override default category selection panel within web content properties panel (metadata > category select). I can create a new Liferay module project fragment to override the com.liferay.asset.categories.selector.web, however I’ve noticed I can select only one file path (eg. META-INF/resources/view.jsp)
  3. Override default asset publisher filter behaviour in order to allow my custom categories selection. I’ve not yet investigated this point.

I’m currently stuck at point 2 because after creating a new Liferay module project fragment, set the target Host OSGI Bundle to com.liferay.asset.categories.selector.web (which I believe is the correct one, please correct me if it isn't) and selecting the overridden files as META-INF/resources/view.jsp, I can’t proceed to redraw the category selection interface.

Here my attempts:

  1. Updating the code view.jsp (eg. adding some text string) I can correctly see them in the portlet.
  2. Removing/commenting all the code in view.jsp an error is shown: Asset category selector is temporarily unavailable
  3. Selecting all three files available to be overridden in the main portlet wizard (META-INF/resources/view.jsp, init.jsp and init-ext.jsp) and updating view.jsp (like the first example) nothing happen in the portlet

Some screenshot below:

Case 1 enter image description here enter image description here

Case 2 enter image description here enter image description here

Case 3 enter image description here enter image description here


Solution

  • I need to create a portlet in order to change the default category behaviour/interface in Liferay 7. My objective is to duplicate assetcategory table, expand and change its columns, and use this new table as a reference for categories within Liferay backend.

    Just this alone sounds like a humongous task, bigger than what would fit into a stackoverflow question.

    AssetCategories are used in every single content type, e.g. WebContent, Blog Articles, Message Board Posts, Wiki Pages, Knowledgebase Articles etc.. Replacing such a vital component by your own implementation is something that will safely ruin your next upgrade experience, because there you'd have to do this again, bringing your code to whatever changes will be made in the next version. And this "upgrade" includes Security Patches.

    Overall, your premise sounds to me like a x-y problem and I'd rather recommend that you step back from your intended solution and look for other options to meet your business requirements. There surely are some.

    My recommendation: Rather add something to the platform than ripping out a very central and generic component, reimplementing it in a business-specific manner. If you need a different filtering than Asset Publisher provides: Build your own Asset Publisher and implement the business specific rules there. Or think again about organizing your content in a different way than you currently organize it.

    Unless you're already a Liferay Core Developer and are asking for a hint on how to change the implementation for the next version. But your question history here doesn't look like it.