Skip to content

Commit

Permalink
change post to get
Browse files Browse the repository at this point in the history
  • Loading branch information
Jilberta committed Jul 9, 2015
1 parent b194d77 commit 5f3f5ff
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/main/java/ge/kuku/movietable/core/MovieService.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,18 @@ private Repository getRepo() {
}

@GET
public List<MovieDo> read() {
final ArrayList<MovieDo> result = new ArrayList<MovieDo>();
MovieDo movieDo = new MovieDo();
movieDo.setSource("http://example.com/movie/nasjdhiu13h12g");
movieDo.setLanguage("JP");
movieDo.setQuality("HD");
result.add(movieDo);
return result;
}

@POST
@Path("{id}")
public List<MovieDo> retrieve(@PathParam("id") String id, @NotNull @Valid MovieDo movieDo) throws IOException {
public List<MovieDo> retrieve(@PathParam("id") String id, @QueryParam("movie_name") String movieName) throws IOException {
List<MovieDo> movieDos = new ArrayList<>();
List<MovieItem> items = getRepo().retrieve(id);
for (MovieItem fromDb : items) {
movieDos.add(fromDb.toDo());
}

if (movieDos.isEmpty()) {
MovieDo[] mDoList = null;
try {
mDoList = requestMovieSearch(id, movieDo.getName());
mDoList = requestMovieSearch(id, movieName);
for (MovieDo mDo : mDoList) {
mDo.setId(UUID.randomUUID().toString());
getRepo().save(MovieItem.fromDo(mDo));
Expand Down

0 comments on commit 5f3f5ff

Please sign in to comment.