@Test public void setAuditEntrySuccessCatchExceptionTest() { DefaultAuditAccessor auditUtility = new DefaultAuditAccessor(null, null, null, null, null); auditUtility.setAuditEntrySuccess(Collections.singletonList(1L)); }
@Override @Transactional public void setAuditEntrySuccess(Collection<Long> auditEntryIds) { for (Long auditEntryId : auditEntryIds) { try { Optional<AuditEntryEntity> auditEntryEntityOptional = auditEntryRepository.findById(auditEntryId); if (auditEntryEntityOptional.isEmpty()) { logger.error("Could not find the audit entry {} to set the success status.", auditEntryId); } AuditEntryEntity auditEntryEntity = auditEntryEntityOptional.orElse(new AuditEntryEntity()); auditEntryEntity.setStatus(AuditEntryStatus.SUCCESS.toString()); auditEntryEntity.setErrorMessage(null); auditEntryEntity.setErrorStackTrace(null); auditEntryEntity.setTimeLastSent(DateUtils.createCurrentDateTimestamp()); auditEntryRepository.save(auditEntryEntity); } catch (Exception e) { logger.error(e.getMessage(), e); } } }
DefaultAuditAccessor implements AuditAccessor { @Override @Transactional public void setAuditEntrySuccess(Collection<Long> auditEntryIds) { for (Long auditEntryId : auditEntryIds) { try { Optional<AuditEntryEntity> auditEntryEntityOptional = auditEntryRepository.findById(auditEntryId); if (auditEntryEntityOptional.isEmpty()) { logger.error("Could not find the audit entry {} to set the success status.", auditEntryId); } AuditEntryEntity auditEntryEntity = auditEntryEntityOptional.orElse(new AuditEntryEntity()); auditEntryEntity.setStatus(AuditEntryStatus.SUCCESS.toString()); auditEntryEntity.setErrorMessage(null); auditEntryEntity.setErrorStackTrace(null); auditEntryEntity.setTimeLastSent(DateUtils.createCurrentDateTimestamp()); auditEntryRepository.save(auditEntryEntity); } catch (Exception e) { logger.error(e.getMessage(), e); } } } }
DefaultAuditAccessor implements AuditAccessor { @Override @Transactional public void setAuditEntrySuccess(Collection<Long> auditEntryIds) { for (Long auditEntryId : auditEntryIds) { try { Optional<AuditEntryEntity> auditEntryEntityOptional = auditEntryRepository.findById(auditEntryId); if (auditEntryEntityOptional.isEmpty()) { logger.error("Could not find the audit entry {} to set the success status.", auditEntryId); } AuditEntryEntity auditEntryEntity = auditEntryEntityOptional.orElse(new AuditEntryEntity()); auditEntryEntity.setStatus(AuditEntryStatus.SUCCESS.toString()); auditEntryEntity.setErrorMessage(null); auditEntryEntity.setErrorStackTrace(null); auditEntryEntity.setTimeLastSent(DateUtils.createCurrentDateTimestamp()); auditEntryRepository.save(auditEntryEntity); } catch (Exception e) { logger.error(e.getMessage(), e); } } } @Autowired  DefaultAuditAccessor(AuditEntryRepository auditEntryRepository, AuditNotificationRepository auditNotificationRepository, ConfigurationAccessor configurationAccessor,
        DefaultNotificationAccessor notificationAccessor, ContentConverter contentConverter); }
DefaultAuditAccessor implements AuditAccessor { @Override @Transactional public void setAuditEntrySuccess(Collection<Long> auditEntryIds) { for (Long auditEntryId : auditEntryIds) { try { Optional<AuditEntryEntity> auditEntryEntityOptional = auditEntryRepository.findById(auditEntryId); if (auditEntryEntityOptional.isEmpty()) { logger.error("Could not find the audit entry {} to set the success status.", auditEntryId); } AuditEntryEntity auditEntryEntity = auditEntryEntityOptional.orElse(new AuditEntryEntity()); auditEntryEntity.setStatus(AuditEntryStatus.SUCCESS.toString()); auditEntryEntity.setErrorMessage(null); auditEntryEntity.setErrorStackTrace(null); auditEntryEntity.setTimeLastSent(DateUtils.createCurrentDateTimestamp()); auditEntryRepository.save(auditEntryEntity); } catch (Exception e) { logger.error(e.getMessage(), e); } } } @Autowired  DefaultAuditAccessor(AuditEntryRepository auditEntryRepository, AuditNotificationRepository auditNotificationRepository, ConfigurationAccessor configurationAccessor,
        DefaultNotificationAccessor notificationAccessor, ContentConverter contentConverter); @Override Optional<Long> findMatchingAuditId(Long notificationId, UUID commonDistributionId); @Override @Transactional Optional<AuditJobStatusModel> findFirstByJobId(UUID jobId); @Override @Transactional AuditEntryPageModel getPageOfAuditEntries(Integer pageNumber, Integer pageSize, String searchTerm, String sortField, String sortOrder, boolean onlyShowSentNotifications,
        Function<AlertNotificationModel, AuditEntryModel> notificationToAuditEntryConverter); @Override @Transactional Map<Long, Long> createAuditEntry(Map<Long, Long> existingNotificationIdToAuditId, UUID jobId, MessageContentGroup contentGroup); @Override @Transactional void setAuditEntrySuccess(Collection<Long> auditEntryIds); @Override @Transactional void setAuditEntryFailure(Collection<Long> auditEntryIds, String errorMessage, Throwable t); @Override @Transactional AuditEntryModel convertToAuditEntryModelFromNotification(AlertNotificationModel notificationContentEntry); }
DefaultAuditAccessor implements AuditAccessor { @Override @Transactional public void setAuditEntrySuccess(Collection<Long> auditEntryIds) { for (Long auditEntryId : auditEntryIds) { try { Optional<AuditEntryEntity> auditEntryEntityOptional = auditEntryRepository.findById(auditEntryId); if (auditEntryEntityOptional.isEmpty()) { logger.error("Could not find the audit entry {} to set the success status.", auditEntryId); } AuditEntryEntity auditEntryEntity = auditEntryEntityOptional.orElse(new AuditEntryEntity()); auditEntryEntity.setStatus(AuditEntryStatus.SUCCESS.toString()); auditEntryEntity.setErrorMessage(null); auditEntryEntity.setErrorStackTrace(null); auditEntryEntity.setTimeLastSent(DateUtils.createCurrentDateTimestamp()); auditEntryRepository.save(auditEntryEntity); } catch (Exception e) { logger.error(e.getMessage(), e); } } } @Autowired  DefaultAuditAccessor(AuditEntryRepository auditEntryRepository, AuditNotificationRepository auditNotificationRepository, ConfigurationAccessor configurationAccessor,
        DefaultNotificationAccessor notificationAccessor, ContentConverter contentConverter); @Override Optional<Long> findMatchingAuditId(Long notificationId, UUID commonDistributionId); @Override @Transactional Optional<AuditJobStatusModel> findFirstByJobId(UUID jobId); @Override @Transactional AuditEntryPageModel getPageOfAuditEntries(Integer pageNumber, Integer pageSize, String searchTerm, String sortField, String sortOrder, boolean onlyShowSentNotifications,
        Function<AlertNotificationModel, AuditEntryModel> notificationToAuditEntryConverter); @Override @Transactional Map<Long, Long> createAuditEntry(Map<Long, Long> existingNotificationIdToAuditId, UUID jobId, MessageContentGroup contentGroup); @Override @Transactional void setAuditEntrySuccess(Collection<Long> auditEntryIds); @Override @Transactional void setAuditEntryFailure(Collection<Long> auditEntryIds, String errorMessage, Throwable t); @Override @Transactional AuditEntryModel convertToAuditEntryModelFromNotification(AlertNotificationModel notificationContentEntry);  }