hhuijser/liferay-portal — pull request #2190 by yuhai (2014-10-24 16:30:11+00:00)
Title: LPS-51059

The PR extends the #2186

The issue might be caused by rebuildTree many times when delete lots of Category (for example, 5000 categorys all include subCategorys). Because when delete one category which has subCategorys, we will execute rebuildTree once.

Refer to Julio's solution: After deleting all the categories, we will execute rebuildTree once.
https://in.liferay.com/web/global.engineering/forums/-/message_boards/message/3664418#_19_message_3664945

For the current fix, it will only rebuildTree once after deleting all categorys and some/one of categorys have child category. That is to say, if delete 1000 categorys and these categorys all don't have childCategory, we won't rebuildTree. If one of 1000 categorys has childCategory, we will rebuildTree once after deleting all categorys.

In addition, in order to keep previous API won't be broken in AssetCategoryLocalServiceImpl class, we keep the original the param "boolean childCategory".

Please help check it.

Thanks,
Hai