Wednesday, September 24, 2014

[Liferay] Get preferences of another portlet | Get preferences of Portlet A in Portlet B

Hi,

Sometimes, we need to get preferences of a portlet into another portlet and take action appropriately.

Here is a snippet on how to do so. Suppose we have portlets A and B. We need preferences of A in B.
We can use dynamic query to get all the preferences of the portlet. From B we can use the code below. Replace myportletA with the correct porltetId.

We need to convert com.liferay.portal.model.PortletPreferences to javax.portlet.PortletPreferences to use getValue() or getValues() method.
Hope this helps someone.
Cheers!!!

Monday, September 15, 2014

[Liferay] Use Database to store Liferay documents | Use JCR Jackrabbit with Database | JCRStore

So, Simple steps to use JCR | Jackrabbit with Database..

1. Start a liferay instance with any database you need. For me its, MSSQL 2005 Express Edition.

2. That will create a repository.xml file in data/jackrabbit/ folder.

Below is a default repository.xml file.
 Change the content to include filesystem and persistence manager in this way. Use your correct username and password.
3. Now, Add the properties below in portal-ext.properties file. We need to let liferay know that we are going to store images and document in db via JCR.
com.liferay.portlet.documentlibrary.store.JCRStore is what we need to store documents via JCR.

That's it. Restart your liferay instance and you should see the files being stored in database.

Check my post below to see if database size increases when you add few files.
[SQL Server] Get size of database in SQL Server 2005 

All done.

Until next time. :)

[SQL Server] Get size of database in SQL Server 2005

Recently,

I needed to configure Liferay with SQL Server 2005 Express edition and I wanted to calculate the total database size of lportal database.

The query below gives me exact results.


Results
dbname    log_size_mb     row_size_mb      total_size_mb
lportal 1.50                   19.19               20.69

Hope this helps someone. :)

Cheers!!!

Friday, September 12, 2014

[Liferay] How to Undeploy Ext from Liferay | Undeploying ext from liferay

Recently, I had to undeploy ext plugin from Liferay

Here is what needed to be performed.

1. Delete the ext folder from webapps folder.

2. Stop the instance

3. Delete the ext service jar file from global lib. For tomcat it is in tomcat/lib
ext-*-ext-service.jar
4. Delete the ext jar files from webapps/ROOT/WEB-INF/lib
ext-*-ext-impl.jar
ext-*-ext-util-bridges.jar
ext-*-ext-util-java.jar
ext-*-ext-util-taglib.jar

5. Delete ext xml files from webapps/ROOT/WEB-INF
ext-*-ext.xml
liferay-portlet-ext.xml --will be present if any portlet was added/existing portlet was modified in a way that portlet.xml kind of changes were needed.
portlet-ext.xml --will be present if any portlet was added/existing portlet was modified in a way that portlet.xml kind of changes were needed.
tiles-defs-ext.xml

6. Delete work folder

7. Delete temp folder

8. Remove/comment any line that uses a class of ext plugin in portal-ext.properties. This can be any entry for ex. start up event, service actions etc.

So, That's it.

Cheers!!!