• Adding Portlet To Product Menu In Liferay 7 DXP

    Adding Portlet To Product Menu In Liferay 7 DXP

    Adding Portlet To Product Menu In Liferay 7 DXP, In Earlier versions of liferay Before Liferay 7 we used to mention the control panel category in liferay-portlet.xml, In Liferay 7 DXP Portlet can be added to Product menu by extending  PanelApp Service

    Environment
    Liferay IDE 3.1.2 GA3
    Liferay CE/EE Portal Tomcat 7 GA4
    JDK 8
    MySql 5.7

    In Liferay 7 DXP The Layout of the Portal Have Been Changed, The New Layout of the Liferay 7 DXP Portal is Shown Below







    Step 1 : Create A Portlet

    Create A Portlet Which needs to added to the Product Menu
    In My Case I have Created  a Portlet Named "Product Admin Portlet", make the category of this portlet to hidden using "com.liferay.portlet.display-category=category.hidden"
    The Complete Portlet Class of the portlet is shown below.
    package com.liferaystack.admin.panel.app.portlet;
    
    import com.liferaystack.admin.panel.app.constants.ProductAdminPortletKeys;
    import com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet;
    import javax.portlet.Portlet;
    import org.osgi.service.component.annotations.Component;
    
    /**
     * @author Syed Ali
     */
    
    @Component(
     immediate = true,
     property = {
      "com.liferay.portlet.display-category=category.hidden",
      "com.liferay.portlet.instanceable=true",
      "javax.portlet.display-name=Product Admin Portlet",
      "javax.portlet.init-param.template-path=/",
      "javax.portlet.init-param.view-template=/view.jsp",
      "javax.portlet.name=" + ProductAdminPortletKeys.ProductAdmin,
      "javax.portlet.resource-bundle=content.Language",
      "javax.portlet.security-role-ref=power-user,user"
     },
     service = Portlet.class
    )
    public class ProductAdminPortlet extends MVCPortlet {
    }
    


    Step 2 : Add Dependency

    Add the below Gradle Dependency to the Portlet, This Dependency is mandatory.
    compileOnly group: "com.liferay", name: "com.liferay.application.list.api", version: "2.0.0"
    to your build.gradle


    Step 3 : Create ProductAdminPanelApp Component Class

    Create a Class named ProductAdminPanelApp, this class must extend the BasePanelApp Class, implement the methods of super class as shown below and declare it as a service using service = PanelApp.class

    @Override
    public String getPortletId() {
     return ProductAdminPortletKeys.ProductAdmin;
    }
    
        @Override
        @Reference(target = "(javax.portlet.name=" + ProductAdminPortletKeys.ProductAdmin + ")",unbind = "-")
        public void setPortlet(Portlet portlet) {
            super.setPortlet(portlet);
        }
    

    The Complete ProductAdminPanelApp Will be

    package com.liferaystack.admin.panel.app.portlet;
    
    import com.liferay.application.list.BasePanelApp;
    import com.liferay.application.list.PanelApp;
    import com.liferay.application.list.constants.PanelCategoryKeys;
    import com.liferay.portal.kernel.model.Portlet;
    import com.liferaystack.admin.panel.app.constants.ProductAdminPortletKeys;
    
    import org.osgi.service.component.annotations.Component;
    import org.osgi.service.component.annotations.Reference;
    
    /**
     * @author Syed Ali
     */
    
    @Component(
         immediate = true,
         property = {
             "panel.app.order:Integer=100",
             "panel.category.key=" + PanelCategoryKeys.CONTROL_PANEL_USERS
         },
        service = PanelApp.class
    )
    public class ProductAdminPanelApp extends BasePanelApp {
    
        @Override
        public String getPortletId() {
     return ProductAdminPortletKeys.ProductAdmin;
        }
    
        @Override
        @Reference(target = "(javax.portlet.name=" + ProductAdminPortletKeys.ProductAdmin + ")",unbind = "-")
        public void setPortlet(Portlet portlet) {
            super.setPortlet(portlet);
        }
    }
    

    You are done just deploy the portlet. After Deploying the created portlet you can see your portlet under Users Category Of Control Panel Section of the Product Menu. as shown below.



    Source Code


  • 51 comments:

    1. Awesome Article . Really helpful . I have a doubt on this . when I click the Product Admin Portlet , in the Product Menu , Nothing happened. it is showing empty page . How to show the content , when click the product admin portlet in the product menu

      ReplyDelete
    2. Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely helpful for me. Eyyaa

      ReplyDelete
    3. I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. www.yoursafetyspy.com

      ReplyDelete
    4. Here’s a tip for new people in the business world - brand naming businesses like this are key to creating great product names and taglines. You need them if you want to make it somewhere in the market!

      ReplyDelete
    5. When your website or blog goes live for the first time, it is exciting. That is until you realize no one but you and your. outdoor screen projector

      ReplyDelete
    6. Yes i am totally agreed with this article and i just want say that this article is very nice and very informative article.I will make sure to be reading your blog more. You made a good point but I can't help but wonder, what about the other side? !!!!!!Thanks best bath towels

      ReplyDelete
    7. If you are looking for more information about flat rate locksmith Las Vegas check that right away. packaging material suppliers Malaysia

      ReplyDelete
    8. Great survey, I'm sure you're getting a great response. Plus Size Crotchless Underwear

      ReplyDelete
    9. With regards to make a productive mentality, a ton of us appear to have the hardest time. how long for cbd oil to work

      ReplyDelete
    10. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. Buy Flakka APVP online

      ReplyDelete
    11. This content is written very well. Your use of formatting when making your points makes your observations very clear and easy to understand. Thank you. leather jacket

      ReplyDelete
    12. Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. all clad non stick pans

      ReplyDelete
    13. Fantastic blog! Do you have any tips and hints for aspiring writers? I’m planning to start my own website soon but I’m a little lost on everything. Would you propose starting with a free platform like WordPress or go for a paid option? There are so many options out there that I’m completely overwhelmed .. Any suggestions? Many thanks! the best binoculars for hunting

      ReplyDelete
    14. Great survey, I'm sure you're getting a great response. skipping rope

      ReplyDelete
    15. Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. Division 10 Suppliers

      ReplyDelete
    16. Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks cheapest place to buy printer ink online

      ReplyDelete
    17. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here keep up the good work racing suit

      ReplyDelete
    18. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work... Skull Bedding Set

      ReplyDelete
    19. I found your this post while searching for some related information on blog search...Its a good post..keep posting and update the information. beko ankastre

      ReplyDelete
    20. I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept. Thank you for the post. motorcycle jackets

      ReplyDelete
    21. Thanks for an interesting blog. What else may I get that sort of info written in such a perfect approach? I have an undertaking that I am just now operating on, and I have been on the lookout for such info. best projectors under $300

      ReplyDelete
    22. I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... best garden hose to use with pressure washer

      ReplyDelete
    23. Some truly wonderful work on behalf of the owner of this internet site , perfectly great articles . best commercial spreader

      ReplyDelete
    24. Very interesting blog. Alot of blogs I see these days don't really provide anything that I'm interested in, but I'm most definately interested in this one. Just thought that I would post and let you know. best native 1080p projector under 200

      ReplyDelete
    25. i am for the first time here. I found this board and I in finding It truly helpful & it helped me out a lot. I hope to present something back and help others such as you helped me. motorcycle suit

      ReplyDelete
    26. Im no expert, but I believe you just made an excellent point. You certainly fully understand what youre speaking about, and I can truly get behind that. gaming chair with footrest under $100

      ReplyDelete
    27. very interesting post.this is my first time visit here.i found so mmany interesting stuff in your blog especially its discussion..thanks for the post! BEST HOT AND COLD WATER DISPENSERS

      ReplyDelete
    28. I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... sound artist amplifier

      ReplyDelete
    29. Hello I am so delighted I located your blog, I really located you by mistake, while I was watching on google for something else, Anyways I am here now and could just like to say thank for a tremendous post and a all round entertaining website. Please do keep up the great work. sound artist sa-200ia integrated amplifier

      ReplyDelete
    30. This is my first time i visit here and I found so many interesting stuff in your blog especially it's discussion, thank you. https://trippyrepublic.com

      ReplyDelete
    31. I cannot wait to dig deep and kickoff utilizing resources that I received from you. Your exuberance is refreshing. cryptoe quipment

      ReplyDelete
    32. Pretty good post. I have just stumbled upon your blog and enjoyed reading your blog posts very much. I am looking for new posts to get more precious info. Big thanks for the useful info. mini moto

      ReplyDelete
    33. Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks silicone suction bowl with bamboo spoon kit

      ReplyDelete
    34. I like your post. It is good to see you verbalize from the heart and clarity on this important subject can be easily observed... demountable partitions

      ReplyDelete
    35. Thanks for sharing the post.. parents are worlds best person in each lives of individual..they need or must succeed to sustain needs of the family. queens cannabis dispensary

      ReplyDelete
    36. I’ve been searching for some decent stuff on the subject and haven't had any luck up until this point, You just got a new biggest fan!.. silver bracelets

      ReplyDelete
    37. This was a really great contest and hopefully I can attend the next one. It was alot of fun and I really enjoyed myself.. psilocybe mexicana

      ReplyDelete
    38. This comment has been removed by the author.

      ReplyDelete
    39. I am all that much satisfied with the substance you have said. I needed to thank you for this extraordinary article.raid tile

      ReplyDelete
    40. Hey, this day is too much good for me, since this time I am reading this enormous informative article here at my home. Thanks a lot for massive hard work. Boutique Locale

      ReplyDelete
    41. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.private detective irving

      ReplyDelete
    42. I am persistently astounded by the measure of data accessible on this subject. What you introduced was very much scrutinized and eloquent with a specific end goal to get your stand on this crosswise over to every one of your perusers.vintage 1940s clothing

      ReplyDelete
    43. Awesome substance material and extraordinary design. Your site merits the greater part of the positive input it's been getting. asheville remodeling

      ReplyDelete
    44. Therefore dissertation web-sites as a result of online to set-up safe and sound ostensibly taped in the website. iqos

      ReplyDelete
    45. Yes i am totally agreed with this article and i just want say that this article is very nice and very informative article.I will make sure to be reading your blog more. You made a good point but I can't help but wonder, what about the other side? !!!!!!THANKS!!!!!! kurve

      ReplyDelete
    46. I got too much interesting stuff on your blog. I guess I am not the only one having all the enjoyment here! Keep up the good work. clover pos

      ReplyDelete
    47. Succeed! It could be one of the most useful blogs we have ever come across on the subject. Excellent info! I’m also an expert in this topic so I can understand your effort very well. Thanks for the huge help. clover pos

      ReplyDelete
    48. All your hard work is much appreciated. Nobody can stop to admire you. Lots of appreciation. How to remove dent

      ReplyDelete
    49. This is an informative article on HTTP/2 Server Push. A pure Java HTTP web server is the environment in which Java code can run. I must say that the services of this blog are great. It's good to read the articles of this blog. I appreciate the effort of the author, you are doing an excellent job here. Keep it up.vintage clothes

      ReplyDelete
    50. I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day! خصم اي هيرب 2022

      ReplyDelete
    51. In the event that the response is one, now is the ideal time to open up that imaginative piece of your cerebrum and make more revenue sources. One choice is automated revenue products.howmuch.info

      ReplyDelete