api/src/main/java/com/epam/pipeline/manager/issue/IssueManager.java
@Transactional(propagation = Propagation.REQUIRED)
    public Issue updateIssue(Long issueId, IssueVO issueVO) {
        validateIssueParameters(issueVO);
        Issue existingIssue = loadIssueAndCheckIfNotClosed(issueId);
        Issue issue = updateIssueObject(existingIssue, issueVO);
        issueDao.updateIssue(issue);

        // Find the attachments that were removed during update and delete them
        HashSet<Attachment> newAttachments = new HashSet<>(issueVO.getAttachments());
        List<Attachment> allAttachments = attachmentDao.loadAttachmentsByIssueId(issueId);
        List<Attachment> toDelete = allAttachments.stream().filter(a -> !newAttachments.contains(a))
            .collect(Collectors.toList());
        attachmentFileManager.deleteAttachments(toDelete);

        // Link new attachments to this issue
        issueVO.getAttachments().forEach(a -> attachmentDao.updateAttachmentIssueId(a.getId(), issueId));

        return issue;
    }
/**
     * Updates an {@link Issue} specified by ID. If issue was closed or doesn't exist an error will be occurred.
     * @param issueId issue ID
     * @param issueVO issue content to update
     * @return updated issue
     */
Updates an  Issue specified by ID. If issue was closed or doesn't exist an error will be occurred.
@param issueId issue ID
@param issueVO issue content to update
@return updated issue
Updates an Issue specified by ID . If issue was closed or doesn ' t exist an error will be occurred . @param issueId issue ID @param issueVO issue content to update @return updated issue
@Transactional(propagation = Propagation.REQUIRED)
    public Issue updateIssue(Long issueId, IssueVO issueVO) {
        validateIssueParameters(issueVO);
        Issue existingIssue = loadIssueAndCheckIfNotClosed(issueId);
        Issue issue = updateIssueObject(existingIssue, issueVO);
        issueDao.updateIssue(issue);
        HashSet<Attachment> newAttachments = new HashSet<>(issueVO.getAttachments());
        List<Attachment> allAttachments = attachmentDao.loadAttachmentsByIssueId(issueId);
        List<Attachment> toDelete = allAttachments.stream().filter(a -> !newAttachments.contains(a))
            .collect(Collectors.toList());
        attachmentFileManager.deleteAttachments(toDelete);
        issueVO.getAttachments().forEach(a -> attachmentDao.updateAttachmentIssueId(a.getId(), issueId));
        return issue;
    }
@ Transactional ( propagation = Propagation . REQUIRED ) public Issue updateIssue ( Long issueId , IssueVO issueVO ) { validateIssueParameters ( issueVO ) ; Issue existingIssue = loadIssueAndCheckIfNotClosed ( issueId ) ; Issue issue = updateIssueObject ( existingIssue , issueVO ) ; issueDao . updateIssue ( issue ) ; HashSet < Attachment > newAttachments = new HashSet < > ( issueVO . getAttachments ( ) ) ; List < Attachment > allAttachments = attachmentDao . loadAttachmentsByIssueId ( issueId ) ; List < Attachment > toDelete = allAttachments . stream ( ) . filter ( a -> ! newAttachments . contains ( a ) ) . collect ( Collectors . toList ( ) ) ; attachmentFileManager . deleteAttachments ( toDelete ) ; issueVO . getAttachments ( ) . forEach ( a -> attachmentDao . updateAttachmentIssueId ( a . getId ( ) , issueId ) ) ; return issue ; }
Updates an {@link Issue} specified by ID.
Updates an { @link Issue } specified by ID .
// Find the attachments that were removed during update and delete them // Link new attachments to this issue