Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-77740

PortletDataContext's ddmTemplateKey and ddmStructureKey maps are generated incorrectly if there are duplicate structureKeys and templateKeys between the LAR and its destination

    Details

      Description

      Description
      In LPS-62681, we modified the logic when importing Structures and Templates to account for the possibility of collisions between structureKeys and templateKeys between the LAR and its destination. We decided to set the structureKey or the templateKey of the object being imported to null to force Liferay to autogenerate a new structureKey or templateKey.

      However, this is problematic, because later on, we map the original structureKey/templateKey to the newly generated structureKey/templateKey. So if we hit a collision, we essentially end up mapping a blank String to the new structureKey or templateKey. The original structureKey or templateKey has been lost. This causes Web Content Articles associated with those Structure and Templates to lose information about that during the import. Additionally, in 6.2, it can cause Basic Web Content Articles to end up with a random Structure and Template associated to them after import (since they have a null structureKey and templateKey). It can also cause the import to fail outright in 6.2, since the validation might notice that the random structure and random template that were assigned to the article are not linked to each other.

      Steps to Reproduce
      1. Start up Liferay and log in as the admin user.
      2. Navigate to Control Panel > Configuration > System Settings > Forms and Workflow > Dynamic Data Mapping Web.
      3. Uncheck the "Autogenerate Structure Key" and "Autogenerate Template Key" boxes and click Save.
      4. Navigate to Liferay > Web Content.
      5. Create a new Structure and give it a specific Structure Key.
      6. Create a new Template associated with this Structure and give it a specific Template Key.
      7. Create a new Web Content Article using this Structure and Template.
      8. Export a LAR of the Web Content and download it.
      9. Navigate to Control Panel > Sites > Sites.
      10. Create a new Site.
      11. Navigate to [New Site] > Web Content.
      12. Create a new Structure that has a DIFFERENT data definition but the SAME Structure Key as the Structure you created in step 5.
      13. Create a new Template associated with this Structure and give it the same Template Key as the Template you created in step 6.
      14. Import the LAR from step 8.
      15. Click on the Web Content Article that you imported.

      Expected Result: The Web Content Article is using the Structure from step 5, and it's data appears to be in tact.
      Actual Result: The Web Content Article is using the Structure from step 12 and appears to have lost its data.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  1 year, 37 weeks, 6 days ago

                  Packages

                  Version Package
                  7.0.0 DXP FP41
                  7.0.6 CE GA7
                  7.0.0 DXP SP8
                  7.0.X
                  7.1.0 M1
                  7.1.X
                  Master