Forums

Home » Liferay Portal » English » Liferay Legacy

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Micah Wedemeyer
Programmatically import a LAR file
October 10, 2006 7:21 PM
Answer

Micah Wedemeyer

Rank: Junior Member

Posts: 62

Join Date: August 3, 2006

Recent Posts

Any clues on how to programmatically import a LAR file? I'm using the service layer to create new communities and I want to auto-load a pre-generated LAR file when a new community is created.

Any help? Places to look?

Thanks,
Micah
Micah Wedemeyer
RE: Programmatically import a LAR file
October 10, 2006 7:55 PM
Answer

Micah Wedemeyer

Rank: Junior Member

Posts: 62

Join Date: August 3, 2006

Recent Posts

I have found the com.liferay.portal.service.impl.LayoutLocalServiceImpl.java file that has the importLayouts method in it. What is the best way to access this? Currently, I'm only interfacing with Liferay's core through the service layer (ie. portal-client.jar). I'm guessing that in order to use the importLayouts method I'll have to get more integrated. This is fine, I'm just wondering what's the best way to go about it. My main concern is for upgradability to newer versions of Liferay as they come out.

Any help would be greatly appreciated!
Micah Wedemeyer
RE: Programmatically import a LAR file
October 11, 2006 1:30 PM
Answer

Micah Wedemeyer

Rank: Junior Member

Posts: 62

Join Date: August 3, 2006

Recent Posts

Anybody?
ferry hut
RE: Programmatically import a LAR file
November 12, 2007 4:00 AM
Answer

ferry hut

Rank: Junior Member

Posts: 30

Join Date: November 2, 2006

Recent Posts

Check out how liferay does in communities portlet which contains export and import struts Action source code.

Version changes depends if the under line code service implementation changes.

In my scenario i had to automatically create a group and import lar file from pre configured community page. let me know if your need any code, what I did was I combined the exportLayout and import Layout to achieve this.
Kostis Mastorakis
RE: Programmatically import a LAR file
July 28, 2008 7:05 AM
Answer

Kostis Mastorakis

Rank: New Member

Posts: 10

Join Date: January 31, 2007

Recent Posts

In order to import tha lar file to a community you need two lines of code. One to load the File Object of the lar file and the second to import it:

1
2
3File larFile=new File("/pathtoLarFile/LarFile.lar");
4                   
5LayoutLocalServiceUtil.importLayouts(username,ownerid, larFile);
6                   


username is a String holding the id of the user that is assigned to the community

ownerid is a String containig the type of the pages (public or private and the group id of the community). It is of the format "PUB."+group.getGroupId() or "PRI."+group.getGroupId() which will look something like "PUB.1078" / "PRI.1078"

for some strange reason the private pages are not copied, but only the public pages.
satya jangala
RE: Programmatically import a LAR file
September 12, 2011 11:49 PM
Answer

satya jangala

Rank: New Member

Posts: 8

Join Date: November 8, 2010

Recent Posts

Kostis Mastorakis:
In order to import tha lar file to a community you need two lines of code. One to load the File Object of the lar file and the second to import it:

1
2
3File larFile=new File("/pathtoLarFile/LarFile.lar");
4                   
5LayoutLocalServiceUtil.importLayouts(username,ownerid, larFile);
6                   


username is a String holding the id of the user that is assigned to the community

ownerid is a String containig the type of the pages (public or private and the group id of the community). It is of the format "PUB."+group.getGroupId() or "PRI."+group.getGroupId() which will look something like "PUB.1078" / "PRI.1078"

for some strange reason the private pages are not copied, but only the public pages.



hi,

how to create the lar file in liferay 5.x.

now am developing my ext in liferay 5.x ee and could i change my application 5.x to 6, is there any problems i faced
divine bach
RE: Programmatically import a LAR file
September 23, 2011 3:23 AM
Answer

divine bach

Rank: New Member

Posts: 2

Join Date: September 23, 2011

Recent Posts

I have no idea. Anybody there? I also want to know.
Namrata Hangal
RE: Programmatically import a LAR file
September 4, 2012 12:17 AM
Answer

Namrata Hangal

Rank: Regular Member

Posts: 161

Join Date: July 26, 2010

Recent Posts

Hi Ferry,

I'm interested in knowing how you combined the export and import pieces of code.
Could you please share that?