Import Data Strategies

This article describes the methods that can be used during an import of a LAR file to update the data that is already present in the target Site. There are three data strategies that change the behavior for how the import process acts if the same entry is found in the Site. They are:

  1. Mirror
  2. Mirror with Overwriting
  3. Copy as New

Resolution

1. 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.

This means that the content will initially be imported as new within the target environment with new ids and updated references, but subsequent imports will retain the same ids. Please note the following when using this strategy:

  • If there is an entry with the same unique ID (uuid) on the target Site, the new one replaces it.
  • If there is a Documents and Media entry with the same name (but different uuid) on the target Site, it will resolve the conflict by renaming the new document's name and update its references.

Example:

  1. Create a Blank Site called Source Site
  2. In Source Site, add a Basic Document called Document 1, use an image to upload.
  3. In Source Site, add a Basic Web Content called Article 1, but don't publish it yet.
  4. In the editor, click on Image -> Browse Server -> Source Site -> Document 1 -> OK
  5. Publish the Web Content
  6. Export the whole Source Site into a LAR file
  7. Create a Blank Site called Target Site Mirror
  8. In Target Site Mirror, add a Basic Document with the same name as before: Document 1, use a different image to upload.
  9. Import your Source Site's LAR file and select the Mirror option in the Update Data section.
  10. Check Documents and Media in Target Site Mirror. You will see two images there and the imported file has been renamed to Document 1.
  11. Check Article 1 Web Content, it will still show the correct image, so the reference was also updated.
  12. If you import the same LAR file again with the same strategy, there won't be any changes.

 

2. 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.

This setting is very similar to the Mirror strategy, but it handles document conflicts a bit differently. Please note the following when using this strategy:

  • If there is an entry with the same unique ID (uuid) on the target Site, the new one replaces it.
  • If there is a Documents and Media entry with the same name (but different uuid) on the target Site, it will overwrite the old file with the new one.

Example:

  1. Create a Blank Site called Source Site
  2. In Source Site, add a Basic Document called Document 1, use an image to upload.
  3. In Source Site, add a Basic Web Content called Article 1, but don't publish it yet.
  4. In the editor, click on Image -> Browse Server -> Source Site -> Document 1 -> OK
  5. Publish the Web Content
  6. Export the whole Source Site into a LAR file.
  7. Create a Blank Site called Target Site Mirror with Overwriting
  8. In Target Site Mirror with overwriting, add a Basic Document with the same name as before: Document 1, use a different image to upload.
  9. Import your Source Site's LAR file and select the Mirror with Overwriting option in the Update Data section.
  10. Check Documents and Media in Target Site Mirror with overwriting, you will see that there is only one image there and it is the imported file, so the second image that has been created was overwritten by the import process.
  11. Check Article 1 Web Content, it will show the imported image correctly with the original reference.
  12. If you import the same LAR file again with the same strategy, there won't be any changes.

 

3. 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.

This strategy creates duplicates- every entry will be imported as a new one, with new unique IDs and updated references in case there is a conflict. Please note the following when using this strategy:

  • If there is an entry with the same unique ID (uuid) on the target Site, the process will generate a new id for the new entry, update its references, and import it this way.

Example:

  1. Create a Blank Site called Source Site
  2. In Source Site, add a Basic Document called Document 1, use an image to upload.
  3. In Source Site, add a Basic Web Content called Article 1, but don't publish it yet.
  4. In the editor, click on Image -> Browse Server -> Source Site -> Document 1 -> OK
  5. Publish the Web Content
  6. Export the whole Source Site into a LAR file.
  7. Create a Blank Site called Target Site Copy as New
  8. In Target Site Copy as New, add a Basic Document with the same name as before: Document 1, use a different image to upload.
  9. Import your Source Site's LAR file and select the Copy as New option in the Update Data section.
  10. Check Documents and Media in Target Site Copy as New, you will see that there are two images there and the imported file has been renamed automatically.
  11. Check Article 1 Web Content, it will still show the correct image, so the reference was also updated.
  12. Import the same LAR file again with the Copy as New strategy.
  13. Check your Web Content Articles and Documents and Media files, you will see that the import process created a duplicate of these entries with new unique IDs and updated references.

Additional Information

See our Liferay Official User Guide (version 6.2 EE) for more information about the whole Export/Import processes.

There is one known issue when using the "Copy as New" data strategy in Liferay 6.2, where the process fails to import embedded images inside Web Content Articles:LPS-50144. In order to avoid this problem, please make sure to use fix pack portal-56-6210 or higher.

这篇文章有帮助吗?
1 人中有 1 人觉得有帮助