@Test void testFinishImportRunUnknown() { assertThrows( UnknownEntityException.class, () -> importRunService.finishImportRun("unknownImportRunId", "message", "importedEntities")); }
void finishImportRun(String importRunId, String message, String importedEntities) { ImportRun importRun = dataService.findOneById(IMPORT_RUN, importRunId, ImportRun.class); if (importRun == null) { throw new UnknownEntityException(IMPORT_RUN, importRunId); } try { importRun.setStatus(ImportStatus.FINISHED.toString()); importRun.setEndDate(now()); importRun.setMessage(message); importRun.setImportedEntities(importedEntities); dataService.update(IMPORT_RUN, importRun); } catch (Exception e) { LOG.error("Error updating run status", e); } if (importRun.getNotify()) createAndSendStatusMail(importRun); }
ImportRunService { void finishImportRun(String importRunId, String message, String importedEntities) { ImportRun importRun = dataService.findOneById(IMPORT_RUN, importRunId, ImportRun.class); if (importRun == null) { throw new UnknownEntityException(IMPORT_RUN, importRunId); } try { importRun.setStatus(ImportStatus.FINISHED.toString()); importRun.setEndDate(now()); importRun.setMessage(message); importRun.setImportedEntities(importedEntities); dataService.update(IMPORT_RUN, importRun); } catch (Exception e) { LOG.error("Error updating run status", e); } if (importRun.getNotify()) createAndSendStatusMail(importRun); } }
ImportRunService { void finishImportRun(String importRunId, String message, String importedEntities) { ImportRun importRun = dataService.findOneById(IMPORT_RUN, importRunId, ImportRun.class); if (importRun == null) { throw new UnknownEntityException(IMPORT_RUN, importRunId); } try { importRun.setStatus(ImportStatus.FINISHED.toString()); importRun.setEndDate(now()); importRun.setMessage(message); importRun.setImportedEntities(importedEntities); dataService.update(IMPORT_RUN, importRun); } catch (Exception e) { LOG.error("Error updating run status", e); } if (importRun.getNotify()) createAndSendStatusMail(importRun); } ImportRunService(
      DataService dataService,
      MailSender mailSender,
      UserService userService,
      ContextMessageSource contextMessageSource,
      ImportRunFactory importRunFactory); }
ImportRunService { void finishImportRun(String importRunId, String message, String importedEntities) { ImportRun importRun = dataService.findOneById(IMPORT_RUN, importRunId, ImportRun.class); if (importRun == null) { throw new UnknownEntityException(IMPORT_RUN, importRunId); } try { importRun.setStatus(ImportStatus.FINISHED.toString()); importRun.setEndDate(now()); importRun.setMessage(message); importRun.setImportedEntities(importedEntities); dataService.update(IMPORT_RUN, importRun); } catch (Exception e) { LOG.error("Error updating run status", e); } if (importRun.getNotify()) createAndSendStatusMail(importRun); } ImportRunService(
      DataService dataService,
      MailSender mailSender,
      UserService userService,
      ContextMessageSource contextMessageSource,
      ImportRunFactory importRunFactory); ImportRun addImportRun(String userName, boolean notify); }
ImportRunService { void finishImportRun(String importRunId, String message, String importedEntities) { ImportRun importRun = dataService.findOneById(IMPORT_RUN, importRunId, ImportRun.class); if (importRun == null) { throw new UnknownEntityException(IMPORT_RUN, importRunId); } try { importRun.setStatus(ImportStatus.FINISHED.toString()); importRun.setEndDate(now()); importRun.setMessage(message); importRun.setImportedEntities(importedEntities); dataService.update(IMPORT_RUN, importRun); } catch (Exception e) { LOG.error("Error updating run status", e); } if (importRun.getNotify()) createAndSendStatusMail(importRun); } ImportRunService(
      DataService dataService,
      MailSender mailSender,
      UserService userService,
      ContextMessageSource contextMessageSource,
      ImportRunFactory importRunFactory); ImportRun addImportRun(String userName, boolean notify);  }