Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPD-X Avoid the cacheless DynamicQuery #11490

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import com.liferay.account.model.AccountEntryUserRel;
import com.liferay.account.service.AccountEntryUserRelLocalService;
import com.liferay.petra.string.StringPool;
import com.liferay.portal.kernel.dao.orm.DynamicQuery;
import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.model.User;
Expand All @@ -18,7 +16,6 @@
import com.liferay.portal.search.spi.model.index.contributor.ModelDocumentContributor;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.osgi.service.component.annotations.Component;
Expand Down Expand Up @@ -56,16 +53,10 @@ public void contribute(Document document, User user) {
protected long[] getAccountEntryIds(User user) throws Exception {
Set<Long> accountEntryIds = new HashSet<>();

DynamicQuery dynamicQuery =
accountEntryUserRelLocalService.dynamicQuery();
for (AccountEntryUserRel accountEntryUserRel :
accountEntryUserRelLocalService.
getAccountEntryUserRelsByAccountUserId(user.getUserId())) {

dynamicQuery.add(
RestrictionsFactoryUtil.eq("accountUserId", user.getUserId()));

List<AccountEntryUserRel> accountEntryUserRels =
accountEntryUserRelLocalService.dynamicQuery(dynamicQuery);

for (AccountEntryUserRel accountEntryUserRel : accountEntryUserRels) {
accountEntryIds.add(accountEntryUserRel.getAccountEntryId());
}

Expand Down