com.synopsys.integration.jira.common.model.request.page.IssueSearchPageResponseHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of int-jira-common Show documentation
Show all versions of int-jira-common Show documentation
A library for using various capabilities of Jira.
/*
* int-jira-common
*
* Copyright (c) 2024 Synopsys, Inc.
*
* Use subject to the terms and conditions of the Synopsys End User Software License and Maintenance Agreement. All rights reserved worldwide.
*/
package com.synopsys.integration.jira.common.model.request.page;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import com.synopsys.integration.jira.common.cloud.model.IssueSearchResponseModel;
import com.synopsys.integration.jira.common.rest.JiraCloudPageRequestHandler;
import com.synopsys.integration.log.IntLogger;
import com.synopsys.integration.rest.component.IntRestResponse;
public class IssueSearchPageResponseHandler extends JiraCloudPageRequestHandler {
public IssueSearchPageResponseHandler(IntLogger logger) {
super(logger);
}
@Override
public R combineResponses(Collection pagedResponses) {
if (null == pagedResponses || pagedResponses.isEmpty()) {
return (R) createEmpty();
}
IssueSearchResponseModel unifiedIssueSearchResponse = null;
for (R response : pagedResponses) {
IssueSearchResponseModel issueSearchResponse = (IssueSearchResponseModel) response;
if (null == unifiedIssueSearchResponse) {
unifiedIssueSearchResponse = new IssueSearchResponseModel();
unifiedIssueSearchResponse.setExpand(issueSearchResponse.getExpand());
unifiedIssueSearchResponse.setNames(issueSearchResponse.getNames());
unifiedIssueSearchResponse.setSchema(issueSearchResponse.getSchema());
unifiedIssueSearchResponse.setIssues(new LinkedList<>());
unifiedIssueSearchResponse.setWarningMessages(new LinkedList<>());
}
unifiedIssueSearchResponse.getIssues().addAll(issueSearchResponse.getIssues());
unifiedIssueSearchResponse.getWarningMessages().addAll(issueSearchResponse.getWarningMessages());
}
return (R) unifiedIssueSearchResponse;
}
private IssueSearchResponseModel createEmpty() {
IssueSearchResponseModel issueSearchResponse = new IssueSearchResponseModel();
issueSearchResponse.setIssues(Collections.emptyList());
issueSearchResponse.setWarningMessages(Collections.emptyList());
return issueSearchResponse;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy