Hello,
is there a possibility how to get the filter of a gadget? I want to retrieve all issues in a filter. And this filter I want to access by a gadget. I know it is possible to get all issues in a filter. But my point is to get the filter via an Gadget-Object.
How can I do this programmatical?
Another question:
Can I iterate over all gadgets in a dashboard? I want to get all gadgets that are contained in a dashboard. If I got these gadgets, I could get the filter.
By the way are there any event-listener for dashboards? So when dashboard is updated an event will be triggered. I found for example listener for projects or issues but nothing for dashboards or gadgets.
Thanks in advance for any help.
Solution can be found on
Does anybody have an idea or a hint, how to get the Filter/Query of a Gadget receiving from the GadgetURI as mentioned above? Is it possible via the JIRA API 6.2.7 or do I have to consult the REST API?
Is it possible to access a gadget from java code that you have created before in a dashboard? And get its query somehow? How is a Gadget defined in the JIRA API?
Please help me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, I found a solution.
You can't access all gadgets directly from the PortalPage instance. Instead you need to use the PortalPageService right from the beginning to access all PortletConfigurations like in the Code-Listing below:
List<List<PortletConfiguration>> portletConfigs = pps.getPortletConfigurations(new JiraServiceContextImpl(user), (long)10202); // pps is instance PortalPageService
And now with the List of the List of PortletConfigurations you can iterate through all GadgetURIs and you can access all Queries like:
for(int i = 0; i<portletConfigs.size(); i++) { List<PortletConfiguration> llconfigs = portletConfigs.get(i); for(int j = 0; j<llconfigs.size(); j++) { PortletConfiguration pc = llconfigs.get(j); log.info("QUERY:" + pc.getGadgetURI().getQuery()); } }
It (PortalPage) no longer has a link to the PortletConfigurations (Gadgets) displayed on a dashboard. To get this information one should consult the PortalPageService directly.
Atlassian JIRA API
Unfortunately, whenever I call the method getQuery, it will return null, although a filter were defined in the corresponding gadget. What is wrong? How can I get the filter/query from every gadget?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If I'm not mistaken, you can get the gadget's infomration if you get the gadget object.
Can I iterate over all gadgets in a dashboard?
Yes.
By the way are there any event-listener for dashboards
No.
This class DefaultPortalPageService should get you unstuck.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your answer.
The PortalPageService is the top level service for Dashboard operations. For historical reasons, Dashboards were called Portals and hence the prefix "Portal" is used consistently throughout the code.
See follwing link: http://goo.gl/qmV3Ll
When I have a PortalPage/Dashboard, how can I access all the gadgets in this dashboard?
I have following Java Code:
User user = (User)ComponentAccessor.getCrowdService().getUser("admin"); PortalPage portalpage = ComponentAccessor.getComponent(PortalPageService.class).getPortalPage(new JiraServiceContextImpl(user), (long)10201); //how to get all gadgets with portalPage
Is there a way to get all gadgets with portalpage or another way how to iterate over all gadgets? If possible a little code sample would help me further.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.