It's not the same without you
Join the community to find out what other Atlassian users are discussing, debating and creating.
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,
Project p =ComponentAccessor.getProjectManager().getProjectObj("long"); Collection<Version> versions=p.getVersions(); for(Version v:versions){ v.getReleaseDate() v.getStartDate() }
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
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.
I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...
Connect with like-minded Atlassian users at free events near you!
Find a groupConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.
Start an AUGYou're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.