Forums

Home » Liferay Portal » English » 2. Using Liferay » General

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Chew Boon Aik
How to programmatically import LAR file into Liferay?
March 10, 2010 6:02 PM
Answer

Chew Boon Aik

Rank: New Member

Posts: 13

Join Date: March 4, 2010

Recent Posts

Is there a way to use API to import LAR file into Liferay, probably to different community?
Arun Kumar S
RE: How to programmatically import LAR file into Liferay?
March 10, 2010 11:22 PM
Answer

Arun Kumar S

Rank: Regular Member

Posts: 177

Join Date: June 23, 2008

Recent Posts

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
Chew Boon Aik
RE: How to programmatically import LAR file into Liferay?
March 11, 2010 1:12 AM
Answer

Chew Boon Aik

Rank: New Member

Posts: 13

Join Date: March 4, 2010

Recent Posts

Thanks, it works!
petar banicevic
RE: How to programmatically import LAR file into Liferay?
July 18, 2010 3:28 AM
Answer

petar banicevic

Rank: Junior Member

Posts: 69

Join Date: May 27, 2008

Recent Posts

Thanks for sharing !
Apoorva Prakash
RE: How to programmatically import LAR file into Liferay?
October 4, 2010 5:15 AM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 585

Join Date: June 15, 2010

Recent Posts

Hello Arun,
Can you please explain this process in little detail... What changes are required to make in portal.properties file...
Means, files to be changed and flow of it...

Thanks and Regards...