Integrated query for 35:assettag of LIFERAY7 BPM Portal development

Source: Internet
Author: User
Tags tagname

Tag is the asset feature in Liferay, which can be used to classify information, and the asset type in Iferay is:

    • 1. Web content (custom content)
    • 2. Documents and media (document library and medium file)
    • 3. Blogs (blog post)
    • 4. Message Boards
    • 5. Wiki Page
    • 6, Bookmarks

The information can be categorized according to TagName, demonstrating the code:

//Query the number of tags (in accordance with tagname= ' news ')Themedisplay Themedisplay =(Themedisplay) Renderrequest.getattribute (Webkeys.theme_display); String TagName="News";Try{Assettag Assettag=Assettaglocalserviceutil.gettag (Themedisplay.getscopegroupid (), tagName);intAssetcount =Assettag.getassetcount (); System. out. println ("Tage Name:"+tagName); System. out. println ("Number of associated assets:"+assetcount); } Catch(portalexception e) {e.printstacktrace ();}Catch(SystemException e) {e.printstacktrace ();}//=======================//Query all assets (by TagName)Themedisplay Themedisplay=(Themedisplay) Renderrequest.getattribute (Webkeys.theme_display); String TagName="News";Try{Assettag Assettag=Assettaglocalserviceutil.gettag (Themedisplay.getscopegroupid (), tagName); Assetentryquery Assetentryquery=Newassetentryquery ();Long[] Tagids ={assettag.gettagid ()};assetentryquery.setanytagids (tagids); List<AssetEntry> assetentrylist =assetentrylocalserviceutil.getentries (assetentryquery); for(Assetentry assetentry:assetentrylist) {//Here all the logic would go......}} Catch(portalexception e) {e.printstacktrace ();}Catch(SystemException e) {e.printstacktrace ();}//=======================//Query Journalarticle all articles in accordance with Tagname= ' news '//Note: Journalarticle is a liferay built-in web CMS Content, it can be used to do news class displayThemedisplay Themedisplay=(Themedisplay) Renderrequest.getattribute (Webkeys.theme_display); String TagName="News";Try{Assettag Assettag=Assettaglocalserviceutil.gettag (Themedisplay.getscopegroupid (), tagName); Assetentryquery Assetentryquery=Newassetentryquery ();Long[] Tagids ={assettag.gettagid ()};assetentryquery.setanytagids (tagids); Assetentryquery.setclassname (JournalArticle.class. GetName ()); List<AssetEntry> assetentrylist =assetentrylocalserviceutil.getentries (assetentryquery);//start traversing journalarticle for(Assetentry assetentry:assetentrylist) {Journalarticleresource Journalarticleresource=Journalarticleresourcelocalserviceutil.getjournalarticleresource (ASSETENTRY.GETCLASSPK ()); Journalarticle journalarticle=journalarticlelocalserviceutil.getarticle (Journalarticleresource.getgroupid (), Journalarticleresource.getarticleid ()); System. out. println ("Journal article Title:"+Journalarticle.gettitle (Themedisplay.getlocale ()));}} Catch(portalexception e) {e.printstacktrace ();}Catch(SystemException e) {e.printstacktrace ();}//=======================//find information on all bookmarks that match tagname= ' news 'Themedisplay Themedisplay=(Themedisplay) Renderrequest.getattribute (Webkeys.theme_display); String TagName="News";Try{Assettag Assettag=Assettaglocalserviceutil.gettag (Themedisplay.getscopegroupid (), tagName); Assetentryquery Assetentryquery=Newassetentryquery ();Long[] Tagids ={assettag.gettagid ()};assetentryquery.setanytagids (tagids);/** * Bookmarks*/assetentryquery.setclassname (bookmarksentry.class. GetName ()); List<AssetEntry> assetentrylist =assetentrylocalserviceutil.getentries (assetentryquery); for(Assetentry assetentry:assetentrylist) {bookmarksentry bookmarksentry=Bookmarksentrylocalserviceutil.getbookmarksentry (ASSETENTRY.GETCLASSPK ()); Dosomething}/** * Blogs*/assetentryquery.setclassname (blogsentry.class. GetName ()); Assetentrylist=assetentrylocalserviceutil.getentries (assetentryquery); for(Assetentry assetentry:assetentrylist) {blogsentry blogsentry=Blogsentrylocalserviceutil.getblogsentry (ASSETENTRY.GETCLASSPK ()); Dosomething}/** * Documents and media*/assetentryquery.setclassname (dlfileentry.class. GetName ()); Assetentrylist=assetentrylocalserviceutil.getentries (assetentryquery); for(Assetentry assetentry:assetentrylist) {dlfileentry dlfileentry=Dlfileentrylocalserviceutil.getdlfileentry (ASSETENTRY.GETCLASSPK ()); DoSomething}} Catch(portalexception e) {e.printstacktrace ();}Catch(SystemException e) {e.printstacktrace ();}

Integrated query for 35:assettag of LIFERAY7 BPM Portal development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.