Antes de desenvolvermos a solução pesquisamos algumas possíveis soluções como:
1-Adicionar a dependência do plugin da api do greenhopper ao projeto como neste [link|https://bitbucket.org/jhatherly/wallboards/src/3ab731ba4e4b/pom.xml]. (NAO FUNCIONA)
{code}
<dependency>
<groupId>com.atlassian.jira.plugins</groupId>
<artifactId>jira-greenhopper-plugin</artifactId>
<version>${greenhopper.version}</version>
<scope>provided</scope>
</dependency>
{code}
2-Adicionar esta tag no {color:#3366ff}atlassian-plugin.xml{color} para importar o componente e instanciá-lo num contrutor de uma classe.
{code}
<component-import key="greenhopper-service" name="GreenHopper Service" interface="com.pyxis.greenhopper.GreenHopper">
<description>GreenHopper Service component to access Fix Versions hierarchy data</description>
</component-import>
public Constructor(GreenHopper gh) {
//gh está ok.
if (gh != null) {
System.out.println("GreenhopperService inicializada com sucesso.");
}
//Mas "loadGHVersion(project)" aqui não instancia..
gh.loadGHVersion(project);
}
{code}
ou
{code}
<component key="greenhopper-bridgeservicelocator" name="GreenHopper BridgeServiceLocator" public="true">
<interface>com.atlassian.greenhopper.service.BridgeServiceLocator</interface>
</component>
public Constructor(BridgeServiceLocator bridgeService) {
//BridgeServiceLocator.getInstance() está ok.
if (bridgeService != null) {
System.out.println("GreenhopperService inicializada com sucesso.");
this.bridgeService = bridgeService;
//Mas ".getInstance().getGHVersionService()" aqui não instancia..
GHVersionService serviceVersion = this.bridgeService.getInstance().getGHVersionService();
}
}
{code}
ou
{code}
ProjectConfiguration configuration = JiraUtil.getGreenHopperService().getConfiguration(project);
Date versionStartDate = configuration.getVersionStartDate(versionJira);
//Mas ".getGreenHopperService()" não instancia..
{code}
{html}
<table width="20%" align="center">
<tr>
<td>
<img src="http://4.bp.blogspot.com/_yMOA6Ys0LxQ/TSR5uYyxLCI/AAAAAAAAADY/A_KyHtL4QsM/s1600/gargalhada.jpg" width="200px" heigth="400px"/>
</td>
</tr>
</table>
<marquee direction="left <tr><td>
<marquee orientation="right"><font face="verdana" style="color:darkgray">hahahahahaha ! ! !</font></marquee>
</td></tr>
</table>
{html}
Eis o que realmente funcionou:
1-Coloque a dependencia da api do greenhopper no seu pom.xml.
{code}
<dependency>
<groupId>greenhopper</groupId>
<artifactId>jira-greenhopper-plugin</artifactId>
<version>5.6.2</version>
<scope>runtime</scope>
</dependency>
Esta(5.6.2) é a última versão no repositório da atlassian.
{code}
{code}
private IssueManager issueManager = ComponentManager.getComponentInstanceOfType(IssueManager.class);
private IssueFieldManager issueFieldManager = ComponentManager.getComponentInstanceOfType(IssueFieldManager.class);
MutableIssue mi = issueManager.getIssueObject("issueId"); //issueId ou issuekey
ProjectConfiguration configuration = new ProjectConfiguration(mi.getProjectObject(), issueFieldManager);
List<Version> version = new ArrayList<Version>(mi.getFixVersions());
Version uniqueVersion = version.get(0);
VersionWrapper versionW = new VersionWrapper(uniqueVersion);
System.out.println("end-date: [ "+configuration.getVersionEndDate(uniqueVersion)+" \]"); //util.Date
System.out.println("relese-date: [ "+versionW.getReleaseDate()+" \]"); //DateMidnight formato: "2012-06-28T00:00:00.000-03:00";
{code}
{html}
<table width="20%" align="center">
<tr>
<td>
<img src="http://rodaslivres.files.wordpress.com/2011/04/050-positivo1.jpg" width="200px" heigth="400px"/>
</td>
</tr>
</table>
<tr><td>
<marquee orientation="left"><font face="verdana" style="color:darkgray">thanks ! ! !</font></marquee>
</td></tr>
</table>
{html} |