JiraHelper in AbstractWebCondition and AbstractJiraContextProvider has null values


I had two situations where I wanted to use the JiraHelper class in regards to my project-centric-view and both times it is not working out, because the JiraHelper has nearly only null values.

This questions is a follow up to this question of @m.miessner. Maybe @sfbehnke has some time to look at it :slight_smile:

I created a custom condition which controls whether a certain menu item shall be added to the project-centric-view or not, depending on the project which is opened. My first approach was to extend the AbstractWebCondition class like this.

public class ProjectHasKeyBCMCondition extends AbstractWebCondition {

    private List<String> allowedProjectKeys;

    public ProjectHasKeyBCMCondition() {
        allowedProjectKeys = new ArrayList<>();

    public boolean shouldDisplay(ApplicationUser applicationUser, JiraHelper jiraHelper) {
        return allowedProjectKeys.contains(jiraHelper.getProject().getKey());

But it turned out that the jiraHelper.getProject() method always returns null. I had to implement it using jiraHelper.getRequest().getRequestURL() and cutting out the relevant string part I need. Not very elegant…

The other situation was when I implemented a ContextProvider for my project-centric-view. I tried to extend the AbstractJiraContextProvider class. In the getContextMap() method there is again a JiraHelper parameter and again it does only provide a null value when calling jiraHelper.getProject(). In both situations my understanding would be that a parameter which is called “helper” already has this value evaluated in order to help me :wink: this is the same problem as in the question I mentioned earlies. The solution was to implement the ContextProvider interface directly and avoid using the AbstractJiraContextProvider class.

In both situations the usage of the JiraHelper would be more convenient. Any idea why the jiraHelper is not initialized like I expected?


Hi Jens,

I still have the problem and I still solved it in a smiliar way you did. Which means: I pass the project key to my centric view by parameter and cut it out from the getRequestURL value. Like you said, I think there are better ways to do it. For example “getProject” from the jirahelper class.


As I said I use the “cut something out of the request url” approach. But this is not always working when it comes to a condition for a project-centric-view menu item in the sidebar navigation.

I have a project with key ABC and I am looking for something like project/ABC , projects/ABC or browse/ABC in the url. But when you click on the issues menu item in the sidebar there is apparently an url involved which looks like http://localhost:8080/secure/ProjectIssueNavigatorAction!issueSearchWithSidebar.jspa.

Here we do not have any ABC key in there and so my condition does not work. My menu item is not displayed. Do you have an idea how to work around that (without jirahelper)?

I managed to solve this with another string cutting approach. Apparently the jiraHelper has the queryString attribute set and this contains the project db id as pid.

        String queryString = jiraHelper.getQueryString();
        if (queryString != null && queryString.contains("pid=")) {
            String pid = queryString.substring(queryString.indexOf("pid="), queryString.indexOf("pid=") + 9).substring(4);
            Project projectObj = projectManager.getProjectObj(Long.parseLong(pid));
            return projectObj.getKey().equalsIgnoreCase("ABC");

Привет! Также долго мучилась с этой проблемой. Нашла следующее решение:
чтобы определить проект в пункте “summary” левой панели:
в url выделаю key проекта
чтобы определить проект в пункте “Задачи” левой панели:
в своем классе-Providers, который implements ContextProvider, определяю PluginHttpRequestWrapper из context.get(“request”).
Далее в полученном request.getParameterMap() предоставиться key проекта!
Вообщем, где не получится взять название проекта из url, беру из context.get(“request”)