@@ -181,8 +181,10 @@ protected Ticket invokeCommand(Integration integration, Map<String, Object> para
181181 linkIssues (client , issue , linkedIssue );
182182 }
183183
184- return getTicket (issueKey , integration .getParams (), client )
185- .orElse (null );
184+ return JIRATicketUtils .toTicket (issue ,
185+ CloudJiraProperties .URL .getParam (integration .getParams ())
186+ .orElseThrow (() -> new ReportPortalException (UNABLE_INTERACT_WITH_INTEGRATION ,
187+ "Url is not specified." )));
186188
187189 } catch (ReportPortalException e ) {
188190 throw e ;
@@ -222,21 +224,6 @@ private Map<String, String> findBinaryData(IssueUpdateDetails issueInput) {
222224 return binary ;
223225 }
224226
225- private Optional <Ticket > getTicket (String id , IntegrationParams details , JiraRestClient jiraRestClient ) {
226- SearchResults issues = findIssue (id , jiraRestClient );
227- if (issues .getTotal () > 0 ) {
228- IssueBean issue = jiraRestClient .issuesApi ().getIssue (id , null , false , null , null , false , false );
229- return Optional .of (JIRATicketUtils .toTicket (issue , CloudJiraProperties .URL .getParam (details )
230- .orElseThrow (() -> new ReportPortalException (UNABLE_INTERACT_WITH_INTEGRATION , "Url is not specified." ))));
231- } else {
232- return Optional .empty ();
233- }
234- }
235-
236- private SearchResults findIssue (String id , JiraRestClient jiraRestClient ) {
237- return jiraRestClient .issueSearchApi ().searchForIssuesUsingJql ("issue = " + id , null , 50 , "" , null , null , null , null , null );
238- }
239-
240227 private void linkIssues (JiraRestClient jiraRestClient , IssueBean issue , PostFormField field ) {
241228 String value = CollectionUtils .isNotEmpty (field .getValue ()) ? field .getValue ().get (0 ) : "" ;
242229 if (StringUtils .isNotEmpty (value )) {
0 commit comments