|
|
@@ -0,0 +1,37 @@
|
|
|
+package es.uv.saic.web;
|
|
|
+
|
|
|
+import java.math.BigInteger;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import es.uv.saic.domain.Proces;
|
|
|
+import es.uv.saic.service.ProcesService;
|
|
|
+
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+
|
|
|
+
|
|
|
+@RestController
|
|
|
+public class ProcesController {
|
|
|
+ @Autowired
|
|
|
+ private ProcesService procesService;
|
|
|
+
|
|
|
+ @PostMapping("/proces/{id}")
|
|
|
+ public ResponseEntity<?> findById(@PathVariable Integer id) {
|
|
|
+ try {
|
|
|
+ Proces proces = procesService.findByID(id);
|
|
|
+
|
|
|
+ if (proces != null){
|
|
|
+ return ResponseEntity.ok(proces);
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResponseEntity.badRequest().body("El proces con id " + id + " esta vacio");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return ResponseEntity.badRequest().body("Error al obtener el proces por el id:" + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|