2013-12-31

Handling exceptions with Guava

Some time ago, while reading Java Concurrency In Practice, I encountered the following utility method:
public static RuntimeException launderThrowable(Throwable t) {
  if (t instanceof RuntimeException)
    return (RuntimeException) t;
  else if (t instanceof Error)
    throw (Error) t;
  else
    throw new IllegalStateException("Not unchecked", t);
}
At first it looks quite strange, so let's see how it can be used.

2013-12-10

Yet another guide to Spring Data JPA

I've been learning Spring Data JPA recently and I am really impressed by its features and ease of use. It allows to create JPA based data access layer very quickly. In a basic usage scenario you only need to create interfaces which extend specific Spring interfaces and which have methods named according to appropriate convention - and that's it. Spring Data JPA will automatically provide implementations of those interfaces.

I created a simple project, which demonstrates basic features of Spring Data JPA. The source code can be downloaded here and the most interesting parts are described below.

2013-11-25

How to search standard Liferay entites using custom query

In my recent Liferay project I wanted to load list of all top-level organizations (organizations, which are not members of a community or another organization). There is no built-in method in any *LocalServiceUtil which returns what I needed. I also couldn't use DynamicQuery, because the query I wanted to run included groups_orgs table which is not mapped to any entity.

2013-11-13

Organization Chart in Liferay 6.0.6

Liferay out of the box provides very flexible and powerful features to organize a portal. It allows creation of Communities, Organizations, Roles, User Groups, Teams and of course Users. All of these entites and relationships between them are described thoroughly in documentation (for example: http://www.liferay.com/documentation/liferay-portal/6.0/administration/-/ai/portal-architectu-4). These built-in features and excellent documentation allow fulfilment of many business requirements without any programming.

One thing, which in my opinion is missing, is possibility to see portal's organization structure as a whole. It is possible to display "list of Xes", "details of X" or "list of Xes associated with Y". However, it is not possible to see multi-level hierarchies or simply all entites at once. This makes it difficult to get the overall picture or to verify if everything has been configured correctly.

Because of that I created a simple portlet plugin, which adds a new portlet - Organization Chart. This portlet displays hierarchy of Communities, Organizations, User Groups, Teams and Users as a tree. This is how it looks in action:
 

The plugin can be downloaded from https://github.com/mateuszwenus/lf-org-chart. It is compatible with Liferay 6.0.6. It is licensed under MIT license, so you can freely use it in both personal and commercial projects.

I hope you will find this plugin useful. If you have any comments, suggestions or problems with it, let me know.

Hello world

Welcome to my blog! My name is Mateusz Wenus and I am software developer from Poland. Currently I work as subcontractor for Pretius, IT company located in Warsaw.
 
Most of the time I design and implement web applications in Java, but I'm always eager to expand my knowledge (there's still so much to learn, even in the Java world). I have started this blog to have a place to write about my findings and to have a better motivation to constantly learn new things. If someone finds my posts useful, it will be additional bonus.

I hope you will enjoy reading my blog.