Unable to complete Tutorial on JIRADev website

 Hi

I am working through the "User Role Project Tab" tutorial on Bhushan Nagaraj website JIRADev.com and get the following failure at the For loop when running atlas-debug.

incompatible types: java.lang.Object cannot be converted to com.atlassian.jira.security.roles.Project 

 Any ideas why?

Jim

 

package com.jiradev.jira.plugins.panels.project;

import com.atlassian.crowd.embedded.api.User;

import com.atlassian.jira.component.ComponentAccessor;

import com.atlassian.jira.project.Project;

import com.atlassian.jira.security.roles.ProjectRole;

import com.atlassian.jira.security.roles.ProjectRoleActors;

import com.atlassian.jira.security.roles.ProjectRoleManager;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

import com.atlassian.jira.plugin.projectpanel.impl.AbstractProjectTabPanel;

import com.atlassian.jira.plugin.projectpanel.ProjectTabPanel;

import com.atlassian.jira.plugin.projectpanel.ProjectTabPanelModuleDescriptor;

import com.atlassian.jira.project.browse.BrowseContext;

import java.util.Collection;

import java.util.Map;

import java.util.TreeMap;

 

public class UserRoleProjectTabPanel extends AbstractProjectTabPanel implements ProjectTabPanel {

 

    private static final Logger log = LoggerFactory.getLogger(UserRoleProjectTabPanel.class);

    private ProjectRoleManager projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager.class);

    private TreeMap people = new TreeMap();

 

    public Map createVelocityParams(BrowseContext ctx) {

        //Get the params object. This will hold all the values that can be accessed in the user-role-project-tab.properties file

 

        Map params = super.createVelocityParams(ctx);

        //Get the project object

        Project project = ctx.getProject();

        //Get all the project roles

        Collection projectRoles = projectRoleManager.getProjectRoles();

        //Iterate through each role and get the users associated with the role

     for (ProjectRole projectRole : projectRoles) {

          ProjectRoleActors roleActors = projectRoleManager.getProjectRoleActors(projectRole, project);

          people.put(projectRole.getName(), roleActors.getUsers());

      }

        params.put("people", people);

        params.put("avatarService", ComponentAccessor.getAvatarService());

        return params;

    }

 

    public boolean showPanel(BrowseContext context) {

        return true;

    }

}

2 answers

0 votes

I suspect it's because of age.  The code you've got looks like stuff for JIRA 4-6.   The user, group and role stuff changed a lot in JIRA 6.high, and even more in 7.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,063 views 13 18
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot