Hi Team,
I have couple of versions in my project.
I need to fetch startdate and release date of versions and do some calculations on it.
image2016-11-25 14:52:57.png
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.project.version.VersionManager
def projectKey = issue.getProjectId() //this will give me project_id
i need to fetch versions startdate,versions releasedate by passing project_id.
-----------------
I have done some R&D on how to achieve this,
getAllVersions() //this will give me all the versions present in system
Date getReleaseDate() it will give release date of version
Date getStartDate() it will give start date of version
I am new to groovy,can any one please help me with pseudo code to achieve this.
Thanks in advance,
Thank you Shamith Shankar
I do have another question, i have stored my project's version's startdate in a array list. Now i wanted to sort that list and fetch "Nearest date,smallest date,largest date"
image2016-12-1 12:47:8.png
I want 1-oct-2016 and 29-jun-2015
My code:
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.Project
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.ComponentManager
import java.util.*
projectCount = new ProjectCount(issues)//creating object for this classs
public class ProjectCount {
def issues
def versions
def versionStart
public ProjectCount(issues) {
this.issues = issues
calMetr1(this.issues)
}
public def calMetr1(issues){
versionStart = new ArrayList<Date>()
def project = issues.get(0).getProjectObject()
// get the versions for this project
this.versions = project.getVersions()
//i am storing version startDate in arraylist,my project can contains null vales also
for(version in versions)
{
versionStart.add(version.getStartDate())
}
// i want to sort my list and pick the nearest date from it and display it(though VM template)
//i have tried using versionStart.sort(),versionStart.last() but no luck
}
}
can you please help me with this
Thanks in advance
versionStart.max(),versionStart.min() worked.
Do we have any other way
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Project p =ComponentAccessor.getProjectManager().getProjectObj("long"); Collection<Version> versions=p.getVersions(); for(Version v:versions){ v.getReleaseDate() v.getStartDate() }
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.