掲示板

How to get all Portlet categories information?

thumbnail
10年前 に Gurumurthy Godlaveeti によって更新されました。

How to get all Portlet categories information?

Regular Member 投稿: 208 参加年月日: 11/08/12 最新の投稿
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
10年前 に Sagar A Vyas によって更新されました。

RE: How to get all Portlet categories information?

Liferay Master 投稿: 679 参加年月日: 09/04/17 最新の投稿
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
10年前 に Gurumurthy Godlaveeti によって更新されました。

RE: How to get all Portlet categories information?

Regular Member 投稿: 208 参加年月日: 11/08/12 最新の投稿
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
10年前 に Sagar A Vyas によって更新されました。

RE: How to get all Portlet categories information?

Liferay Master 投稿: 679 参加年月日: 09/04/17 最新の投稿
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
10年前 に Gurumurthy Godlaveeti によって更新されました。

RE: How to get all Portlet categories information?

Regular Member 投稿: 208 参加年月日: 11/08/12 最新の投稿
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
10年前 に Sagar A Vyas によって更新されました。

RE: How to get all Portlet categories information?

Liferay Master 投稿: 679 参加年月日: 09/04/17 最新の投稿
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
10年前 に Gurumurthy Godlaveeti によって更新されました。

RE: How to get all Portlet categories information?

Regular Member 投稿: 208 参加年月日: 11/08/12 最新の投稿
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
10年前 に Sagar A Vyas によって更新されました。

RE: How to get all Portlet categories information?

Liferay Master 投稿: 679 参加年月日: 09/04/17 最新の投稿
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