Navigation between applications within liferay

Hi,

We’re developing an application that consists of several Vaadin ‘Application’ objects, each being exposed as a liferay portlet. We are looking to accomplish basic navigation and I can’t seem to find a straight answer on this topic.

I’ve researched several options including Public Render Parameters, IPC and redirects but cannot find the ‘right way’ of accomplishing a basic link between one portlet ‘page’ to another.

Here is an example of what we’re looking to do:

  1. There is a global search portlet and the user searches using a criteria that matches against multiple results. Each result may be of a different ‘type’ (i.e. customer records, account records, product records etc)
  2. The user clicks on a search result and the system displays the appropriate record using the appropriate portlet. (For example, the user clicks on a product record and is taken to the corresponding product record in the product portlet in edit mode).

So this means that the user would be navigating from a page containing a Search portlet (Vaadin application) to another page containing different portlet(s).

How would we architect the application to allow us to navigate from one page to another from within a Vaadin portlet? From what I understand, this isn’t accomplished via IPC. The system would need to generate the appropriate URL (ideally with request parameters and redirect the user there). We could re-architect everything to be within a single vaadin application, but this isn’t ideal for us and would also marginalize many of liferay’s features (i.e. themes and layouts).

Any assistance would be appreciated. I believe many people are looking for a solution to this perceived problem.

Thanks!

Mark

Hello everone,

We have resolved this problem and in the hopes that this helps someone in the future, this is what we did:

In order to build a destination URL within liferay, we needed the ‘friendly name’ of the page layout that we wanted to navigate to. This is user defined and we simply associated each Vaadin application with a ‘well known friendly name’. For example:

public class … extends Application …{

public static final String ADJUSTMENT_GLOBAL_KEY_LOAD = “globalAdjustmentKeyLoad”;
public static final String ADJUSTMENT_GLOBAL_FRIENDLY_NAME = “/adjustments”;

}

Using this information along with the users liferay organization information, we can build a URL using this:

private String buildUrlForPortlet(String layoutFriendlyName) {
String groupFriendlyUrl = null;
try {
if (getUser() != null) {
List orgs = OrganizationLocalServiceUtil
.getUserOrganizations(getUser().getUserId());
if (orgs != null && !orgs.isEmpty()) {
Organization org = orgs.get(0);
List groups = GroupLocalServiceUtil
.getCompanyGroups(getUser().getCompanyId(), -1, -1);
if (groups != null && !groups.isEmpty()) {
for (Group group : groups) {
if (group.getName().equals(
Long.toString(org.getOrganizationId()))) {
groupFriendlyUrl = group.getFriendlyURL();
break;
}
}
}
}
}
} catch (Exception e1) {
e1.printStackTrace();
}

	return (groupFriendlyUrl != null && serverUrl != null) ? (serverUrl
			+ "/group" + groupFriendlyUrl + layoutFriendlyName) : null;
}

Then to navigate to the new url simply do:

getMainWindow().open(new ExternalResource(url));

This works for us. There’s additional intricacies involving communicating and passing parameters between portlet to portlet, but for now we are simply using session variables and in the future will attempt to use REST type requests.