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

Duplicate left/right categoryId entries are added when creating asset categories

    Details

    • Branch Version/s:
      7.2.x
    • Backported to Branch:
      Committed
    • Fix Priority:
      3

      Description

      Steps to Reproduce

      1. Start up Liferay connected to a MySQL database
      2. Sign in as admin
      3. Navigate to Control Panel > Configuration > Server Administration
      4. Go to the Script tab
      5. Run the following Groovy script:
        import com.liferay.asset.kernel.service.AssetVocabularyLocalServiceUtil;
        import com.liferay.asset.kernel.service.AssetCategoryLocalServiceUtil;
        import com.liferay.portal.kernel.model.GroupConstants
        import com.liferay.portal.kernel.service.GroupLocalServiceUtil
        import com.liferay.portal.kernel.service.ServiceContext;
        import com.liferay.portal.kernel.util.PortalUtil
        import com.liferay.portal.kernel.util.StringUtil
        
        import java.util.concurrent.Executors;
        
        userId = PortalUtil.getUserId(actionRequest);
        companyId = PortalUtil.getCompanyId(actionRequest);
        groupId = GroupLocalServiceUtil.getGroup(companyId, GroupConstants.GUEST).getGroupId()
        
        serviceContext = new ServiceContext()
        
        vocabularyName = "Groovy_TestVocabulary"
        vocabulary = AssetVocabularyLocalServiceUtil.fetchGroupVocabulary(groupId, "Groovy_TestVocabulary")
        
        if (vocabulary == null) {
            vocabulary = AssetVocabularyLocalServiceUtil.addVocabulary(userId, groupId, vocabularyName, serviceContext);
        }
        
        threadPool = Executors.newFixedThreadPool(3)
        
        (1..10).each {
            threadPool.execute {
                AssetCategoryLocalServiceUtil.addCategory(userId, groupId, "cat-" + StringUtil.randomString(5) + "-" + StringUtil.randomId(5), vocabulary.getVocabularyId(), serviceContext);
            }
        }
        
        threadPool.shutdown()
      6. Inspect the AssetCategory table in the database
      7. Check the various rows in the AssetCategory table, and assert that some rows are showing duplicate leftCategoryId and rightCategoryId as the previous entry.

      Actual Behavior
      Rows are showing duplicate leftCategoryId and rightCategoryId in multiple rows.

      Expected Behavior
      Rows should have unique leftCategoryId and rightCategoryIds.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              yang.cao Yang Cao
              Reporter:
              eric.yan Eric Yan
              Participants of an Issue:
              Recent user:
              Eric Yan
              Engineering Assignee:
              Eric Yan
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                7 weeks, 6 days ago

                  Packages

                  Version Package
                  7.2.10 DXP FP10
                  7.2.X