api/src/main/java/com/epam/pipeline/manager/issue/IssueManager.java
public Issue loadIssue(Long id) {
        Issue issue = issueDao.loadIssue(id).orElseThrow(getIssueNotFoundException(id));
        issue.setComments(commentDao.loadCommentsForIssue(id));

        issue.setAttachments(attachmentDao.loadAttachmentsByIssueId(id));
        Map<Long, List<Attachment>> attachmentMap = attachmentDao.loadAttachmentsByCommentIds(
            issue.getComments().stream().map(IssueComment::getId).collect(Collectors.toList()));
        issue.getComments().forEach(c -> c.setAttachments(attachmentMap.get(c.getId())));

        return issue;
    }
/**
     * Loads an {@link Issue} specified by ID. If issue doesn't exist exception will be thrown.
     * @param id issue's ID
     * @return issue with comments that belong to it
     */
Loads an  Issue specified by ID. If issue doesn't exist exception will be thrown.
@param id issue's ID
@return issue with comments that belong to it
Loads an Issue specified by ID . If issue doesn ' t exist exception will be thrown . @param id issue ' s ID @return issue with comments that belong to it
public Issue loadIssue(Long id) {
        Issue issue = issueDao.loadIssue(id).orElseThrow(getIssueNotFoundException(id));
        issue.setComments(commentDao.loadCommentsForIssue(id));
        issue.setAttachments(attachmentDao.loadAttachmentsByIssueId(id));
        Map<Long, List<Attachment>> attachmentMap = attachmentDao.loadAttachmentsByCommentIds(
            issue.getComments().stream().map(IssueComment::getId).collect(Collectors.toList()));
        issue.getComments().forEach(c -> c.setAttachments(attachmentMap.get(c.getId())));
        return issue;
    }
public Issue loadIssue ( Long id ) { Issue issue = issueDao . loadIssue ( id ) . orElseThrow ( getIssueNotFoundException ( id ) ) ; issue . setComments ( commentDao . loadCommentsForIssue ( id ) ) ; issue . setAttachments ( attachmentDao . loadAttachmentsByIssueId ( id ) ) ; Map < Long , List < Attachment > > attachmentMap = attachmentDao . loadAttachmentsByCommentIds ( issue . getComments ( ) . stream ( ) . map ( IssueComment :: getId ) . collect ( Collectors . toList ( ) ) ) ; issue . getComments ( ) . forEach ( c -> c . setAttachments ( attachmentMap . get ( c . getId ( ) ) ) ) ; return issue ; }
Loads an {@link Issue} specified by ID.
Loads an { @link Issue } specified by ID .