As seen in the method below, sprintManger.getAllSprints() is causing a null pointer exception . This makes me think that I am not implementing the SprintManager correclty.
// Here is the method where I am experiencing the problem
ServiceOutcome<Collection<Sprint>> getSprints(){
SprintManager sprintManager = ComponentAccessor.getComponent(SprintManagerImpl.class);
return sprintManager.getAllSprints();
}
I have also tried implementing the SprintManager by the following way:
SprintManager sprintManager = new SprintManagerImpl();
But it also causes a null pointer exception.
Does anyone know the right way to do this?
Thanks!
Use REST calls to access sprint info. This is much easier then trying to use the SprintManager class.
Unfortunatly, it is a little more tricky to get this class. I managed it using this code:
private SprintManager getSprintManager() throws InvalidSyntaxException { ApplicationContext appCtx = (ApplicationContext) getGreenHopperAppCtx(); if ( appCtx !=null ) { return (SprintManager) appCtx.getBean( "sprintManagerImpl" ); } return null; } private Object getGreenHopperAppCtx() throws InvalidSyntaxException { OsgiContainerManager osgi = ComponentAccessor.getComponentOfType(OsgiContainerManager.class); if ( osgi==null ) { java.lang.System.out.println("OSGI Not Found"); return null; } Bundle[] bundles = osgi.getBundles(); for(int i=0;i<bundles.length;i++) { Bundle bundle = bundles[i]; if ( "com.pyxis.greenhopper.jira".equals( bundle.getSymbolicName() ) ) { BundleContext bctx = bundle.getBundleContext(); ServiceReference[] refs = bctx.getAllServiceReferences(null,null); if ( refs!=null ) { for(int j=0; j<refs.length;j++) { Object prop = refs[j].getProperty("org.springframework.context.service.name"); if ( "com.pyxis.greenhopper.jira".equals(prop) ) { return bctx.getService( refs[j] ); } } } } } return null; }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, that is getting me closer to a solution. I am having an issue in the line
return
(SprintManager) appCtx.getBean(
"sprintManagerImpl"
);
My IDE seems to think that the ApplicationContext is an import from
electric.glue.context.ApplicationContext;
Is that the import that you are using? My appCtx does not seem to have a method called getBean().
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I currently can't tell you what class it was exactly, but I'm sure it was not from the electric.glue package. If I remember correctly, the class should be from org.springframework.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's org.springframework.context (http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/ApplicationContext.html) To have it, you need to include in your pom.xml: <dependency> <groupId>org.springframework.osgi</groupId> <artifactId>spring-osgi-core</artifactId> <version>1.1.3</version> <scope>provided</scope> </dependency>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If my plugin is installed before greenhopper (Agile) is installed, I've got java.lang.ClassNotFoundException: com.atlassian.greenhopper.service.sprint.SprintManager. How to fix it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have the same error
I use it:
final PluginAccessor pluginAccessor = ComponentManager.getComponent(PluginAccessor.class); Plugin plugin = pluginAccessor.getEnabledPlugin("com.pyxis.greenhopper.jira");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
all the dependencies:
http://www.java2s.com/Code/Jar/a/Downloadatlassianpluginsosgi260jar.htm
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.framework</artifactId>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>org.sonatype.tycho</groupId>
<artifactId>maven-osgi-packaging-plugin</artifactId>
<version>0.11.1</version>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-components</artifactId>
<version>7.1.0-QR20151201104527</version>
</dependency>
<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-osgi-bridge</artifactId>
<version>5.0.0-6892e16</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
//applicationcontext
import org.springframework.context.*; //kan kleiner
//invalidsyntax
import org.osgi.framework.InvalidSyntaxException;
//OsgiContainerManager
import com.atlassian.plugin.osgi.container.OsgiContainerManager;
import com.atlassian.plugin.osgi.container.OsgiContainerException;
//ComponentAccessor
import com.atlassian.jira.component.ComponentAccessor;
//getSymbolicName
import org.osgi.framework.*;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For Jira v7 look at https://community.atlassian.com/t5/Answers-Developer-Questions/Change-sprint-value-by-groovy-script/qaq-p/522895#M60555
(Took me a while to find it, and this thread came up a thousand times on google - has the right keywords in it. That's why I'm commenting on such an old entry.)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The groovy is not far off, in fact it's using java calls already.
For the script that was quoted in the link, all you need to do is replace the "def" uses with the java variable object types for the return values (e.g. if you had "def i = 3", convert it to "int i = 3") and add ; to the end of the lines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there a way to "extend" the built in 'Burndown Chart' that is provided with our current Jira instance?
If so how?
I have been searching through the source and I am unable to find it.
Please advise.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not directly, but you could download the code and hack it (if you have a commercial licence)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there an example that shows the SprintManager usage for Jira 7?
Been searching for some time.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.