Some Liferay portlets allow you to export or import portlet data. These include many of Liferay’s collaborative applications, such as the Blogs, Wiki, and Message Boards portlets. To export or import portlet data, click on the gear icon of your portlet and select Export/Import. Exporting portlet data produces a
.lar file that you can save and import into another portlet application of the same type. To import portlet data, you must select a
.lar file. Be careful not to confuse portlet-specific
.lar files with site-specific
.lar files. See the section on Creating and Managing Pages for a discussion of exporting and importing site page data.
Let’s explore the export process for portlets first.
First, you can select a Date Range of content that you’d like to export. Content that has been added to your portlet within your specified date range is included in the
.lar file. You also have options of choosing All dates or just the most recently added content, or Last.
Next, by checking the Content box, you can choose specific content you’d like to export. When you check the Content box, more options appear, allowing you to choose specific kinds of metadata to include. For example, if you have a wiki page with referenced content that you don’t wish to include, you can simply check the Wiki Pages checkbox and uncheck the Referenced Content checkbox. Another option in the Content section of the Export/Import window is the selection of content types. Two familiar content types in your portal is Comments and Ratings. If you wish to include these entities in your
.lar file, select Change and select them from the checklist.
Lastly, you can choose whether to include permissions for your exported content. The permissions assigned for the exported portlet window will be included if the Permissions option is checked. When you check this box, a sub-box called Permissions Assigned to Roles appears. If you wish, you can export your portlet’s permissions but not the permissions assigned to roles. After you’ve exported your portlet’s data, switch to the Current and Previous tab to view ongoing export processes and the history of past exports.
To import portlet data, you can select the LAR using your file explorer or by dragging and dropping the file between the dotted lines. After selecting the LAR file, you’re given a similar screen to what you’d be offered during export. Select the appropriate content and permissions, and click Continue.
The next screen offers options split into two sections – Update Data and Authorship of the Content. Here’s options and descriptions for each section:
- Mirror: All data and content inside the imported LAR will be created as new the first time while maintaining a reference to the source. Subsequent imports from the same source will update entries instead of creating new entries.
- Mirror with overwriting: Same behavior as the mirror strategy, but if a document or an image with the same name is found, it is overwritten.
- Copy as New: All data and content inside the imported LAR will be created as new entries within the current site every time the LAR is imported.
Authorship of the Content
- Use the Original Author: Keep authorship of imported content whenever possible. Use the current user as author if the original one is not found.
- Use the Current User as Author: Assign the current user as the author of all imported content.
Next, let’s discuss the concept of a portlet’s scope.