@Test public void shouldRemoveAttachmentInfoFromModel_SetNullAsMongoId() { tested.removeAttachmentInfoFromMaps(modelRepository, MONGO_ID); models.forEach(map -> Assert.assertNull(map.getAttachmentMongoId())); }
protected void removeAttachmentInfoFromMaps(@NonNull final ModelRepository modelRepository, @NonNull final String mongoId) { final List<Model> models = modelRepository.findAllByAttachmentMongoId(mongoId); models.stream().forEach(model -> { model.setAttachmentFileName(null); model.setAttachmentMongoId(null); }); modelRepository.save(models); }
ModelAttachmentService extends SingleAttachmentService implements ISingleAttachmentService { protected void removeAttachmentInfoFromMaps(@NonNull final ModelRepository modelRepository, @NonNull final String mongoId) { final List<Model> models = modelRepository.findAllByAttachmentMongoId(mongoId); models.stream().forEach(model -> { model.setAttachmentFileName(null); model.setAttachmentMongoId(null); }); modelRepository.save(models); } }
ModelAttachmentService extends SingleAttachmentService implements ISingleAttachmentService { protected void removeAttachmentInfoFromMaps(@NonNull final ModelRepository modelRepository, @NonNull final String mongoId) { final List<Model> models = modelRepository.findAllByAttachmentMongoId(mongoId); models.stream().forEach(model -> { model.setAttachmentFileName(null); model.setAttachmentMongoId(null); }); modelRepository.save(models); } ModelAttachmentService(final FileRepository fileRepository,
                                  @NonNull final ModelRepository modelRepository); }
ModelAttachmentService extends SingleAttachmentService implements ISingleAttachmentService { protected void removeAttachmentInfoFromMaps(@NonNull final ModelRepository modelRepository, @NonNull final String mongoId) { final List<Model> models = modelRepository.findAllByAttachmentMongoId(mongoId); models.stream().forEach(model -> { model.setAttachmentFileName(null); model.setAttachmentMongoId(null); }); modelRepository.save(models); } ModelAttachmentService(final FileRepository fileRepository,
                                  @NonNull final ModelRepository modelRepository); void deleteFile(@NonNull final String fileId); }
ModelAttachmentService extends SingleAttachmentService implements ISingleAttachmentService { protected void removeAttachmentInfoFromMaps(@NonNull final ModelRepository modelRepository, @NonNull final String mongoId) { final List<Model> models = modelRepository.findAllByAttachmentMongoId(mongoId); models.stream().forEach(model -> { model.setAttachmentFileName(null); model.setAttachmentMongoId(null); }); modelRepository.save(models); } ModelAttachmentService(final FileRepository fileRepository,
                                  @NonNull final ModelRepository modelRepository); void deleteFile(@NonNull final String fileId);  }