Foren

How to get all Portlet categories information?

thumbnail
Gurumurthy Godlaveeti, geändert vor 10 Jahren.

How to get all Portlet categories information?

Regular Member Beiträge: 208 Beitrittsdatum: 12.08.11 Neueste Beiträge
Hi Liferay Guys,

I wish to know all portlet categories information in my plugin portlet. Any idea, how to get by using Liferay code?

I have seen the existed code & WebappPool class is helpful to get the portlet categories but this java class is not available to plugins portlet. So any chance to get portlet categories in plugins ?
thumbnail
Sagar A Vyas, geändert vor 10 Jahren.

RE: How to get all Portlet categories information?

Liferay Master Beiträge: 679 Beitrittsdatum: 17.04.09 Neueste Beiträge
any chance to get portlet categories in plugins ?


Two quick questions.

1. which version liferay you are using
2. and you want to retrieve categories which is assign to your asset ? correct ? please elaborate on same.

Thanks,
Sagar Vyas
thumbnail
Gurumurthy Godlaveeti, geändert vor 10 Jahren.

RE: How to get all Portlet categories information?

Regular Member Beiträge: 208 Beitrittsdatum: 12.08.11 Neueste Beiträge
Sagar A Vyas:
any chance to get portlet categories in plugins ?


Two quick questions.

1. which version liferay you are using
2. and you want to retrieve categories which is assign to your asset ? correct ? please elaborate on same.

Thanks,
Sagar Vyas


Hi Sagar,

I am working on Liferay 6.0.6

For example, we configure portlet details in portlet.xml, liferay-portlet.xml & liferay-display.xml files. This liferay-display.xml file is having the information about portlet categories. Once we deploy the portlet then we drag the application into certain page through add -> portlet.

Now i need to get these portlet categories based on specific portlet id.
thumbnail
Sagar A Vyas, geändert vor 10 Jahren.

RE: How to get all Portlet categories information?

Liferay Master Beiträge: 679 Beitrittsdatum: 17.04.09 Neueste Beiträge
Hi,

As per my understanding....

You can user following code to retrieve categories for your asset.


			List<assetentry> assetIdeasEntry = new ArrayList<assetentry>();
			long classNameId = PortalUtil.getClassNameId(IdeasEntry.class.getName());
			
			AssetEntryQuery aeq = new AssetEntryQuery();
			aeq.setAllCategoryIds(new long[] {	cateId	});
			aeq.setClassNameIds(new long[] {classNameId	});

			assetIdeasEntry = AssetEntryLocalServiceUtil.getEntries(aeq);
</assetentry></assetentry>


here classNameId - its your portlet classID plus you need to pass Categories id. it will returns your list of your asset having same cateId.

Thanks,
Sagar Vyas
thumbnail
Gurumurthy Godlaveeti, geändert vor 10 Jahren.

RE: How to get all Portlet categories information?

Regular Member Beiträge: 208 Beitrittsdatum: 12.08.11 Neueste Beiträge
Sagar A Vyas:
Hi,

As per my understanding....

You can user following code to retrieve categories for your asset.


			List<assetentry> assetIdeasEntry = new ArrayList<assetentry>();
			long classNameId = PortalUtil.getClassNameId(IdeasEntry.class.getName());
			
			AssetEntryQuery aeq = new AssetEntryQuery();
			aeq.setAllCategoryIds(new long[] {	cateId	});
			aeq.setClassNameIds(new long[] {classNameId	});

			assetIdeasEntry = AssetEntryLocalServiceUtil.getEntries(aeq);
</assetentry></assetentry>


here classNameId - its your portlet classID plus you need to pass Categories id. it will returns your list of your asset having same cateId.

Thanks,
Sagar Vyas



Hi Sagar,

I have looked in to asset entry tables, there is no information about portlet categories, it's having the liferay feature ( tags & categories) info which is helpful to search the articles, documents, pages, users, images...etc.

Can you provide exactly what should i need to do to get the portlet categories name (which we configure in liferay-display.xml file) when i know portlet id.

Thanks in advance
thumbnail
Sagar A Vyas, geändert vor 10 Jahren.

RE: How to get all Portlet categories information?

Liferay Master Beiträge: 679 Beitrittsdatum: 17.04.09 Neueste Beiträge
This is your custom portlet right ?

Can you help me to understand how you inject categories to your portlet id ? in code side ?

Thanks,
Sagar Vyas
thumbnail
Gurumurthy Godlaveeti, geändert vor 10 Jahren.

RE: How to get all Portlet categories information?

Regular Member Beiträge: 208 Beitrittsdatum: 12.08.11 Neueste Beiträge
Hi Sagar,

I have no idea on injecting the portlet category for portlet id in code side. That's the main thing i would like to know then automatically my requirement fulfil.

I got the portlets list which i provided one user. I have segregate those portlets list into groups just based on portlet category name.
thumbnail
Sagar A Vyas, geändert vor 10 Jahren.

RE: How to get all Portlet categories information?

Liferay Master Beiträge: 679 Beitrittsdatum: 17.04.09 Neueste Beiträge
Gurumurthy Godlaveeti:
Hi Sagar,

I have no idea on injecting the portlet category for portlet id in code side. That's the main thing i would like to know then automatically my requirement fulfil.

I got the portlets list which i provided one user. I have segregate those portlets list into groups just based on portlet category name.



Probably you needs following code to inject categories [oob] to your custom portlet.


	<liferay-ui:panel defaultstate="closed" extended="<%=false%>" id="<portlet:namespace/>testl" persiststate="<%=true%>" title="categorization">
			<aui:fieldset>
				<aui:input classPK="${entryId}" name="categories" type="assetCategories" />
				<aui:input classPK="${entryId}" name="tags" type="assetTags" />
			</aui:fieldset>
		</liferay-ui:panel>


Entry Id : This is your primary key of custom portlet.

Thanks,
Sagar Vyas
Hi I am Liferay