Friday, April 29, 2011

Suppressing Default Success Message

Each time user request is processed successfully Liferay Portal display the following message-

“Your request has been processed successfully”

To remove this message Add an entry to portlet.xml file:
<add-process-action-success-action >
false
</add-process-action-success-action >

Wednesday, April 27, 2011

Removing Portlet Permission Error Message

If any user don’t have permission to access a portlet, Liferay Portal display the following permission error message

"you don't have required permission to access this portlet"

Instead of displaying the error message we can make that portlet invisible for that particular user by setting the following property in portal-ext.properties file –

layout.show.portlet.access.denied=false

Saturday, April 9, 2011

Display Journal Articles based on Tags

1. Have a long[] array containing Tag Ids for which you want to serach Journal Articles

long[] tagIds = {tagId1,tagId2,…..};

2. Create an AssetEntryQuery and set the tagIds as the criteria

AssetEntryQuery assetEntryQuery = new AssetEntryQuery();
assetEntryQuery.setAllTagIds(tagIds);

3. Call the getEntries(AssetEntryQuery ob) method on AssetEntryLocalServiceUtil class to get the list of assetEntries

ListentryList = new ArrayList();
try {
entryList = AssetEntryLocalServiceUtil.getEntries(assetEntryQuery);
} catch (SystemException e) {
e.printStackTrace();
}

4. Now iterate the list and pick classPK attribute for each entry and from that query JournalArticle Table for corresponding articleId.