-
Bug
-
Resolution: Support Request
-
Medium
-
None
-
6.6.13
-
Jira: 6.3.11
Debian 3.2.63-2 x86_64
-
6.06
-
We need a Plugin for Jira, that creates a Project with some Parameter and a Agile Board for the Project.
In the Test-System that starts with "atlas-run" we have no errors. The Project and the Agile Board is configured correctly.
But if we upload it to the production system (same Jira und Jira Agile version), we run in an error.
The Project is configured correctly, but there is no Agile Board.
The Code:
KanbanBigProjectHook.java
package de.flynet.plugins.mytest.projectblueprint; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import com.atlassian.crowd.embedded.api.User; import com.atlassian.greenhopper.api.rapid.view.Column; import com.atlassian.greenhopper.api.rapid.view.RapidViewCreationServiceImpl; import com.atlassian.jira.blueprint.api.AddProjectHook; import com.atlassian.jira.blueprint.api.ConfigureData; import com.atlassian.jira.blueprint.api.ConfigureResponse; import com.atlassian.jira.blueprint.api.ValidateData; import com.atlassian.jira.blueprint.api.ValidateResponse; import com.atlassian.jira.component.ComponentAccessor; import com.atlassian.jira.config.DefaultStatusManager; import com.atlassian.jira.issue.search.DefaultSearchRequestManager; import com.atlassian.jira.issue.search.SearchRequest; import com.atlassian.jira.issue.status.Status; import com.atlassian.jira.jql.builder.JqlClauseBuilder; import com.atlassian.jira.jql.builder.JqlQueryBuilder; import com.atlassian.jira.project.Project; import com.atlassian.jira.project.ProjectManager; import com.atlassian.jira.scheme.Scheme; import com.atlassian.jira.user.ApplicationUser; import com.atlassian.jira.util.ErrorCollection; import com.atlassian.jira.util.SimpleErrorCollection; import com.atlassian.jira.workflow.WorkflowSchemeManager; import com.atlassian.query.Query; import com.atlassian.query.QueryImpl; import com.atlassian.query.clause.Clause; // import com.atlassian.jira.ComponentManager; // import com.atlassian.greenhopper.service.rapid.view.RapidViewServiceImpl; public class KanbanBigProjectHook implements AddProjectHook { @Override public ValidateResponse validate(final ValidateData validateData) { ValidateResponse validateResponse = ValidateResponse.create(); return validateResponse; } @Override public ConfigureResponse configure(final ConfigureData configureData) { WorkflowSchemeManager workflowSchemeManager = ComponentAccessor.getWorkflowSchemeManager(); ProjectManager projectManager = ComponentAccessor.getProjectManager(); Project project = projectManager.getProjectByCurrentKey(configureData.project().getKey()); Scheme scheme = workflowSchemeManager.getSchemeObject("Arbeitsablaufschema Test"); workflowSchemeManager.addSchemeToProject(project, scheme); List<Project> projectlist = new ArrayList<Project>(); projectlist.add(project); ApplicationUser appuser = ComponentAccessor.getUserUtil().getUserByName("admin"); User user = appuser.getDirectoryUser(); JqlClauseBuilder clausebuilder = JqlQueryBuilder.newClauseBuilder().defaultAnd().project(project.getKey()); Clause clause = clausebuilder.buildClause(); Query query = new QueryImpl(clause); SearchRequest search = new SearchRequest(query, appuser, "RV " + project.getName(), project.getName()); DefaultSearchRequestManager dsrm = null; RapidViewCreationServiceImpl rvcsi = null; DefaultStatusManager dsm = null; try { dsrm = ComponentAccessor.getComponentClassManager().newInstance("com.atlassian.jira.issue.search.DefaultSearchRequestManager"); rvcsi = ComponentAccessor.getComponentClassManager().newInstance("com.atlassian.greenhopper.api.rapid.view.RapidViewCreationServiceImpl"); dsm = ComponentAccessor.getComponentClassManager().newInstance("com.atlassian.jira.config.DefaultStatusManager"); } catch (ClassNotFoundException e) { e.printStackTrace(); } search = dsrm.create(search); ErrorCollection errors = new SimpleErrorCollection(); // ERROR at this line Long rapidViewId = rvcsi.createNewRapidView(user, project.getName() + " Board", search.getId().longValue(), errors); ConfigureResponse configureResponse = ConfigureResponse.create().setRedirect("/browse/"+configureData.project().getKey()); // ConfigureResponse configureResponse = ConfigureResponse.create().setRedirect("/secure/RapidBoard.jspa?rapidView="+rapidViewId); return configureResponse; } }
Error Message:
java.lang.NullPointerException at com.atlassian.greenhopper.api.rapid.view.RapidViewCreationServiceImpl.createNewRapidView(RapidViewCreationServiceImpl.java:58) at de.flynet.plugins.mytest.projectblueprint.KanbanBigProjectHook.configure(KanbanBigProjectHook.java:84) at com.atlassian.jira.projecttemplates.service.ProjectTemplateServiceImpl.applyProjectTemplate(ProjectTemplateServiceImpl.java:108)