Posts

Showing posts with the label journalArticle

Retrieving/getting the JournalArticle from the Tag

Whenever we create the JournalArticle we add tag. Sometimes it is required to get the "Article" from the tag, so how can we do that. Here is the code, String tagName = "cricket"; AssetTag assetTag = AssetTagLocalServiceUtil.getTag(themeDisplay.getScopeGroupId(),tagName); AssetEntryQuery assetEntryQuery = new AssetEntryQuery(); assetEntryQuery.setAllTagIds(new long []{assetTag.getTagId()}); List<journalarticle> journalArticleList = null; List<assetentry> assetEntryList = AssetEntryLocalServiceUtil.getEntries(assetEntryQuery); for(AssetEntry assetEntry : assetEntryList) { try { JournalArticleResource journalArticleResource = JournalArticleResourceLocalServiceUtil .getJournalArticleResource(assetEntry .getClassPK()); JournalArticle journalArticle = JournalArticleLocalServiceUtil.getArticle(groupId,journalArticleResource.getArticleId()); jou...