|
|
@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import es.uv.saic.domain.Plantilla;
|
|
|
@@ -18,21 +19,22 @@ import es.uv.saic.service.PlantillaService;
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
+@RequestMapping("/plantillas")
|
|
|
public class PlantillaController {
|
|
|
@Autowired
|
|
|
private PlantillaService ps;
|
|
|
|
|
|
- @GetMapping("/plantillas")
|
|
|
+ @GetMapping
|
|
|
public List<Plantilla> findAll() {
|
|
|
return ps.findAll();
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/plantillas/{id}")
|
|
|
+ @GetMapping("/{id}")
|
|
|
public Plantilla findByID(@PathVariable Integer id) {
|
|
|
return ps.findByID(id);
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/plantillas/{versio}/{codi}/{ambit}")
|
|
|
+ @GetMapping("/{versio}/{codi}/{ambit}")
|
|
|
public Plantilla findByVersioCodiAmbit(@PathVariable Integer versio,
|
|
|
@PathVariable String codi,
|
|
|
@PathVariable String ambit) {
|
|
|
@@ -46,7 +48,7 @@ public class PlantillaController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/plantillas")
|
|
|
+ @PostMapping
|
|
|
public String save(@RequestBody Plantilla plantilla) {
|
|
|
try {
|
|
|
ps.save(plantilla);
|
|
|
@@ -57,28 +59,28 @@ public class PlantillaController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @DeleteMapping("/plantillas")
|
|
|
+ @DeleteMapping
|
|
|
public String delete(@RequestBody Plantilla plantilla) {
|
|
|
ps.delete(plantilla);
|
|
|
return "Delete";
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/plantillas/used/{id}")
|
|
|
+ @GetMapping("/used/{id}")
|
|
|
public boolean isUsed(@PathVariable Integer id) {
|
|
|
return ps.isUsed(id);
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/plantillas/addTemplateData")
|
|
|
+ @PostMapping("/addTemplateData")
|
|
|
public String addTemplateData(@RequestBody TemplateDataDTO td) {
|
|
|
return ps.addTemplateData(td.getInstanciaTasca(), td.getTemplate());
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/plantillas/addTemplateData2")
|
|
|
+ @PostMapping("/addTemplateData2")
|
|
|
public String addTemplateData2(@RequestBody TemplateDataDTO td) {
|
|
|
return ps.addTemplateData(td.getIdTitulacio(), td.getIdCentre(), td.getCurs(), td.getTemplate());
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/plantillas/savePDF")
|
|
|
+ @PostMapping("/savePDF")
|
|
|
public String savePDF(@RequestBody PdfDTO pdf) throws IOException, InterruptedException {
|
|
|
return ps.savePDF(pdf.getContent(), pdf.getIdtasca());
|
|
|
|