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

Order by title does not work for JournalArticleLocalService.getArticlesByStructureId(..)

    Details

      Description

      Reproduction steps:

      1. Create a new site (note the new Site ID)
      2. Create 3 basic web contents, titled A, B, C
      3. Execute the following groovy script with the replaced Site ID:
        import com.liferay.journal.model.JournalArticle;
        import com.liferay.portal.kernel.util.OrderByComparatorFactoryUtil;
        import com.liferay.journal.service.JournalArticleLocalServiceUtil;
        import com.liferay.portal.kernel.workflow.WorkflowConstants;
        import com.liferay.portal.kernel.util.OrderByComparator;
        import com.liferay.portal.kernel.dao.orm.QueryUtil;
        
        long groupId = <insert Site ID here>;
        String structurekey = "BASIC-WEB-CONTENT"
        
        OrderByComparator<JournalArticle> comparator = OrderByComparatorFactoryUtil.create("JournalArticleLocalization", "title",true);
        List<JournalArticle> journalArticles = JournalArticleLocalServiceUtil.getArticlesByStructureId(groupId, 0, structurekey, WorkflowConstants.STATUS_APPROVED, QueryUtil.ALL_POS, QueryUtil.ALL_POS, comparator);
        
        for (JournalArticle j : journalArticles) {
            out.println("--"+j.getTitle());
        }
        

      Actual result: A, B and C articles are not displayed in alphabetical order
      Expected result: A, B and C articles are displayed in alphabetical order

      Note: The root cause is this method's return value: JournalArticleFinderImpl._isOrderByTitle(..). A return true; is missing from the if statement.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              yang.cao Yang Cao
              Reporter:
              vendel.toreki Vendel Töreki
              Participants of an Issue:
              Recent user:
              Clarissa Velazquez
              Engineering Assignee:
              Vendel Töreki
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                1 year, 5 weeks, 6 days ago

                  Packages

                  Version Package
                  7.2.10 DXP FP14
                  7.2.10.5 DXP SP5
                  7.2.X
                  7.3.5 CE GA6
                  7.3.10 DXP GA1
                  7.3.X
                  Master