List of usage examples for org.springframework.data.jpa.repository JpaRepository getOne
T getOne(ID id);
From source file:com.nestedbird.modules.formparser.FormParse.java
/** * Parses a comma separated value of database indexes. * Retrieves all the items from the database and adds them to an array to save them to the object * * @param value CSV of indexes * @param repositoryClass repository of entities * @return array of entities/* www.j a v a 2s . c o m*/ */ private Collection<BaseEntity> parseCSVDatabaseIndexes(final String value, final Class repositoryClass) { final Set<BaseEntity> elements = new HashSet<>(); final JpaRepository repository = getFieldRepository(repositoryClass); Arrays.stream(value.split(",")).distinct().filter(Objects::nonNull).filter(UUIDConverter::isUUID) .forEach(id -> elements.add((BaseEntity) repository.getOne(id))); return elements; }