Foren

How can we get asset entry from asset category ?

thumbnail
Sagar A Vyas, geändert vor 12 Jahren.

How can we get asset entry from asset category ?

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

I have list of asset entries , each asset has associated with one or more categories.

I have asset category ID let say 124 and I want to get all assets which are associated with category ID 124 .

Is there any util calls available that return list of assets from category ID ?

Thanks,
Sagar Vyas
thumbnail
Pankaj Kathiriya, geändert vor 12 Jahren.

RE: How can we get asset entry from asset category ?

Liferay Master Beiträge: 722 Beitrittsdatum: 05.08.10 Neueste Beiträge
Hi Sagar,

There is OOTB portlet called Categories Navigation which lists categories as a link.

When you click on any category link ,it will fatch only respective assets associated with that category in your Asset Publisher of the same page.

Here in /html/portlet/asset_publisher/view_dynamic_list.jsp, you would find code to get assets per category.


Hope this helps.
Please let me know if you require more details,
Thanks,
Pankaj
thumbnail
Sagar A Vyas, geändert vor 12 Jahren.

RE: How can we get asset entry from asset category ?

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

Thanks for Quick reply.

I will look into this and let you know.

Thanks,
Sagar Vyas
thumbnail
Sagar A Vyas, geändert vor 12 Jahren.

RE: How can we get asset entry from asset category ?

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

There is OOTB portlet called Categories Navigation which lists categories as a link.

When you click on any category link ,it will fatch only respective assets associated with that category in your Asset Publisher of the same page.

Here in /html/portlet/asset_publisher/view_dynamic_list.jsp, you would find code to get assets per category.


Hope this helps.
Please let me know if you require more details,
Thanks,
Pankaj


Thanks Nagendra for reply, I have achieved this.

Hi Pankaj,

You are champ man emoticon

I got reference from forum and I resolved it.

List results = AssetEntryServiceUtil.getEntries(assetEntryQuery);


Thanks,
Sagar Vyas
thumbnail
Nagendra Kumar Busam, geändert vor 12 Jahren.

RE: How can we get asset entry from asset category ?

Liferay Master Beiträge: 678 Beitrittsdatum: 07.07.09 Neueste Beiträge
Actual the method to get desired results according to your requirement is already there BUT at persistnence layer (portal-impl.jar).

Check getAssetEntries method in AssetCategoryPersistenceImpl.java

I don't know whether there is some way to access persistence layer in hook or not. If any body have any ideas please feel free to share

Using ext plugin, add an extra method as below to custom Class (here i am assuming custom class name as CustomAssetCategoryLocalServiceImpl) which extends AssetCategoryLocalServiceImpl

	public List<com.liferay.portlet.asset.model.assetentry> getAssetEntries(
		long pk) throws SystemException {
		return assetCategoryPersistence.getAssetEntries(pk);
	}</com.liferay.portlet.asset.model.assetentry>


In META-INF/ext-spring.xml (in you ext plugin) create a reference for new custom class

	<bean id="com.liferay.portlet.asset.service.AssetCategoryLocalService" class="com.liferay.portlet.asset.service.impl.CustomAssetCategoryLocalServiceImpl" />


Hope it helps

Thanks,
- Nagendra Kumar