Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Setting a report category on a custom report

David Arteaga February 3, 2016

I am developing custom reports for JIRA and want to set a category on the reports I am making. I found that adding a <category key="[REPORT CATEGORY]" /> element inside the report element in the atlassian-plugin.xml file sets the category for the report. However, the only keys that do not produce an error are keys that are already defined by the JIRA default reports. Whenever I put a new key, regardless of whether or not I define it in the properties file, JIRA gives an error when trying to install the plugin, and the logs say:

[atlassian.plugin.parsers.XmlDescriptorParser] There was a problem loading the descriptor for module 'report' in plugin 'Distribución de Trabajo'.
The report module: com.processconsulting.worklogDistributionTemp:worklog-distribution specified a category key that is not a valid category: LP
com.atlassian.plugin.PluginParseException: The report module: com.processconsulting.worklogDistributionTemp:worklog-distribution specified a category key that is not a valid category: LP

 

The key I put was "LP", and the logs say it is not a valid category. Is there anything I have to do to add the category in JIRA before I install the plugin? Or maybe something else inside the plugin to let JIRA know that I want to define a new report category?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
pelizza
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 16, 2016

Hi David,

I'm trying to do the same thing, but it seems it is not possible. Here is the class describing static report categories:

https://docs.atlassian.com/jira/latest/com/atlassian/jira/plugin/report/ReportCategoryImpl.html

Also, I checked the Atlassian Connect documentation for reports and it says:

 

Screen Shot 2016-08-16 at 5.32.59 PM.png

 

Actually, the hole documentation for creating report modules for JIRA server is awful! sad

pelizza
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 17, 2016

Now I'm sure it is not possible. The report categories are hardcoded in this class of JIRA Core:

public class ReportCategoryImpl implements ReportCategory {
    public static final ReportCategoryImpl AGILE = new ReportCategoryImpl("agile");
    public static final ReportCategoryImpl ISSUE_ANALYSIS = new ReportCategoryImpl("issue.analysis");
    public static final ReportCategoryImpl FORECAST_MANAGEMENT = new ReportCategoryImpl("forecast.management");
    public static final ReportCategoryImpl OTHER = new ReportCategoryImpl("other");
    private static final Map&lt;String, ReportCategoryImpl&gt; BY_KEY;
    private final String key;

    ReportCategoryImpl(String key) {
        this.key = key;
    }

    public String getKey() {
        return this.key;
    }

    public String getI18nKey() {
        return "report.category." + this.key;
    }

    @Nullable
    public static ReportCategory byKey(String key) {
        return (ReportCategory)BY_KEY.get(key);
    }

    static {
        ImmutableList categories = ImmutableList.of(AGILE, ISSUE_ANALYSIS, FORECAST_MANAGEMENT, OTHER);
        BY_KEY = Maps.uniqueIndex(categories, new Function() {
            public String apply(ReportCategoryImpl input) {
                return input.getKey();
            }
        });
    }
}
TAGS
AUG Leaders

Atlassian Community Events