How to get a list of sprints

Hi,
I am developing a Jira plugin using Java and I need to gather a list of Sprints.
Does anyone know how can I do that?

public class GetSprintsForUI implements ValuesGenerator {
    @Override
    public Map getValues(Map map) {
        try {
            Map<String, String> sprintsMap = new HashMap<String, String>();
            SprintQueryService service = new SprintQueryServiceImpl();
            JqlQueryBuilder queryBuilder = JqlQueryBuilder.newBuilder();
            Query query = queryBuilder.buildQuery();
            ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
            ServiceOutcome serviceOutcome = service.getSprints(user.getDirectoryUser(), null);
            if (serviceOutcome.getValue() != null) {
                for (Sprint sprint : (List<Sprint>) serviceOutcome.getValue()) {
                    sprintsMap.put(String.valueOf(sprint.getId()), sprint.getName());
                }
                return sprintsMap;
            }
        } catch (Exception e) {
            return null;
        }
        return null;
    }
}

This is what I have so far but it doesn’t work, I call this class in the atlassian-plugin.xml:

  <property>
        <key>selectedSpring</key>
        <name>report.issuecreation.projectid.name</name>
        <description>report.issuecreation.projectid.description</description>
        <type>select</type>
        <values class="com.jiraPlugin.utility.GetSprintsForUI"/>
  </property>

And this is the error I get:

Caused by: java.lang.NoSuchMethodError: com.atlassian.greenhopper.service.sprint.SprintQueryServiceImpl.getSprints(Lcom/atlassian/crowd/embedded/api/User;Lcom/atlassian/query/Query;)Lcom/atlassian/greenhopper/service/ServiceOutcome;
	at com.jiraPlugin.utility.GetSprintsForUI.getValues(GetSprintsForUI.java:31) [?:?]
	at com.atlassian.configurable.ValuesGeneratorObjectConfigurationProperty.getInternalValues(ValuesGeneratorObjectConfigurationProperty.java:75) [classes/:?]
	at com.atlassian.configurable.ObjectConfigurationPropertyImpl.entrySet(ObjectConfigurationPropertyImpl.java:266) [classes/:?]
	at com.atlassian.jira.plugin.corereports.web.action.ConfigureReport.mapAndConvertToList(ConfigureReport.java:383) [?:?]
	at com.atlassian.jira.plugin.corereports.web.action.ConfigureReport.access$000(ConfigureReport.java:53) [?:?]
	at com.atlassian.jira.plugin.corereports.web.action.ConfigureReport$ObjectConfigurationField.getValues(ConfigureReport.java:440) [?:?]
	... 387 more

I would be very grateful if someone can help me.
Thank you :smiley:

try {
				
ServiceOutcome<Collection<Sprint>> allSprints = getSprintManager().getAllSprints();
				    sprints = allSprints.getValue();
					pages = sprints.size();
				}
				catch (InvalidSyntaxException e)
				{
					System.out.println("Got an SearchException: " + e.getCause());
				}