@Test void iterator() throws IOException { FileUtils.writeLines(file, asList("Name", "whisper", "SCREAM")); Iterator<Entity> it = sortaCsvRepository.iterator(); assertAll( () -> assertTrue(it.hasNext()), () -> assertEquals("whisper", it.next().getString("Name")), () -> assertTrue(it.hasNext()), () -> assertEquals("scream", it.next().getString("Name")), () -> assertFalse(it.hasNext())); }
@Override public Iterator<Entity> iterator() { final AtomicInteger count = new AtomicInteger(0); final Iterator<Entity> iterator = csvRepository.iterator(); return new Iterator<>() { @Override public boolean hasNext() { return iterator.hasNext(); } @Override public Entity next() { Entity entity = iterator.next(); if (isEmpty(entity.getString(ALLOWED_IDENTIFIER))) { DynamicEntity dynamicEntity = new DynamicEntity(getEntityType()); dynamicEntity.set(entity); entity = dynamicEntity; entity.set(ALLOWED_IDENTIFIER, String.valueOf(count.incrementAndGet())); } return entity; } }; }
SortaCsvRepository extends AbstractRepository { @Override public Iterator<Entity> iterator() { final AtomicInteger count = new AtomicInteger(0); final Iterator<Entity> iterator = csvRepository.iterator(); return new Iterator<>() { @Override public boolean hasNext() { return iterator.hasNext(); } @Override public Entity next() { Entity entity = iterator.next(); if (isEmpty(entity.getString(ALLOWED_IDENTIFIER))) { DynamicEntity dynamicEntity = new DynamicEntity(getEntityType()); dynamicEntity.set(entity); entity = dynamicEntity; entity.set(ALLOWED_IDENTIFIER, String.valueOf(count.incrementAndGet())); } return entity; } }; } }
SortaCsvRepository extends AbstractRepository { @Override public Iterator<Entity> iterator() { final AtomicInteger count = new AtomicInteger(0); final Iterator<Entity> iterator = csvRepository.iterator(); return new Iterator<>() { @Override public boolean hasNext() { return iterator.hasNext(); } @Override public Entity next() { Entity entity = iterator.next(); if (isEmpty(entity.getString(ALLOWED_IDENTIFIER))) { DynamicEntity dynamicEntity = new DynamicEntity(getEntityType()); dynamicEntity.set(entity); entity = dynamicEntity; entity.set(ALLOWED_IDENTIFIER, String.valueOf(count.incrementAndGet())); } return entity; } }; } SortaCsvRepository(
      File file, EntityTypeFactory entityTypeFactory, AttributeFactory attrMetaFactory);  SortaCsvRepository(
      String entityTypeId,
      String entityLabel,
      File uploadedFile,
      EntityTypeFactory entityTypeFactory,
      AttributeFactory attrMetaFactory); }
SortaCsvRepository extends AbstractRepository { @Override public Iterator<Entity> iterator() { final AtomicInteger count = new AtomicInteger(0); final Iterator<Entity> iterator = csvRepository.iterator(); return new Iterator<>() { @Override public boolean hasNext() { return iterator.hasNext(); } @Override public Entity next() { Entity entity = iterator.next(); if (isEmpty(entity.getString(ALLOWED_IDENTIFIER))) { DynamicEntity dynamicEntity = new DynamicEntity(getEntityType()); dynamicEntity.set(entity); entity = dynamicEntity; entity.set(ALLOWED_IDENTIFIER, String.valueOf(count.incrementAndGet())); } return entity; } }; } SortaCsvRepository(
      File file, EntityTypeFactory entityTypeFactory, AttributeFactory attrMetaFactory);  SortaCsvRepository(
      String entityTypeId,
      String entityLabel,
      File uploadedFile,
      EntityTypeFactory entityTypeFactory,
      AttributeFactory attrMetaFactory); EntityType getEntityType(); @Override Iterator<Entity> iterator(); @Override Set<RepositoryCapability> getCapabilities(); @Override long count(); }
SortaCsvRepository extends AbstractRepository { @Override public Iterator<Entity> iterator() { final AtomicInteger count = new AtomicInteger(0); final Iterator<Entity> iterator = csvRepository.iterator(); return new Iterator<>() { @Override public boolean hasNext() { return iterator.hasNext(); } @Override public Entity next() { Entity entity = iterator.next(); if (isEmpty(entity.getString(ALLOWED_IDENTIFIER))) { DynamicEntity dynamicEntity = new DynamicEntity(getEntityType()); dynamicEntity.set(entity); entity = dynamicEntity; entity.set(ALLOWED_IDENTIFIER, String.valueOf(count.incrementAndGet())); } return entity; } }; } SortaCsvRepository(
      File file, EntityTypeFactory entityTypeFactory, AttributeFactory attrMetaFactory);  SortaCsvRepository(
      String entityTypeId,
      String entityLabel,
      File uploadedFile,
      EntityTypeFactory entityTypeFactory,
      AttributeFactory attrMetaFactory); EntityType getEntityType(); @Override Iterator<Entity> iterator(); @Override Set<RepositoryCapability> getCapabilities(); @Override long count(); static final String ALLOWED_IDENTIFIER; }