Skip to content

Commit 741e4ec

Browse files
committed
some layout changes, populating with an initial import
1 parent 27a8711 commit 741e4ec

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

src/main/java/org/neo4j/movies/service/DatabasePopulator.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
import org.neo4j.kernel.AbstractGraphDatabase;
44
import org.neo4j.movies.domain.*;
5+
import org.neo4j.movies.movieimport.MovieDbImportService;
56
import org.slf4j.Logger;
67
import org.slf4j.LoggerFactory;
78
import org.springframework.beans.factory.annotation.Autowired;
89
import org.springframework.data.graph.neo4j.support.GraphDatabaseContext;
910
import org.springframework.stereotype.Service;
1011
import org.springframework.transaction.annotation.Transactional;
1112

13+
import java.util.ArrayList;
14+
import java.util.Collection;
1215
import java.util.List;
1316

1417
import static java.util.Arrays.asList;
@@ -24,22 +27,25 @@ public class DatabasePopulator {
2427
GraphDatabaseContext ctx;
2528
@Autowired
2629
MoviesRepository repository;
30+
31+
@Autowired
32+
MovieDbImportService importService;
2733
private final static Logger log = LoggerFactory.getLogger(DatabasePopulator.class);
2834

2935
@Transactional
3036
public List<Movie> populateDatabase() {
31-
/*
32-
Person tomHanks = new Person("1", "Tom Hanks").persist();
33-
Movie forestGump = new Movie("1", "Forrest Gump").persist();
34-
tomHanks.playedIn(forestGump,"Forrest");
35-
*/
3637
User me = new User("micha", "Micha", "password", User.Roles.ROLE_ADMIN,User.Roles.ROLE_USER).persist();
37-
//Rating awesome = me.rate(forestGump, 5, "Awesome");
38-
3938
User ollie = new User("ollie", "Olliver", "password",User.Roles.ROLE_USER).persist();
40-
//ollie.rate(forestGump, 2, "ok");
4139
me.addFriend(ollie);
42-
return asList();
40+
List<Integer> ids = asList(19995, 194, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 13, 20526, 11, 1893, 1892, 1894, 168, 193, 200, 157, 152, 201, 154, 12155, 58, 285, 118, 22, 392, 5255, 568, 9800, 497, 101, 120, 121, 122);
41+
List<Movie> result=new ArrayList<Movie>(ids.size());
42+
for (Integer id : ids) {
43+
result.add(importService.importMovie(String.valueOf(id)));
44+
}
45+
46+
me.rate(repository.getMovie("13"),5,"Inspiring");
47+
me.rate(repository.getMovie("603"),5,"Best of the series");
48+
return result;
4349
}
4450

4551
@Transactional

src/main/webapp/WEB-INF/applicatioContext-security.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@
2121
<security:logout logout-url="/auth/logout" logout-success-url="/" invalidate-session="true"/>
2222
</security:http>
2323

24-
<!--
25-
Usernames/Passwords are
26-
rod/koala
27-
dianne/emu
28-
scott/wombat
29-
peter/opal
30-
-->
3124
<security:authentication-manager>
3225
<security:authentication-provider user-service-ref="userDetailsService">
3326
<security:password-encoder hash="md5">
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div id="footer">
2-
This site is running on SpringFramework relying on Spring Data Graph powered by the Neo4j graph database. All movie data is thankfully provided by <a href="http://themoviedb.org">themoviedb.org</a>.<br/>
2+
This site is running on SpringFramework and Spring Data Graph powered by the Neo4j graph database. All movie data is provided by <a href="http://themoviedb.org">themoviedb.org</a>.<br/>
33
<br/>
44
<a href="http://springsource.org"><img src="/images/logo/springsource.png"/></a><a href="http://springsource.org/spring-data"><img src="/images/logo/springdata.jpg"/></a><a href="http://github.com/springsource/spring-data-graph"><img src="/images/logo/springdatagraph.png"/></a><a href="http://neo4j.org"><img src="/images/logo/neo4j.png"/></a>
55
</div>

src/main/webapp/resources/style.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ a img { border:0; }
7373
}
7474

7575
#footer {
76+
text-align:center;
7677
color: #999999;
7778
font-size: 12px;
7879
padding: 10px;

0 commit comments

Comments
 (0)