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

SF rule to always use forEachCompany or forEachCompanyId when iterating companies

    Details

      Description

      We must require to use one of the following methods:

      • com.liferay.portal.kernel.service.CompanyLocalService.forEachCompany
      • com.liferay.portal.kernel.service.CompanyLocalService.forEachCompanyId

      When we iterate over companies like in:

      ActionableDynamicQuery actionableDynamicQuery =
      	companyLocalService.getActionableDynamicQuery();
      
      actionableDynamicQuery.setPerformActionMethod(
      	(Company company) -> {
      		try {
      			method()
      		}
      		catch (Exception exception) {
      			throw new SystemException(exception);
      		}
      	});
      
      actionableDynamicQuery.performActions();
      
      for (Company company : companies) {
      	code()
      }
      
      for (Long companyId : companyIds) {
      	code()
      }
      
      for (long companyId : companyIds) {
      	code()
      }
      

      etc.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              hugo.huijser Hugo Huijser
              Reporter:
              alberto.chaparro Alberto Chaparro
              Engineering Assignee:
              Hugo Huijser
              Recent user:
              Alberto Chaparro
              Participants of an Issue:
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:

                  Packages

                  Version Package