|
|
@@ -17,6 +17,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.Datasource;
|
|
|
@@ -27,6 +28,7 @@ import es.uv.saic.service.DataService;
|
|
|
import es.uv.saic.service.DatasourceService;
|
|
|
|
|
|
@RestController
|
|
|
+@RequestMapping("/data")
|
|
|
public class DataController {
|
|
|
|
|
|
@Autowired
|
|
|
@@ -36,13 +38,13 @@ public class DataController {
|
|
|
private DatasourceService das;
|
|
|
|
|
|
// GET que carga la interfaz relacionada con toda la importación de datos
|
|
|
- @GetMapping("/data/import")
|
|
|
+ @GetMapping("/import")
|
|
|
public List<Datasource> renderImport() {
|
|
|
return this.das.findAll();
|
|
|
}
|
|
|
|
|
|
// POST encargado de importar los datos que han sido adjuntados
|
|
|
- @PostMapping("/data/import")
|
|
|
+ @PostMapping("/import")
|
|
|
public String uploadFile(@RequestBody ImportDTO importDTO) throws IOException, MessagingException, ClassNotFoundException, SQLException {
|
|
|
String retval = "";
|
|
|
if(importDTO.getTipus().equals("file")){
|
|
|
@@ -62,14 +64,14 @@ public class DataController {
|
|
|
}
|
|
|
|
|
|
//GET para cargar el apartado de coonsolidate
|
|
|
- @GetMapping("/data/consolidate")
|
|
|
+ @GetMapping("/consolidate")
|
|
|
@Secured({"ROLE_ADMIN", "ROLE_TESTER"})
|
|
|
public String consolidate(Model model, Authentication auth) throws IOException {
|
|
|
return "dataConsolidate";
|
|
|
}
|
|
|
|
|
|
// POST para comprobar si existen problemas con los datos, si estan duplicados o su integridad
|
|
|
- @PostMapping("/data/check/{type}")
|
|
|
+ @PostMapping("/check/{type}")
|
|
|
public List<IndicadorEnquestaTmpDup> check(@RequestBody String enquesta, @PathVariable Integer type) throws IOException {
|
|
|
if(type == 1) {
|
|
|
return this.ips.checkDuplicates(enquesta);
|
|
|
@@ -81,19 +83,19 @@ public class DataController {
|
|
|
}
|
|
|
|
|
|
// POST que consolida los datos pasadas por la encuesta
|
|
|
- @PostMapping("/data/consolidate")
|
|
|
+ @PostMapping("/consolidate")
|
|
|
public Integer consolidate(@RequestBody String enquesta) throws IOException {
|
|
|
return this.ips.consolidateByEnquesta(enquesta);
|
|
|
}
|
|
|
|
|
|
// POST que comprueba los datos a partir de la encuesta
|
|
|
- @PostMapping("/data/count")
|
|
|
+ @PostMapping("/count")
|
|
|
public Integer countByEnquesta(@RequestBody String enquesta) throws IOException {
|
|
|
return this.ips.countByEnquesta(enquesta);
|
|
|
}
|
|
|
|
|
|
// POST para mostrar los datos en columnas
|
|
|
- @PostMapping("/data/view/columns")
|
|
|
+ @PostMapping("/view/columns")
|
|
|
public List<String> listTableColumns(@RequestBody TablaDTO tablaDto) {
|
|
|
try {
|
|
|
return this.ips.listTableColumns(tablaDto.getDbOrigen(), tablaDto.getVista(), tablaDto.getLocale());
|
|
|
@@ -102,7 +104,7 @@ public class DataController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/data/sources")
|
|
|
+ @GetMapping("/sources")
|
|
|
public List<Datasource> getDatasources() throws IOException {
|
|
|
List<Datasource> sources = this.das.findAll();
|
|
|
for(Datasource d : sources){
|