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

Mine articles in folder is not return right result

    Details

      Description

      There is an unexpected result in following Liferay API (*1):
      List results = JournalArticleServiceUtil.getGroupArticles(
      _themeDisplay.getScopeGroupId(), _themeDisplay.getUserId(),
      getFolderId(), getStatus(), includeOwner,
      articleSearchContainer.getStart(),
      articleSearchContainer.getEnd(),
      articleSearchContainer.getOrderByComparator());

      Our investigation found that there are problem in parameter in SQL query.
      In JournalArticleFinderImpl.doFindByG_F_C_L() method (*2), the sequence of parameter are groupId, classNameId, userId and folderId.... but in default.xml file (*3), sequence are groupId, classNameId, folderId and userId..... This cause no result from this API even there are data in database with same matching criteria.

      (*1) https://github.com/liferay/liferay-portal/blob/7.1.x/modules/apps/journal/journal-web/src/main/java/com/liferay/journal/web/internal/display/context/JournalDisplayContext.java#L1034
      (*2) https://github.com/liferay/liferay-portal/blob/7.1.x/modules/apps/journal/journal-service/src/main/java/com/liferay/journal/service/persistence/impl/JournalArticleFinderImpl.java#L1563
      (*3)https://github.com/liferay/liferay-portal/blob/7.1.x/modules/apps/journal/journal-service/src/main/resources/META-INF/custom-sql/default.xml#L357

      Reproduction Steps:

      1.) Use a 7.1 vanilla bundle with the latest fix pack.

      2.) Start the system and navigate to Control Panel --> Content --> Web Content, here create a folder and inside it create a new article.

      3.) Please run the below script:

      import com.liferay.journal.service.JournalArticleServiceUtil;
      import java.util.List;
      import com.liferay.journal.model.JournalArticle;
      ​
      long groupId = 37858;
      long userId = 20125;
      long rootFolderId = 33767;
      int status = 0;
      boolean includeOwner = true;
      int start = 0; 
      int end = 10;
      ​
      List<JournalArticle> articles =
       JournalArticleServiceUtil.getGroupArticles(
        groupId, userId, rootFolderId, status,
        includeOwner, start, end, null);
      ​
      out.println(articles.size());
      
      • In order to use the script, please add the groupId, userId and rootFolderId that you have in your test environment. You can find these in the journalarticle table.
      • The above script will have a 0 output because the actual code and sql-queries don't share the same logical order.

      Also tested:

      master @ commit (6b0732d72b4042ab02c080305327a16c83135ba5) reproduced.

      We checked the code on master and there isn't any change, therefore the matter still persists.

        Attachments

          Activity

            People

            • Assignee:
              yang.cao Yang Cao
              Reporter:
              laszlo.pap Laszlo Pap
              Participants of an Issue:
              Recent user:
              Jason Pince
              Engineering Assignee:
              Laszlo Pap
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                4 weeks ago

                Packages

                Version Package
                7.1.X
                7.2.10 DXP FP3
                7.2.X
                7.2.1 CE GA2
                Master