-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
20 changed files
with
214 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+3.46 KB
HoraDaPipocaUpSource/build/classes/br/usjt/ads/arqdes/controller/FilmesRest.class
Binary file not shown.
Binary file modified
BIN
-751 Bytes
(84%)
...DaPipocaUpSource/build/classes/br/usjt/ads/arqdes/controller/ManterFilmesController.class
Binary file not shown.
Binary file modified
BIN
+345 Bytes
(120%)
HoraDaPipocaUpSource/build/classes/br/usjt/ads/arqdes/model/dao/FilmeDAO.class
Binary file not shown.
Binary file modified
BIN
-50 Bytes
(96%)
HoraDaPipocaUpSource/build/classes/br/usjt/ads/arqdes/model/dao/GeneroDAO.class
Binary file not shown.
Binary file modified
BIN
+450 Bytes
(110%)
HoraDaPipocaUpSource/build/classes/br/usjt/ads/arqdes/model/entity/Filme.class
Binary file not shown.
Binary file modified
BIN
+207 Bytes
(120%)
HoraDaPipocaUpSource/build/classes/br/usjt/ads/arqdes/model/entity/Genero.class
Binary file not shown.
Binary file modified
BIN
+263 Bytes
(120%)
HoraDaPipocaUpSource/build/classes/br/usjt/ads/arqdes/model/service/FilmeService.class
Binary file not shown.
Binary file modified
BIN
-60 Bytes
(94%)
HoraDaPipocaUpSource/build/classes/br/usjt/ads/arqdes/model/service/GeneroService.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
HoraDaPipocaUpSource/src/br/usjt/ads/arqdes/controller/FilmesRest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package br.usjt.ads.arqdes.controller; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
import javax.transaction.Transactional; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.ResponseBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import br.usjt.ads.arqdes.model.entity.Filme; | ||
import br.usjt.ads.arqdes.model.service.FilmeService; | ||
|
||
@RestController | ||
public class FilmesRest { | ||
@Autowired | ||
private FilmeService fService; | ||
|
||
@Transactional | ||
@RequestMapping(method=RequestMethod.POST, value="rest/inserir_filme") | ||
public ResponseEntity<Filme> criarFilme(@RequestBody Filme filme) { | ||
try { | ||
fService.inserirFilme(filme); | ||
return new ResponseEntity<Filme>(filme, HttpStatus.OK); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
return new ResponseEntity<Filme>(filme, HttpStatus.INTERNAL_SERVER_ERROR); | ||
} | ||
} | ||
|
||
@Transactional | ||
@RequestMapping(method=RequestMethod.GET, value="rest/buscar_filme") | ||
public @ResponseBody Filme buscarFilme(int id) { | ||
Filme filme = null; | ||
try { | ||
filme = fService.buscarFilme(id); | ||
return filme; | ||
} catch(IOException e) { | ||
e.printStackTrace(); | ||
} | ||
return filme; | ||
} | ||
|
||
@Transactional | ||
@RequestMapping(method=RequestMethod.PUT, value="rest/atualizar_filme") | ||
public ResponseEntity<Filme> atualizarFilme(@RequestBody Filme filme) { | ||
try { | ||
fService.atualizarFilme(filme); | ||
return new ResponseEntity<Filme>(filme, HttpStatus.OK); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
return new ResponseEntity<Filme>(filme, HttpStatus.INTERNAL_SERVER_ERROR); | ||
} | ||
} | ||
|
||
@Transactional | ||
@RequestMapping(method=RequestMethod.DELETE, value="rest/deletar_filme") | ||
public ResponseEntity<Filme> deletarFilme(@RequestBody Filme filme) { | ||
try { | ||
fService.excluirFilme(filme.getId()); | ||
return new ResponseEntity<Filme>(filme, HttpStatus.OK); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
return new ResponseEntity<Filme>(filme, HttpStatus.INTERNAL_SERVER_ERROR); | ||
} | ||
} | ||
|
||
@Transactional | ||
@RequestMapping(method=RequestMethod.GET, value="rest/filmes") | ||
public @ResponseBody List<Filme> listagem(String chave) { | ||
List<Filme> lista = null; | ||
try{ | ||
if(chave == null || chave.equals("")){ | ||
lista = fService.listarFilmes(); | ||
} else { | ||
lista = fService.listarFilmes(chave); | ||
} | ||
} catch(IOException e){ | ||
e.printStackTrace(); | ||
} | ||
return lista; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.