Liferay 6 CP portlets for site admins + sources

As mentioned in previous post, I’ve been planning to make a little Control Panel portlet for Liferay 6 that would allow site admin to tell on which pages particular portlets are.

Today I’ve written two portlets for this. One allows you to see which groups and pages you have, and check portlets are on those pages.
Another – see what portlets you have, and check on what pages do you have instances of those portlets.

Little warning:
Portlets are pretty fresh, so there’s a chance something might fail or not work quite right.
Also the code is not very efficient, yet I haven’t got any OutOfMemory exceptions during the whole day of writing and checking, so in general they should be fine (-:

Without further due, here’s the download link. Sources are contained inside WAR file.

Portlets are written for Liferay 6.0.6 Community Edition (using corresponding plugins SDK), and should also work just fine on Enterprise Edition (though I haven’t checked yet, I’m pretty sure they will).

WAR is compiled for Java 6, some occasional @Override-s are present in code – remove them and recompile if you need it for Java 5. I might as well change it to Java 5 version a bit later…

Advertisements

Liferay (6) small hint – where are my portlets?

Note: We’re running Liferay 6 on MySQL DB.

One day I just wanted to see on which pages my portlets are used. So I had to make a little query for this:
select portletId, layout.plid, group_.friendlyURL, layout.friendlyURL from portletpreferences left join layout on layout.plid = portletpreferences.plid left join group_ on layout.groupId = group_.groupId where portletId like '%_WAR_[YOUR WAR NAME GOES HERE]%';

If you want to see all of the portlets, you can remove the “where” clause (but be prepared to be overwhelmed with the output).

The results look like this:

+-----------+--------+--------------------+--------------------+
| portletId |  plid  | group_.friendlyURL | layout.friendlyURL |
+-----------+--------+--------------------+--------------------+
| 103       | 704033 | /guest             | /my-community      |
| 145       | 704033 | /guest             | /my-community      |
| 29        | 704033 | /guest             | /my-community      |
| 49        | 704033 | /guest             | /my-community      |
| 86        | 704033 | /guest             | /my-community      |
| 87        | 704033 | /guest             | /my-community      |
| 88        | 704033 | /guest             | /my-community      |
...

Maybe I should make a full-fledged control-panel portlet for this – who knows, it might come handy.