22
33import java .util .Collection ;
44import org .springframework .beans .factory .annotation .Autowired ;
5- import org .springframework .http .HttpStatus ;
6- import org .springframework .http .ResponseEntity ;
75import org .springframework .web .bind .annotation .CrossOrigin ;
8- import org .springframework .web .bind .annotation .DeleteMapping ;
96import org .springframework .web .bind .annotation .GetMapping ;
107import org .springframework .web .bind .annotation .PathVariable ;
11- import org .springframework .web .bind .annotation .PostMapping ;
12- import org .springframework .web .bind .annotation .PutMapping ;
13- import org .springframework .web .bind .annotation .RequestBody ;
148import org .springframework .web .bind .annotation .RequestMapping ;
159import org .springframework .web .bind .annotation .RestController ;
1610
1711@ RestController
1812@ CrossOrigin (origins = "*" )
19- @ RequestMapping (path = AnoController .ENDPOINT )
20- public class AnoController {
13+ @ RequestMapping (path = PublicAnoController .ENDPOINT )
14+ public class PublicAnoController {
2115
2216 public static final String ENDPOINT = "/anos" ;
23-
2417 public static final String ANO_ID = "ano" ;
2518
2619 @ Autowired
2720 private AnoService service ;
2821
29-
3022 @ GetMapping
3123 public Collection <Ano > getAnos () {
3224 return service .getAllAnos ();
@@ -37,19 +29,4 @@ public Ano getAno(@PathVariable(name = ANO_ID) Integer ano) {
3729 return service .getAno (ano );
3830 }
3931
40- @ PostMapping
41- public Ano saveAno (@ RequestBody Ano ano ) {
42- return this .service .addAno (ano );
43- }
44-
45- @ PutMapping
46- public Ano updateAno (@ RequestBody Ano ano ) {
47- return this .service .updateAno (ano );
48- }
49-
50- @ DeleteMapping (path = "/{" + ANO_ID + "}" )
51- public ResponseEntity <String > updateAno (@ PathVariable (name = ANO_ID ) Integer ano ) {
52- this .service .deleteAno (ano );
53- return AnoUtils .getResponseEntity (HttpStatus .OK , "" );
54- }
5532}
0 commit comments