Search in sources :

Example 1 with RepositoryQuery

use of org.eclipse.mylyn.internal.tasks.core.RepositoryQuery in project linuxtools by eclipse.

the class OSIORestHarness method getTaskIdWithSummary.

private String getTaskIdWithSummary(String summary) throws OSIORestException, CoreException {
    String taskID = null;
    String queryUrlString = repository().getRepositoryUrl() + "/bug?" + "short_desc=" + summary;
    RepositoryQuery query = new RepositoryQuery(repository().getConnectorKind(), "handle-testQueryViaConnector");
    query.setUrl(queryUrlString);
    final Map<Integer, TaskData> changedTaskData = new HashMap<Integer, TaskData>();
    TaskDataCollector collector = new TaskDataCollector() {

        @Override
        public void accept(TaskData taskData) {
            changedTaskData.put(Integer.valueOf(taskData.getTaskId()), taskData);
        }
    };
    connector().performQuery(repository(), query, collector, null, new NullProgressMonitor());
    if (changedTaskData.size() > 0) {
        Set<Integer> ks = changedTaskData.keySet();
        SortedSet<Integer> sks = new TreeSet<Integer>(ks);
        taskID = sks.last().toString();
    } else {
        final TaskMapping taskMappingInit = new TaskMapping() {

            @Override
            public String getSummary() {
                return summary;
            }

            @Override
            public String getDescription() {
                return "The Description";
            }

            @Override
            public String getProduct() {
                return "ManualTest";
            }

            @Override
            public String getComponent() {
                return "ManualC1";
            }

            @Override
            public String getVersion() {
                return "R1";
            }
        };
        taskID = getNewTaksIdFromInitMapping(taskMappingInit, taskInitializationData);
    }
    return taskID;
}
Also used : SingleTaskDataCollector(org.eclipse.linuxtools.internal.mylyn.osio.rest.core.response.data.SingleTaskDataCollector) TaskDataCollector(org.eclipse.mylyn.tasks.core.data.TaskDataCollector) RepositoryQuery(org.eclipse.mylyn.internal.tasks.core.RepositoryQuery) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) HashMap(java.util.HashMap) TreeSet(java.util.TreeSet) ITaskMapping(org.eclipse.mylyn.tasks.core.ITaskMapping) TaskMapping(org.eclipse.mylyn.tasks.core.TaskMapping) TaskData(org.eclipse.mylyn.tasks.core.data.TaskData)

Example 2 with RepositoryQuery

use of org.eclipse.mylyn.internal.tasks.core.RepositoryQuery in project eclipse-integration-commons by spring-projects.

the class IdeUiUtils method getQuery.

private static IRepositoryQuery getQuery(String queryLabel) {
    TaskList taskList = TasksUiPlugin.getTaskList();
    Set<RepositoryQuery> queries = taskList.getQueries();
    for (RepositoryQuery query : queries) {
        if (queryLabel.equals(query.getSummary())) {
            // query already exists
            return query;
        }
    }
    return null;
}
Also used : RepositoryQuery(org.eclipse.mylyn.internal.tasks.core.RepositoryQuery) IRepositoryQuery(org.eclipse.mylyn.tasks.core.IRepositoryQuery) TaskList(org.eclipse.mylyn.internal.tasks.core.TaskList)

Aggregations

RepositoryQuery (org.eclipse.mylyn.internal.tasks.core.RepositoryQuery)2 HashMap (java.util.HashMap)1 TreeSet (java.util.TreeSet)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 SingleTaskDataCollector (org.eclipse.linuxtools.internal.mylyn.osio.rest.core.response.data.SingleTaskDataCollector)1 TaskList (org.eclipse.mylyn.internal.tasks.core.TaskList)1 IRepositoryQuery (org.eclipse.mylyn.tasks.core.IRepositoryQuery)1 ITaskMapping (org.eclipse.mylyn.tasks.core.ITaskMapping)1 TaskMapping (org.eclipse.mylyn.tasks.core.TaskMapping)1 TaskData (org.eclipse.mylyn.tasks.core.data.TaskData)1 TaskDataCollector (org.eclipse.mylyn.tasks.core.data.TaskDataCollector)1