Refactor spring-data-neo4j
This commit is contained in:
parent
204ad9586b
commit
99963ee271
|
@ -12,6 +12,7 @@ import java.util.Map;
|
|||
|
||||
@Repository
|
||||
public interface MovieRepository extends GraphRepository<Movie> {
|
||||
|
||||
Movie findByTitle(@Param("title") String title);
|
||||
|
||||
@Query("MATCH (m:Movie) WHERE m.title =~ ('(?i).*'+{title}+'.*') RETURN m")
|
||||
|
|
|
@ -6,5 +6,4 @@ import org.springframework.stereotype.Repository;
|
|||
|
||||
@Repository
|
||||
public interface PersonRepository extends GraphRepository<Person> {
|
||||
|
||||
}
|
||||
|
|
|
@ -12,11 +12,11 @@ import java.util.*;
|
|||
public class MovieService {
|
||||
|
||||
@Autowired
|
||||
MovieRepository movieRepository;
|
||||
private MovieRepository movieRepository;
|
||||
|
||||
private Map<String, Object> toD3Format(Iterator<Map<String, Object>> result) {
|
||||
List<Map<String, Object>> nodes = new ArrayList<Map<String, Object>>();
|
||||
List<Map<String, Object>> rels = new ArrayList<Map<String, Object>>();
|
||||
List<Map<String, Object>> nodes = new ArrayList<>();
|
||||
List<Map<String, Object>> rels = new ArrayList<>();
|
||||
int i = 0;
|
||||
while (result.hasNext()) {
|
||||
Map<String, Object> row = result.next();
|
||||
|
@ -37,7 +37,7 @@ public class MovieService {
|
|||
}
|
||||
|
||||
private Map<String, Object> map(String key1, Object value1, String key2, Object value2) {
|
||||
Map<String, Object> result = new HashMap<String, Object>(2);
|
||||
Map<String, Object> result = new HashMap<>(2);
|
||||
result.put(key1, value1);
|
||||
result.put(key2, value2);
|
||||
return result;
|
||||
|
|
Loading…
Reference in New Issue