-
Type:
Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: 7.1.X, 7.2.X
-
Fix Version/s: 7.0.X, 7.1.10 DXP FP23, 7.1.10.6 SP6, 7.1.X, 7.2.10 DXP FP11, 7.2.10.4 DXP SP4, 7.2.X
-
Component/s: Categories
-
Branch Version/s:7.2.x, 7.1.x, 7.0.x
-
Backported to Branch:Committed
-
Fix Priority:3
-
Git Pull Request:
Steps to Reproduce
- Start up Liferay connected to a MySQL database
- Sign in as admin
- Navigate to Control Panel > Configuration > Server Administration
- Go to the Script tab
- 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); } AssetCategoryLocalServiceUtil.addCategory(userId, groupId, "cat-" + StringUtil.randomString(5) + "-" + StringUtil.randomId(5), vocabulary.getVocabularyId(), serviceContext); overlappingCategory = AssetCategoryLocalServiceUtil.addCategory(userId, groupId, "cat-" + StringUtil.randomString(5) + "-" + StringUtil.randomId(5), vocabulary.getVocabularyId(), serviceContext); // Introduce overlapping left/right category ids to tree overlappingCategory.setLeftCategoryId(2); overlappingCategory.setRightCategoryId(3); AssetCategoryLocalServiceUtil.updateAssetCategory(overlappingCategory); // Add new category - Expected to detect broken tree and rebuild AssetCategoryLocalServiceUtil.addCategory(userId, groupId, "cat-" + StringUtil.randomString(5) + "-" + StringUtil.randomId(5), vocabulary.getVocabularyId(), serviceContext);
- Inspect the AssetCategory table in the database
Actual Behavior
Two rows show overlapping leftCategoryId and rightCategoryId.
Expected Behavior
Rows should have unique leftCategoryId and rightCategoryIds.
- is related to
-
LPS-125083 Duplicate left/right categoryId entries are added when creating asset categories
- Closed