Chew Boon Aik:
Is there a way to use API to import LAR file into Liferay, probably to different community?
Use the below code
1
2 public static void addDefaultLayoutsByLAR(
3 long userId, long groupId, boolean privateLayout, File larFile)
4 throws PortalException, SystemException {
5
6 Map<String, String[]> parameterMap = new HashMap<String, String[]>();
7
8 parameterMap.put(
9 PortletDataHandlerKeys.PERMISSIONS,
10 new String[] {Boolean.TRUE.toString()});
11 parameterMap.put(
12 PortletDataHandlerKeys.PORTLET_DATA,
13 new String[] {Boolean.TRUE.toString()});
14 parameterMap.put(
15 PortletDataHandlerKeys.PORTLET_DATA_CONTROL_DEFAULT,
16 new String[] {Boolean.TRUE.toString()});
17 parameterMap.put(
18 PortletDataHandlerKeys.PORTLET_SETUP,
19 new String[] {Boolean.TRUE.toString()});
20 parameterMap.put(
21 PortletDataHandlerKeys.USER_PERMISSIONS,
22 new String[] {Boolean.FALSE.toString()});
23
24 LayoutLocalServiceUtil.importLayouts(
25 userId, groupId, privateLayout, parameterMap, larFile);
26 }
HTH,
Arun
Please sign in to flag this as inappropriate.