Wednesday, November 24, 2010

Programmatically import LAR file into Liferay.

public static void addDefaultLayoutsByLAR(
long userId, long groupId, boolean privateLayout, File larFile)
throws PortalException, SystemException {

Map parameterMap = new HashMap();

parameterMap.put(
PortletDataHandlerKeys.PERMISSIONS,
new String[] {Boolean.TRUE.toString()});
parameterMap.put(
PortletDataHandlerKeys.PORTLET_DATA,
new String[] {Boolean.TRUE.toString()});
parameterMap.put(
PortletDataHandlerKeys.PORTLET_DATA_CONTROL_DEFAULT,
new String[] {Boolean.TRUE.toString()});
parameterMap.put(
PortletDataHandlerKeys.PORTLET_SETUP,
new String[] {Boolean.TRUE.toString()});
parameterMap.put(
PortletDataHandlerKeys.USER_PERMISSIONS,
new String[] {Boolean.FALSE.toString()});

LayoutLocalServiceUtil.importLayouts(
userId, groupId, privateLayout, parameterMap, larFile);
}

2 comments:

Anonymous said...

If we want to import specific page in community...then What should we do ?
Plz tell me what are the parameters , I need to set in Map
?

Anonymous said...

How to replace existing page with importing LAR file into liferay?
Please provide your inputs.
Thanks in Advance

Post a Comment

Share & Enjoy

Twitter Delicious Facebook Digg Stumbleupon Favorites More