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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

[Jira] retrieving the current project key for project sidebar

I am trying to create a page displaying data about the current jira project. It should be accessible through the sidebar (project-centric-view).

The page has been made accessibel through a WebItem (link in the sidebar). The page itself is rendered as a WebPanel. I have provided the Panel with a contextrenderer (extends AbstractJiraContextProvider) which allows me to override the getContextMap(ApplicationUser, JiraHelper) method. 
I would need the projectId of the current project to retrieve the data I want to display, however the JiraHelper object returns null on the getProject() call.

So how do I get a hold of the projectId?

I suspect that I would need to pass it as a parameter, possibly form the WebItem, but how would I do this?

Any help would be appreciated.




<web-item key="overview-menu-item" name="Upsource Overview Link" 
              weigth="30" application="jira">
        <desctiption>Link to the upsource connectivity overview page for this project</desctiption>
        <label key="upsource-connectivity.overview.label"/>
        <link linkId="upsource-connectivity-overview-link">/projects/$pathEncodedProjectKey?selectedItem=com.atlassian.jira.jira-projects-plugin:upsource-overview-page</link>
        <param name="iconClass" value="aui-icon-large icon-sidebar-issues"/>
    <web-panel key="upsource-overview-panel" location="com.atlassian.jira.jira-projects-plugin:upsource-overview-page">
        <description>Project overview of open upsource reviews</description>
        <resource name="view" type="velocity" location="templates/OverviewPanel.vsl"/>
        <context-provider class=""/>

ContextProvider class



public class OverviewContextProvider extends AbstractJiraContextProvider {

    private UpsourceConnectivityExtentionMethods methodContainer;
    public OverviewContextProvider(){}

    public UpsourceConnectivityExtentionMethods getMethodContainer() {
        return methodContainer;

    public void setMethodContainer(UpsourceConnectivityExtentionMethods methodContainer) {
        this.methodContainer = methodContainer;
    public Map getContextMap(ApplicationUser au, JiraHelper jh) {
        Map contextMap = new HashMap();
        List<String> exceptionMessages = new ArrayList<String>();
            Project currentProject = (Project) (jh.getProject());
            if(currentProject == null){
                String message = "it's the currentproject"
                        + "\nqs: " + jh.getQueryString()
                        + "\ncontextparam: "+ jh.getContextParams().toString();
                throw new Exception(message);
            UpsourceConfig uc = this.methodContainer.loadConfig(currentProject.getKey());
            HashMap<String, String> ucProperties = new HashMap<String, String>();
            ucProperties.put("host", uc.getHost());
            ucProperties.put("user", uc.getUsername());
            ucProperties.put("upsourceId", uc.getUpsourceProjectId());
            contextMap.put("config", ucProperties);
            ResultDTO result = this.methodContainer.getReviews(currentProject);
            if(result == null || result.getResult() == null){
                throw new Exception("its the result");
            ReviewsDTO response = (ReviewsDTO) result.getResult();
            contextMap.put("reviewsDTO", response);
        }catch (UpsourceConnectionFailureException ucfe) {
            System.err.println("UPSOURCE CONNECTION EXCEPTION: " + ucfe.getMessage());
            if (ucfe.getCause() != null && ucfe.getCause().getCause() instanceof {
                exceptionMessages.add("Error resolving host, please check the Upsource Connectivity Settings for this project and your network settings.");
            } else {
        } catch (UpsourceUnsetConfigException uuce) {
            System.err.println("UPSOURCE CONFIGRATION EXCEPTION: " + uuce.getMessage());
        } catch (UpsourceConnectivityException uce) {
            System.err.println("UPSOURCE EXCEPTION: " + uce.getMessage());
            if (uce.getCause() != null) {
            } else {
        } catch (Exception ex) {
            System.err.println("EXCEPTION: " + ex.toString());
        contextMap.put("exceptionList", exceptionMessages);
        return contextMap;


Overview Page


<div class="mod-header">
    <h2>Code Reviews</h2>
    #if( !$exceptionList.isEmpty() )
        #foreach( $exception in $exceptionList )
        <p>No reviews available.</p>
    #foreach( $review in $ )
        <td>State: #if($review.state == 1)
        <td><a href="${review.additionalProperties.get("link")}">Go to review ${review.reviewId.reviewId}</a></td>


2 answers

Hi Robrecht - since this is development related, you might want to try asking this over at: as well (if you haven't already).

There's a lot of helpful and experienced people over there. You might well get a quicker answer in there than on here.

Hi Robrecht,

I have same requirement and even me too facing the same issue in getting the projectId from the sidebar (project-centric-view).

Hope you might have got the solution for this. Could you please provide any link with the solution?

Thanks in advance!



Define in your web-item a link like the below:


See, the projectKey parameter will have value $pathEncodedProjectKey which is the key of your project. Then, in your class extending AbstractJiraContextProvider in the getContextMap method you just get it from the jiraHelper as a GET parameter:

String projectKey = jiraHelper.getRequest().getParameter("projectKey");

Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you