protected static List < FeatureIssueLink > getIssueLinks ( JSONArray issueLinkArray ) { if ( issueLinkArray == null ) { return Collections . EMPTY_LIST ; } List < FeatureIssueLink > jiraIssueLinks = new ArrayList <> ( ) ; issueLinkArray . forEach ( issueLink -> { JSONObject outward = ( JSONObject ) ( ( JSONObject ) issueLink ) . get ( "outwardIssue" ) ; JSONObject inward = ( JSONObject ) ( ( JSONObject ) issueLink ) . get ( "inwardIssue" ) ; JSONObject type = ( JSONObject ) ( ( JSONObject ) issueLink ) . get ( "type" ) ; String targetKey = "" ; String direction = "" ; String name = "" ; String description = "" ; String targetUrl = "" ; if ( outward != null ) { targetKey = getString ( outward , "key" ) ; direction = "OUTBOUND" ; name = getString ( type , "name" ) ; description = getString ( type , "outward" ) ; targetUrl = getString ( outward , "self" ) ; } else if ( inward != null ) { targetKey = getString ( inward , "key" ) ; direction = "INBOUND" ; name = getString ( type , "name" ) ; description = getString ( type , "inward" ) ; targetUrl = getString ( inward , "self" ) ; } FeatureIssueLink jiraIssueLink = new FeatureIssueLink ( ) ; // story number of the linked issue jiraIssueLink . setTargetIssueKey ( targetKey ) ; // name of the linked issue jiraIssueLink . setIssueLinkName ( name ) ; // type of the linked issue jiraIssueLink . setIssueLinkType ( description ) ; // direction of the linked issue (inbount/outbound) jiraIssueLink . setIssueLinkDirection ( direction ) ; // uri of the linked issue jiraIssueLink . setTargetIssueUri ( targetUrl ) ; jiraIssueLinks . add ( jiraIssueLink ) ; } ) ; return jiraIssueLinks ; }
Get Array of issuesLinks