Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 6.1.1 CE GA2, 6.1.20 EE GA2
-
Fix Version/s: 6.0.X EE, 6.1.X EE, 6.2.0 CE M2
-
Component/s: Infrastructure, Infrastructure > DBs, WCM > Categories
-
Labels:
-
Environment:LIFERAY VERSION: 6.0 SP 1
APPLICATION SERVER: Tomcat 6.x
JAVA VIRTUAL MACHINE: Java 6
DATABASE: MySQL 5.1
-
Branch Version/s:6.1.x, 6.0.x
-
Backported to Branch:Committed
-
Similar Issues:
Description
ISSUE
In an environment where multiple vocabularies contain categories, deleting a vocabulary will cause the next vocabulary's categories to have duplicate leftcategoryid and rightcategoryids from preceding entries. Essentially, the categoryids are not rebuilt correctly upon deletion of a vocabulary.
STEPS TO REPRODUCE
1. Create vocabulary Vocab1
2. Add categories Cat1, Cat2, Cat3, Cat4, and Cat5 to Vocab1
3. Create vocabulary Vocab2
4. Add categories CatA, CatB, CatC, CatD, and CatE to Vocab2
5. Perform query SELECT * FROM assetcategory; (SEE IMAGE 1)
6. Left and right category ids are in order (for all cases)
7. Delete vocabulary Vocab1
8. Query SELECT * FROM assetcategory; again (SEE IMAGE 2)
EXPECTED RESULTS
The categories' leftcategoryid and rightcategoryid will be rebuilt, and the categories will inherit values that take up the missing numbers left by the deletion in chronological order.
ACTUAL RESULTS
The categories' leftcategoryid and rightcategoryid duplicate as seen in IMAGE 2.
Replicated the issue in TRUNK REV 127687 and BRANCH REV 127687.
Issue Links
- relates
-
LPS-30909
Categories have wrong leftCategoryId/rightCategoryId values when removing categories with children
-

Fix consists of two parts:
1. In deleteVocabularyCategories, only delete the the category when it's a root category, when deleting a category the child categories will get deleted also. Therefore, it will try to delete children twice currently.
2. When looping through the categories to delete, call deleteCategory(category.getCategoryId()) instead of deleteCategory(category), when deleting a category, the left and right categoryIds of other categories will change, so for the next in the list, we need to grab the updated category from the database when deleting.