Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Query count from JournalArticle with Dynamic Query
Here is my code, I want to search journalArticle count
public long searchCount(String treePath, String startDate, String endDate) throws ParseException {
DateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
Date start = simpleDateFormat.parse(startDate);
Date end = simpleDateFormat.parse(endDate);
long results =0L;
int status =0;
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(JournalArticle.class)
.add((PropertyFactoryUtil.forName("folderId").eq(treePath)))
.add((PropertyFactoryUtil.forName("displayDate").between(start, end)))
.add((PropertyFactoryUtil.forName("layoutUuid").isNotNull()))
.add((PropertyFactoryUtil.forName("status").eq(status)));
List<JournalArticle> journalArticleList = JournalArticleLocalServiceUtil.dynamicQuery(dynamicQuery);
results = journalArticleList.get(0).getId();
return result;
}
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™