This is an automated email from the git hooks/post-receive script. New commit to branch feature/8170 in repository echobase. See https://gitlab.nuiton.org/codelutin/echobase.git commit a73612211f351b96cc0167bb0ae1b31a1512837a Author: Tony CHEMIT <chemit@codelutin.com> Date: Sat Mar 26 13:58:47 2016 +0100 Ajout d'un checkFile pour chaque importFile --- .../MigrationCallBackForVersion3_900.java | 54 +++++++++++++++++++++ ...migration.workingDb.MigrationCallBackForVersion | 3 +- .../workingDb/h2/3.900-0-add-check-file.sql | 21 ++++++++ .../workingDb/pg/3.900-0-add-check-file.sql | 21 ++++++++ echobase-domain/src/main/xmi/echobase.properties | 5 +- echobase-domain/src/main/xmi/echobase.zargo | Bin 89705 -> 89758 bytes .../services/service/UserDbPersistenceService.java | 30 ++++++++---- 7 files changed, 123 insertions(+), 11 deletions(-) diff --git a/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/MigrationCallBackForVersion3_900.java b/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/MigrationCallBackForVersion3_900.java new file mode 100644 index 0000000..982b4fc --- /dev/null +++ b/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/MigrationCallBackForVersion3_900.java @@ -0,0 +1,54 @@ +package fr.ifremer.echobase.persistence.migration.workingDb; + +/* + * #%L + * EchoBase :: Domain + * %% + * Copyright (C) 2011 - 2015 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import fr.ifremer.echobase.entities.EchoBaseUserTopiaPersistenceContext; +import org.nuiton.topia.persistence.TopiaException; +import org.nuiton.util.Version; + +import java.util.List; + +/** + * Created on 12/16/14. + * + * @author Tony Chemit - chemit@codelutin.com + * @since 2.7.2 + */ +public class MigrationCallBackForVersion3_900 extends MigrationCallBackForVersion { + + @Override + public Version getVersion() { + return new Version("3.900"); + } + + @Override + protected void prepareMigrationScript(EchoBaseUserTopiaPersistenceContext tx, + List<String> queries, + boolean showSql, + boolean showProgression) throws TopiaException { + + // add check-file (see https://forge.codelutin.com/issues/8170) + addSpecificScript(tx, "3.900-0-add-check-file.sql", queries); + + } + +} \ No newline at end of file diff --git a/echobase-domain/src/main/resources/META-INF/services/fr.ifremer.echobase.persistence.migration.workingDb.MigrationCallBackForVersion b/echobase-domain/src/main/resources/META-INF/services/fr.ifremer.echobase.persistence.migration.workingDb.MigrationCallBackForVersion index 6b065d1..a32c736 100644 --- a/echobase-domain/src/main/resources/META-INF/services/fr.ifremer.echobase.persistence.migration.workingDb.MigrationCallBackForVersion +++ b/echobase-domain/src/main/resources/META-INF/services/fr.ifremer.echobase.persistence.migration.workingDb.MigrationCallBackForVersion @@ -2,4 +2,5 @@ fr.ifremer.echobase.persistence.migration.workingDb.MigrationCallBackForVersion2 fr.ifremer.echobase.persistence.migration.workingDb.MigrationCallBackForVersion2_5_1 fr.ifremer.echobase.persistence.migration.workingDb.MigrationCallBackForVersion2_6 fr.ifremer.echobase.persistence.migration.workingDb.MigrationCallBackForVersion2_6_1 -fr.ifremer.echobase.persistence.migration.workingDb.MigrationCallBackForVersion2_7_2 \ No newline at end of file +fr.ifremer.echobase.persistence.migration.workingDb.MigrationCallBackForVersion2_7_2 +fr.ifremer.echobase.persistence.migration.workingDb.MigrationCallBackForVersion3_900 \ No newline at end of file diff --git a/echobase-domain/src/main/resources/migration/workingDb/h2/3.900-0-add-check-file.sql b/echobase-domain/src/main/resources/migration/workingDb/h2/3.900-0-add-check-file.sql new file mode 100644 index 0000000..1b6cff0 --- /dev/null +++ b/echobase-domain/src/main/resources/migration/workingDb/h2/3.900-0-add-check-file.sql @@ -0,0 +1,21 @@ +--- +-- #%L +-- EchoBase :: Domain +-- %% +-- Copyright (C) 2011 - 2015 Ifremer, Codelutin +-- %% +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU Affero General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU Affero General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- #L% +--- +ALTER TABLE IMPORTFILE ADD checkFile BLOB; \ No newline at end of file diff --git a/echobase-domain/src/main/resources/migration/workingDb/pg/3.900-0-add-check-file.sql b/echobase-domain/src/main/resources/migration/workingDb/pg/3.900-0-add-check-file.sql new file mode 100644 index 0000000..972b1df --- /dev/null +++ b/echobase-domain/src/main/resources/migration/workingDb/pg/3.900-0-add-check-file.sql @@ -0,0 +1,21 @@ +--- +-- #%L +-- EchoBase :: Domain +-- %% +-- Copyright (C) 2011 - 2015 Ifremer, Codelutin +-- %% +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU Affero General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU Affero General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- #L% +--- +ALTER TABLE IMPORTFILE ADD checkFile OID; \ No newline at end of file diff --git a/echobase-domain/src/main/xmi/echobase.properties b/echobase-domain/src/main/xmi/echobase.properties index d69f770..c57d776 100644 --- a/echobase-domain/src/main/xmi/echobase.properties +++ b/echobase-domain/src/main/xmi/echobase.properties @@ -22,7 +22,7 @@ model.tagValue.notGenerateToString=true model.tagValue.generateOperatorForDAOHelper=true model.tagValue.constantPrefix=PROPERTY_ -model.tagValue.version=2.7.2 +model.tagValue.version=3.900 model.tagValue.noPCS=true model.tagValue.doNotGenerateBooleanGetMethods=true model.tagValue.indexForeignKeys=true @@ -63,6 +63,9 @@ fr.ifremer.echobase.entities.ImportLog.attribute.importText.tagValue.notNull=tru fr.ifremer.echobase.entities.ImportLog.attribute.importType.tagValue.notNull=true fr.ifremer.echobase.entities.ImportLog.attribute.voyageId.tagValue.notNull=true +fr.ifremer.echobase.entities.ImportFile.attribute.file.tagValue.notNull=true +fr.ifremer.echobase.entities.ImportFile.attribute.checkFile.tagValue.notNull=true + ############################################################################### ### Natural id for references ################################################ ############################################################################### diff --git a/echobase-domain/src/main/xmi/echobase.zargo b/echobase-domain/src/main/xmi/echobase.zargo index 066030f..edf5e80 100644 Binary files a/echobase-domain/src/main/xmi/echobase.zargo and b/echobase-domain/src/main/xmi/echobase.zargo differ diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/UserDbPersistenceService.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/UserDbPersistenceService.java index 67d81cd..8858deb 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/UserDbPersistenceService.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/UserDbPersistenceService.java @@ -482,13 +482,29 @@ public class UserDbPersistenceService extends EchoBaseServiceSupport { persistenceContext.getImportLogDao().delete(importLog); } - public ImportFile createImportFile(InputFile inputFile) { + @Deprecated + public ImportFile createImportFile(InputFile importFile) { + throw new IllegalStateException("No!"); + } + + public ImportFile createImportFile(InputFile importFile, InputFile checkFile) { + + Preconditions.checkNotNull(importFile); + Preconditions.checkArgument(importFile.hasFile()); + + Preconditions.checkNotNull(checkFile); + Preconditions.checkArgument(checkFile.hasFile()); - Preconditions.checkNotNull(inputFile); - Preconditions.checkArgument(inputFile.hasFile()); + SerialBlob importFileBLob = getSerialBlob(importFile.getFile()); + SerialBlob checkFileBLob = getSerialBlob(checkFile.getFile()); - File file = inputFile.getFile(); + return persistenceContext.getImportFileDao().create(ImportFile.PROPERTY_NAME, importFile.getFileName(), + ImportFile.PROPERTY_FILE, importFileBLob, + ImportFile.PROPERTY_CHECK_FILE, checkFileBLob); + } + + private SerialBlob getSerialBlob(File file) { SerialBlob serialBlob; try { @@ -513,11 +529,7 @@ public class UserDbPersistenceService extends EchoBaseServiceSupport { } catch (Exception e) { throw new EchoBaseTechnicalException("Could not serialize file content " + file, e); } - - return persistenceContext.getImportFileDao().create( - ImportFile.PROPERTY_NAME, inputFile.getFileName(), - ImportFile.PROPERTY_FILE, serialBlob); - + return serialBlob; } public Collection<ImportFile> getImportFiles(String importLogId) { -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.