Message Boards
ExportImportConfiguration
ExportImportConfiguration
Regular Member Posts: 141 Join Date: 3/14/17 Recent PostsHi,
I am trying to import programatically a navigation menu from one site to another. I export from the control panel the file from origin site, and then I recover it from database with this:
configuration = ExportImportConfigurationLocalServiceUtil.getExportImportConfiguration(siteId);
file = ExportImportLocalServiceUtil.exportLayoutsAsFile(
configuration );
Now I am trying to import to other file with this
ExportImportLocalService.importLayouts(ExportImportConfiguration exportImportConfiguration, File file)
but I don't know how to create the new ExportImportConfiguration
object. Could anyone help me?
Thanks in advance
Regards,
RE: ExportImportConfiguration
Liferay Master Posts: 727 Join Date: 1/5/10 Recent PostsHi Daniel,
Have you tried the examples that you can find in the portal source?
Can that work to you?
Regards,
Zsigmond
RE: ExportImportConfiguration
Regular Member Posts: 141 Join Date: 3/14/17 Recent PostsHi,
First of all, thanks for the help. I was able to create exportIMport configuration with you link, but when I try to import, I received a
com.liferay.exportimport.kernel.exception.LARTypeException
The file which I am trying to import is a lar file generated from the
control panel, and not modified. Do you have any idea wy this is happening?
Thanks!
Regards
RE: ExportImportConfiguration
Liferay Master Posts: 727 Join Date: 1/5/10 Recent PostsHi Daniel,
That may come if the LAR type is not one of the predifined ones, "layout-prototype", "layout-set" or "layout-set-prototype". You could debug on the code level to see what is coming during processing the LAR.
Otherwise, knowing where on the Control Panel you generated the LAR file exactly or a step by step description of what your trying may help to find the problem.
Zsigmond
RE: ExportImportConfiguration
Regular Member Posts: 141 Join Date: 3/14/17 Recent PostsHi,
Thanks for the help. I was generating an export lar file of the navigation menu a site(Liferay 7.3). Menu - Site Builder - Navigation menus
Regards,
RE: ExportImportConfiguration
Liferay Master Posts: 727 Join Date: 1/5/10 Recent PostsHi,
Ok, I think the problem is that the LAR file you exported there is a portlet type LAR file that contains all the data from the Navigation Menus portlet. That won't work in your code as that is for layouts. You can use LAR file that has been exported from a site, site temple, or page template.
Regards,
Zsigmond