|
|
@@ -1,26 +1,26 @@
|
|
|
package es.uv.saic.dto;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.util.List;
|
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import es.uv.saic.domain.Usuari;
|
|
|
-
|
|
|
public class ImportDTO {
|
|
|
// Campos comunes
|
|
|
String tipus;
|
|
|
- Usuari principal;
|
|
|
+ String principal;
|
|
|
String enquesta;
|
|
|
String ambit;
|
|
|
String estudi;
|
|
|
String locale;
|
|
|
String clau;
|
|
|
List<String> ignoredColumns;
|
|
|
-
|
|
|
+
|
|
|
// Campos específicos para importación desde archivo
|
|
|
- MultipartFile file;
|
|
|
+ byte[] fileContent;
|
|
|
+ String fileName;
|
|
|
String delim;
|
|
|
-
|
|
|
+
|
|
|
// Campos específicos para importación desde base de datos
|
|
|
Integer dbOrigen;
|
|
|
String vista;
|
|
|
@@ -28,10 +28,17 @@ public class ImportDTO {
|
|
|
Integer dstCurs;
|
|
|
|
|
|
// Constructor completo para todos los campos
|
|
|
- public ImportDTO(MultipartFile file, String tipus, Usuari principal, String enquesta, String ambit, String estudi,
|
|
|
- String locale, String delim, String clau, List<String> ignoredColumns, Integer dbOrigen, String vista,
|
|
|
+ public ImportDTO(MultipartFile file, String tipus, String principal, String enquesta, String ambit, String estudi,
|
|
|
+ String locale, String delim, String clau, List<String> ignoredColumns, Integer dbOrigen, String vista,
|
|
|
Integer curs, Integer dstCurs) {
|
|
|
- this.file = file;
|
|
|
+ if (file != null) {
|
|
|
+ try {
|
|
|
+ this.fileContent = file.getBytes();
|
|
|
+ this.fileName = file.getOriginalFilename();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
this.tipus = tipus;
|
|
|
this.principal = principal;
|
|
|
this.enquesta = enquesta;
|
|
|
@@ -47,12 +54,20 @@ public class ImportDTO {
|
|
|
this.dstCurs = dstCurs;
|
|
|
}
|
|
|
|
|
|
- public MultipartFile getFile() {
|
|
|
- return file;
|
|
|
+ public byte[] getFileContent() {
|
|
|
+ return fileContent;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setFileContent(byte[] fileContent) {
|
|
|
+ this.fileContent = fileContent;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getFileName() {
|
|
|
+ return fileName;
|
|
|
}
|
|
|
|
|
|
- public void setFile(MultipartFile file) {
|
|
|
- this.file = file;
|
|
|
+ public void setFileName(String fileName) {
|
|
|
+ this.fileName = fileName;
|
|
|
}
|
|
|
|
|
|
// Getters y Setters
|
|
|
@@ -64,11 +79,11 @@ public class ImportDTO {
|
|
|
this.tipus = tipus;
|
|
|
}
|
|
|
|
|
|
- public Usuari getPrincipal() {
|
|
|
+ public String getPrincipal() {
|
|
|
return principal;
|
|
|
}
|
|
|
|
|
|
- public void setPrincipal(Usuari principal) {
|
|
|
+ public void setPrincipal(String principal) {
|
|
|
this.principal = principal;
|
|
|
}
|
|
|
|