• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SearchResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.atlassian.jira.rest.client.api.domain.SearchResult的典型用法代码示例。如果您正苦于以下问题:Java SearchResult类的具体用法?Java SearchResult怎么用?Java SearchResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SearchResult类属于com.atlassian.jira.rest.client.api.domain包,在下文中一共展示了SearchResult类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getRecentIssues

import com.atlassian.jira.rest.client.api.domain.SearchResult; //导入依赖的package包/类
@Override
public Pageable<IssueDTO> getRecentIssues() {
    final Counter page = new Counter(PAGE_SIZE);

    String date =
            collectorStatusService.getLastExecutionDate()
                    .toDateTime(DateTimeZone.forTimeZone(jiraTimeZone))
                    .toString("yyyy-MM-dd HH:mm");
    String query = String.format(ISSUES_QUERY_PATTERN,
            date,
            issueTypes);

    LOGGER.info("-> Running Jira Query: {}", query);

    return (() -> {

        Promise<SearchResult> results = client.searchJql(query,PAGE_SIZE,page.inc(),null);

        return StreamSupport.stream(results.claim().getIssues().spliterator(),false)
                .map(utils::map).collect(Collectors.toList());
    });
}
 
开发者ID:BBVA,项目名称:mirrorgate-jira-stories-collector,代码行数:23,代码来源:JiraIssuesServiceImpl.java


示例2: getTicket

import com.atlassian.jira.rest.client.api.domain.SearchResult; //导入依赖的package包/类
private Optional<Ticket> getTicket(String id, ExternalSystem details, JiraRestClient jiraRestClient) {
    SearchResult issues = findIssue(id, jiraRestClient);
    if (issues.getTotal() > 0) {
        Issue issue = jiraRestClient.getIssueClient().getIssue(id).claim();
        return Optional.of(JIRATicketUtils.toTicket(issue, details));
    } else {
        return Optional.empty();
    }
}
 
开发者ID:reportportal,项目名称:service-jira,代码行数:10,代码来源:JiraStrategy.java


示例3: getById

import com.atlassian.jira.rest.client.api.domain.SearchResult; //导入依赖的package包/类
@Override
public Pageable<IssueDTO> getById(List<Long> ids) {
    final StringBuilder sb = new StringBuilder(200);
    final Counter counter = new Counter();

    return (() -> {
        int firstItem = counter.get();
        if(counter.get() >= ids.size()) {
            return new ArrayList<>();
        }
        for(int i = 0; i < PAGE_SIZE && counter.get() < ids.size(); counter.inc(), i++) {
            if(i > 0) {
                sb.append(',');
            }
            sb.append(ids.get(counter.get()));
        }
        String query = String.format(ISSUES_BY_ID_QUERY_PATTERN, sb.toString());
        sb.delete(0,sb.length());

        LOGGER.info("-> Running Jira Query: {}", query);
        try {
            Promise<SearchResult> results = client.searchJql(query);
            return StreamSupport.stream(results.claim().getIssues().spliterator(),false)
                    .map(utils::map).collect(Collectors.toList());
        }  catch (RestClientException e) {
            LOGGER.warn("Exception", e);
            int statusCode = e.getStatusCode().isPresent() ? e.getStatusCode().get() : 0;
            if (statusCode == 401 ) {
                LOGGER.error("Error 401 connecting to JIRA server, your credentials are probably wrong. Note: Ensure you are using JIRA user name not your email address.");
                throw e;
            } else if(statusCode == 400) {
                if(ids.size() == 1) {
                    return new ArrayList<>();
                } else {
                    LOGGER.warn("Error 400 - Some issues where not found {}, keep on", ids);
                    LOGGER.warn(e.getMessage());
                    //Falling back to per issue invocation if one was not found... Why Jira o why...
                    List<IssueDTO> result = new ArrayList<>(PAGE_SIZE);
                    for (int i = firstItem; i < counter.get(); i++) {
                        result.addAll(getById(Arrays.asList(ids.get(i))).nextPage());
                    }
                    return result;
                }
            } else {
                LOGGER.error("No result was available from Jira unexpectedly - defaulting to blank response. The reason for this fault is the following:" + e.getCause());
                throw e;
            }
        }
    });

}
 
开发者ID:BBVA,项目名称:mirrorgate-jira-stories-collector,代码行数:52,代码来源:JiraIssuesServiceImpl.java


示例4: findIssue

import com.atlassian.jira.rest.client.api.domain.SearchResult; //导入依赖的package包/类
private SearchResult findIssue(String id, JiraRestClient jiraRestClient) {
    return jiraRestClient.getSearchClient().searchJql("issue = " + id).claim();
}
 
开发者ID:reportportal,项目名称:service-jira,代码行数:4,代码来源:JiraStrategy.java


示例5: fetchIssues

import com.atlassian.jira.rest.client.api.domain.SearchResult; //导入依赖的package包/类
private Collection<Issue> fetchIssues(IssueTracker issueTracker) throws IOException {
	Collection<Issue> issues = new HashSet<Issue>();

	JiraURLParser.ParseResult parseResult = new JiraURLParser().parse(issueTracker.getUri());

	final JiraRestClient restClient = factory.create(parseResult.getBaseURI(),
			new AnonymousAuthenticationHandler());
	final String jqlSearchString = "project=" + parseResult.getProjectKey();
	int exceptionsOccurred = 0;

	Promise<SearchResult> issuePromise = null;
       int sizeBefore;

	do {
           if (exceptionsOccurred > 0) {
               logger.debug("Restarted after " + exceptionsOccurred + " exceptions");
           }

           sizeBefore = issues.size();

		try {
			issuePromise = restClient.getSearchClient().searchJql(jqlSearchString,
                       numberOfIssuesFetchedAtOnce, issues.size(), null);

               logger.debug("About to fetch issues");
			Iterables.addAll(issues, issuePromise.claim().getIssues());
               logger.debug("Sucessfully fetched " + issues.size() + " issues in total");

		} catch (Exception e) {
			if (exceptionsOccurred > maximumNumberOfExceptionsBeforeTermination) {
                   logger.debug("Exception occurred multiple times");
				throw e;
			} else {
                   logger.debug("Exception occurred for the " + (exceptionsOccurred + 1) + " time");
				exceptionsOccurred++;
				continue;
			}
		}

		exceptionsOccurred = 0;

	} while (issues.size() > sizeBefore || exceptionsOccurred > 0);

	restClient.close();

	return issues;
}
 
开发者ID:bugminer,项目名称:bugminer,代码行数:48,代码来源:JiraIssueTrackerStrategy.java


示例6: testFetch

import com.atlassian.jira.rest.client.api.domain.SearchResult; //导入依赖的package包/类
@Test
public void testFetch() throws IOException {

	JiraRestClient client = mock(JiraRestClient.class);
	SearchRestClient searchClient = mock(SearchRestClient.class);
	SearchResult searchResult = mock(SearchResult.class);

	when(factory.create(eq(URI.create(API_URL)),
			org.mockito.Matchers.isA(AnonymousAuthenticationHandler.class)))
			.thenReturn(client);
	when(client.getSearchClient()).thenReturn(searchClient);
	when(searchClient.searchJql(eq("project=" + issueTracker.getProject().getName()),
			org.mockito.Matchers.isA(Integer.class),
			org.mockito.Matchers.isA(Integer.class),
			anySetOf(String.class))).thenReturn(promise);
	when(promise.claim()).thenReturn(searchResult);
	when(searchResult.getIssues()).thenReturn(issues).thenReturn(new HashSet<Issue>());

	IssueType type = mock(IssueType.class);
	when(issue1.getIssueType()).thenReturn(type);
	when(type.getName()).thenReturn("Bug");

	Status status = mock(Status.class);
	when(issue1.getStatus()).thenReturn(status);
	when(status.getName()).thenReturn("Closed");

	when(issue1.getSummary()).thenReturn("Bug #1337");

	IssueField resolutionDate = mock(IssueField.class);
	when(issue1.getField(eq("resolutiondate"))).thenReturn(resolutionDate);
	when(resolutionDate.getValue()).thenReturn(BUG_RESOLUTION_DATE);

	when(issue1.getCreationDate()).thenReturn(BUG_REPORT_TIME);
	when(issue1.getLabels()).thenReturn(new HashSet<String>()); // TODO
	when(issue1.getDescription()).thenReturn(BUG_DESCRIPTION);

	Resolution resolution = mock(Resolution.class);
	when(issue1.getResolution()).thenReturn(resolution);
	when(resolution.getName()).thenReturn("Done");

	Collection<Bug> result = strategy.fetch(issueTracker);

	assertThat(result.size(), is(1));

	Bug bug = result.iterator().next();

	assertThat(bug.getTitle(), is("Bug #1337"));
	assertThat(bug.getReportTime(), is(Instant.ofEpochMilli(BUG_REPORT_TIME.getMillis())));
	assertThat(bug.isFixed(), is(true));
	assertThat(bug.getDescription(), is(BUG_DESCRIPTION));
	assertThat(bug.getProject().getName(), is(issueTracker.getProject().getName()));
	assertThat(bug.getIssueTracker().getUri(), is(issueTracker.getUri()));
}
 
开发者ID:bugminer,项目名称:bugminer,代码行数:54,代码来源:JiraIssueTrackerStrategyTest.java


示例7: extractGeneralMeasures

import com.atlassian.jira.rest.client.api.domain.SearchResult; //导入依赖的package包/类
/**
	 * @param correctExecution
	 * @param restClient
	 * @param searchClient
	 * @param stats
	 * @return
	 */
	private void extractGeneralMeasures(JiraRestClient restClient, SearchRestClient searchClient, JiraLogStatistics stats) {
//		double numberOfClosedFeatureRequestsPerUpdate;
//		double numberOfClosedBugsPerUpdate;
		String jql;
		SearchResult results;
		// Number of Versions
		ProjectRestClient projectClient = restClient.getProjectClient();
		Project project;
		int countOfVersions = 0;

		Iterable<BasicProject> basicProjects = projectClient.getAllProjects().claim();
		for (BasicProject basicP : basicProjects) {

			project = projectClient.getProject(basicP.getKey()).claim();
			for (Version ver : project.getVersions()) {
				countOfVersions++;
			}
		}

		jql = "issuetype = Bug AND status in (Closed, Resolved)";
		results = searchClient.searchJql(jql).claim();
		stats.numberOfClosedBugsPerUpdate = (double) results.getTotal() / (double) countOfVersions;

		jql = "issuetype = \"New Feature\" AND status in (Closed, Resolved)";
		results = searchClient.searchJql(jql).claim();
		stats.numberOfClosedFeatureRequestsPerUpdate = (double) results.getTotal() / (double) countOfVersions;

//		stats.openBugs = numberOfOpenBugs;
		stats.timeToResolveABug = stats.totalBugFixTime / stats.counterCloseBugs;
		stats.timeToResolveABlockingOrCriticalBug = stats.totalCriticalBugFixTime / stats.counterCriticalBugs;
		stats.numberOfFeatureRequests = stats.numberOfFeatureRequests;
		stats.numberOfOpenFeatureRequests = stats.numberOfOpenFeatureRequests;

		stats.numberOfSecurityBugs = (int) (stats.totalBugs * security_factor);
		if (stats.counterCloseBugs > 0) { //TODO: check why this should express security bugs!
			stats.presenceOfBugsCorrected = true; //TODO: check: was presenceOfSecurityBugsCorrected before!??
		}
		if (stats.counterSecurityBugs > 0) {
			stats.timeToResolveASecurityBug = stats.totalSecurityBugFixTime / stats.counterSecurityBugs;
		}
			
//		return stats;
	}
 
开发者ID:RISCOSS,项目名称:riscoss-data-collector,代码行数:51,代码来源:RDCJira.java


示例8: extractGeneralMeasures

import com.atlassian.jira.rest.client.api.domain.SearchResult; //导入依赖的package包/类
/**

     * @param restClient
     * @param searchClient
     * @param stats
     * @return
     */
    private void extractGeneralMeasures(JiraRestClient restClient, SearchRestClient searchClient,
            JiraLogStatistics stats)
    {
//	double numberOfClosedFeatureRequestsPerUpdate;
//	double numberOfClosedBugsPerUpdate;
        String jql;
        SearchResult results;
        // Number of Versions
        ProjectRestClient projectClient = restClient.getProjectClient();
        Project project;
        int countOfVersions = 0;
//	int totalBugs = 0;
//	int numberOfOpenBugs = 0;
//	double totalCriticalBugFixTime = 0;
//	int counterCriticalBugs = 0;
//	double totalBugFixTime = 0;
//	double totalSecurityBugFixTime = 0;
//	int counterSecurityBugs = 0;
//	int counterCloseBugs = 0;
//	int numberOfFeatureRequests = 0;
//	int numberOfOpenFeatureRequests = 0;
//	boolean presenceOfSecurityBugsCorrected = false;

        Iterable<BasicProject> basicProjects = projectClient.getAllProjects().claim();
        for (BasicProject basicP : basicProjects) {

            project = projectClient.getProject(basicP.getKey()).claim();
            for (Version ver : project.getVersions()) {
                countOfVersions++;
            }
        }

        jql = "issuetype = Bug AND status in (Closed, Resolved)";
        results = searchClient.searchJql(jql).claim();
        stats.numberOfClosedBugsPerUpdate = (double) results.getTotal() / (double) countOfVersions;

        jql = "issuetype = \"New Feature\" AND status in (Closed, Resolved)";
        results = searchClient.searchJql(jql).claim();
        stats.numberOfClosedFeatureRequestsPerUpdate = (double) results.getTotal() / (double) countOfVersions;

//	stats.openBugs = numberOfOpenBugs;
        stats.timeToResolveABug = stats.totalBugFixTime / stats.counterCloseBugs;
        stats.timeToResolveABlockingOrCriticalBug = stats.totalCriticalBugFixTime / stats.counterCriticalBugs;
        stats.numberOfFeatureRequests = stats.numberOfFeatureRequests;
        stats.numberOfOpenFeatureRequests = stats.numberOfOpenFeatureRequests;

        stats.numberOfSecurityBugs = (int) (stats.totalBugs * security_factor);
        if (stats.counterCloseBugs > 0) { //TODO: check why this should express security bugs!
            stats.presenceOfBugsCorrected = true; //TODO: check: was presenceOfSecurityBugsCorrected before!??
        }
        if (stats.counterSecurityBugs > 0) {
            stats.timeToResolveASecurityBug = stats.totalSecurityBugFixTime / stats.counterSecurityBugs;
        }

//	return stats;
    }
 
开发者ID:rbenjacob,项目名称:riscoss-platform,代码行数:64,代码来源:JiraRiskDataCollector.java



注:本文中的com.atlassian.jira.rest.client.api.domain.SearchResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TorConfigProxy类代码示例发布时间:2022-05-23
下一篇:
Java StreamingAttachmentFeature类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap