Commit f6d1059a authored by PECQUOT's avatar PECQUOT

Merge branch 'feature/3.9.0' into develop

# Conflicts:
#	CHANGELOG.md
#	pom.xml
#	reefdb-converter/pom.xml
#	reefdb-core/pom.xml
#	reefdb-core/src/main/java/fr/ifremer/reefdb/service/extraction/ExtractionPerformServiceImpl.java
#	reefdb-ui-swing-launcher/pom.xml
#	reefdb-ui-swing/pom.xml
#	src/changes/changes.xml
parents caebab24 ffc58adf
## Sprint 87 - v3.9.4
- Pas de mise à jour de modèle
## Sprint 86 - v3.9.3
- Pas de mise à jour de modèle
## Sprint 85 - v3.8.3 ## Sprint 85 - v3.8.3
- Pas de mise à jour de modèle - Pas de mise à jour de modèle
...@@ -12,6 +22,37 @@ ...@@ -12,6 +22,37 @@
- Version corrective devant utiliser le server de synchronisation 3.6.3.1 uniquement - Version corrective devant utiliser le server de synchronisation 3.6.3.1 uniquement
## Sprint 83 - v3.9.2
- Pas de mise à jour de modèle
- Une nouvelle option a été ajoutée pour gérer les transcodages des référentiels suivant :
reefdb.transcribingItemType.label.pmfmExtraction
Sa valeur par défaut est `REEFDB-PMFM.PMFM_EXTRACTION`. Couplée avec l'option `reefdb.transcribingItemType.label.pmfmNm`, elle permet de transcoder les libellé des PSFMU lors des extractions avec la priorité suivante:
1- libellé transcodé pour extraction
2- libellé transcodé pour écran de saisie
3- libellé interne du psfmu (issu du transcodage pour écran de saisie)
4- libellé du paramètre
- Pour simplifier la configuration du serveur de synchronisation, l'option `quadrige3.synchro.import.referential.transcribingItemType.label.includes`
qui doit contenir tous les libellés des types de transcodage à importer, accepte désormais le caractère '%'.
quadrige3.synchro.import.referential.transcribingItemType.label.includes=REEFDB% (tous les types de transcodage commençant par REEFDB seront importés)
## Sprint 82 - v3.9.1
- Pas de mise à jour de modèle
## Sprint 81 - v3.9.0
- Pas de mise à jour de modèle
## Sprint 80 - v3.8.1 ## Sprint 80 - v3.8.1
- Pas de mise à jour de modèle - Pas de mise à jour de modèle
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<groupId>fr.ifremer.reefdb</groupId> <groupId>fr.ifremer.reefdb</groupId>
<artifactId>reefdb</artifactId> <artifactId>reefdb</artifactId>
<version>3.8.4-SNAPSHOT</version> <version>3.9.5-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>Reef DB</name> <name>Reef DB</name>
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
<maven.compiler.debug>true</maven.compiler.debug> <maven.compiler.debug>true</maven.compiler.debug>
<!-- Quadrige3 Core version --> <!-- Quadrige3 Core version -->
<quadrige3-core.version>3.6.3.2</quadrige3-core.version> <quadrige3-core.version>3.6.10</quadrige3-core.version>
<!-- Last ReefDb launcher version --> <!-- Last ReefDb launcher version -->
<launcherVersion>3.0.3</launcherVersion> <launcherVersion>3.0.3</launcherVersion>
...@@ -261,7 +261,7 @@ ...@@ -261,7 +261,7 @@
<repositories> <repositories>
<repository> <repository>
<id>reefdb-public-group</id> <id>reefdb-public-group</id>
<url>http://server.e-is.pro/nexus/content/groups/reefdb</url> <url>https://nexus.e-is.pro/nexus/content/groups/reefdb</url>
<snapshots> <snapshots>
<enabled>true</enabled> <enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy> <checksumPolicy>fail</checksumPolicy>
...@@ -276,7 +276,7 @@ ...@@ -276,7 +276,7 @@
<pluginRepositories> <pluginRepositories>
<pluginRepository> <pluginRepository>
<id>reefdb-public-group</id> <id>reefdb-public-group</id>
<url>http://server.e-is.pro/nexus/content/groups/reefdb</url> <url>https://nexus.e-is.pro/nexus/content/groups/reefdb</url>
<snapshots> <snapshots>
<enabled>true</enabled> <enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy> <checksumPolicy>fail</checksumPolicy>
...@@ -342,6 +342,18 @@ ...@@ -342,6 +342,18 @@
<version>${junit.version}</version> <version>${junit.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
<version>1.4</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>fr.ifremer.quadrige3</groupId> <groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-test-shared</artifactId> <artifactId>quadrige3-test-shared</artifactId>
...@@ -1119,10 +1131,10 @@ ...@@ -1119,10 +1131,10 @@
<distribution.site.repository>scpexe://${distribution.site.host}${distribution.site.path}</distribution.site.repository> <distribution.site.repository>scpexe://${distribution.site.host}${distribution.site.path}</distribution.site.repository>
<distribution.repository.id>eis-nexus-deploy</distribution.repository.id> <distribution.repository.id>eis-nexus-deploy</distribution.repository.id>
<distribution.repository.url>http://server.e-is.pro/nexus/content/repositories/reefdb-releases</distribution.repository.url> <distribution.repository.url>https://nexus.e-is.pro/nexus/content/repositories/reefdb-releases</distribution.repository.url>
<distribution.snapshotRepository.id>eis-nexus-deploy</distribution.snapshotRepository.id> <distribution.snapshotRepository.id>eis-nexus-deploy</distribution.snapshotRepository.id>
<distribution.snapshotRepository.url>http://server.e-is.pro/nexus/content/repositories/reefdb-snapshots</distribution.snapshotRepository.url> <distribution.snapshotRepository.url>https://nexus.e-is.pro/nexus/content/repositories/reefdb-snapshots</distribution.snapshotRepository.url>
<distribution.internet.url>${distribution.repository.url}</distribution.internet.url> <distribution.internet.url>${distribution.repository.url}</distribution.internet.url>
</properties> </properties>
......
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
<repositories> <repositories>
<repository> <repository>
<id>reefdb-public-group</id> <id>reefdb-public-group</id>
<url>http://server.e-is.pro/nexus/content/groups/reefdb</url> <url>https://nexus.e-is.pro/nexus/content/groups/reefdb</url>
<snapshots> <snapshots>
<enabled>true</enabled> <enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy> <checksumPolicy>fail</checksumPolicy>
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
<pluginRepositories> <pluginRepositories>
<pluginRepository> <pluginRepository>
<id>reefdb-public-group</id> <id>reefdb-public-group</id>
<url>http://server.e-is.pro/nexus/content/groups/reefdb</url> <url>https://nexus.e-is.pro/nexus/content/groups/reefdb</url>
<snapshots> <snapshots>
<enabled>true</enabled> <enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy> <checksumPolicy>fail</checksumPolicy>
...@@ -242,12 +242,12 @@ ...@@ -242,12 +242,12 @@
<properties> <properties>
<distribution.repository.id>eis-nexus-deploy</distribution.repository.id> <distribution.repository.id>eis-nexus-deploy</distribution.repository.id>
<distribution.repository.url>http://server.e-is.pro/nexus/content/repositories/reefdb-releases</distribution.repository.url> <distribution.repository.url>https://nexus.e-is.pro/nexus/content/repositories/reefdb-releases</distribution.repository.url>
<distribution.snapshotRepository.id>eis-nexus-deploy</distribution.snapshotRepository.id> <distribution.snapshotRepository.id>eis-nexus-deploy</distribution.snapshotRepository.id>
<distribution.snapshotRepository.url>http://server.e-is.pro/nexus/content/repositories/reefdb-snapshots</distribution.snapshotRepository.url> <distribution.snapshotRepository.url>https://nexus.e-is.pro/nexus/content/repositories/reefdb-snapshots</distribution.snapshotRepository.url>
<distribution.internet.url>http://server.e-is.pro/nexus/content/groups/public</distribution.internet.url> <distribution.internet.url>https://nexus.e-is.pro/nexus/content/groups/public</distribution.internet.url>
</properties> </properties>
</profile> </profile>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>fr.ifremer.reefdb</groupId> <groupId>fr.ifremer.reefdb</groupId>
<artifactId>reefdb</artifactId> <artifactId>reefdb</artifactId>
<version>3.8.4-SNAPSHOT</version> <version>3.9.5-SNAPSHOT</version>
</parent> </parent>
<artifactId>reefdb-core</artifactId> <artifactId>reefdb-core</artifactId>
...@@ -60,6 +60,16 @@ ...@@ -60,6 +60,16 @@
<artifactId>quadrige3-test-shared</artifactId> <artifactId>quadrige3-test-shared</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
......
...@@ -35,8 +35,11 @@ ...@@ -35,8 +35,11 @@
# Please fill the missing licenses for dependencies : # Please fill the missing licenses for dependencies :
# #
# #
#Fri Feb 09 17:30:26 CET 2018 #Thu Feb 27 14:37:52 CET 2020
com.oracle--ojdbc7--12.1.0.2.0=OTN license com.oracle--ojdbc7--12.1.0.2.0=OTN license
commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
dom4j--dom4j--1.6.1=BSD License dom4j--dom4j--1.6.1=BSD License
junit-addons--junit-addons--1.4=
org.hibernate--hibernate-spatial--4.3-20140213=Lesser General Public License (LGPL) org.hibernate--hibernate-spatial--4.3-20140213=Lesser General Public License (LGPL)
xerces--xercesImpl--2.6.2=
xerces--xmlParserAPIs--2.6.2=
...@@ -967,6 +967,10 @@ public final class ReefDbConfiguration extends QuadrigeCoreConfiguration { ...@@ -967,6 +967,10 @@ public final class ReefDbConfiguration extends QuadrigeCoreConfiguration {
return applicationConfig.getOption(ReefDbConfigurationOption.TRANSCRIBING_ITEM_TYPE_LB_PMFM_NM.getKey()); return applicationConfig.getOption(ReefDbConfigurationOption.TRANSCRIBING_ITEM_TYPE_LB_PMFM_NM.getKey());
} }
public String getTranscribingItemTypeLbForPmfmExtraction() {
return applicationConfig.getOption(ReefDbConfigurationOption.TRANSCRIBING_ITEM_TYPE_LB_PMFM_EXTRACTION.getKey());
}
/** /**
* <p>getAlternativeTaxonOriginTaxRef.</p> * <p>getAlternativeTaxonOriginTaxRef.</p>
* *
......
...@@ -24,7 +24,6 @@ package fr.ifremer.reefdb.config; ...@@ -24,7 +24,6 @@ package fr.ifremer.reefdb.config;
*/ */
import fr.ifremer.quadrige3.core.dao.referential.UnitId; import fr.ifremer.quadrige3.core.dao.referential.UnitId;
import fr.ifremer.quadrige3.core.dao.referential.transcribing.TranscribingItemTypeLb;
import fr.ifremer.quadrige3.core.dao.technical.QuadrigeEnumerationDef; import fr.ifremer.quadrige3.core.dao.technical.QuadrigeEnumerationDef;
import org.nuiton.config.ConfigOptionDef; import org.nuiton.config.ConfigOptionDef;
import org.nuiton.version.Version; import org.nuiton.version.Version;
...@@ -303,7 +302,13 @@ public enum ReefDbConfigurationOption implements ConfigOptionDef { ...@@ -303,7 +302,13 @@ public enum ReefDbConfigurationOption implements ConfigOptionDef {
TRANSCRIBING_ITEM_TYPE_LB_PMFM_NM( TRANSCRIBING_ITEM_TYPE_LB_PMFM_NM(
"reefdb.transcribingItemType.label.pmfmNm", "reefdb.transcribingItemType.label.pmfmNm",
n("reefdb.config.option.transcribingItemType.label.pmfmNm.description"), n("reefdb.config.option.transcribingItemType.label.pmfmNm.description"),
String.format("${%s}", TranscribingItemTypeLb.REEFDB_PMFM_NM.getKey()), // 1 String.format("${%s%s}", QuadrigeEnumerationDef.CONFIG_OPTION_PREFIX, "TranscribingItemTypeLb.REEFDB_PMFM_NM"),
String.class,
false),
TRANSCRIBING_ITEM_TYPE_LB_PMFM_EXTRACTION(
"reefdb.transcribingItemType.label.pmfmExtraction",
n("reefdb.config.option.transcribingItemType.label.pmfmExtraction.description"),
String.format("${%s%s}", QuadrigeEnumerationDef.CONFIG_OPTION_PREFIX, "TranscribingItemTypeLb.REEFDB_PMFM_EXTRACTION"),
String.class, String.class,
false), false),
/* constants used to calculate transition length */ /* constants used to calculate transition length */
......
...@@ -102,6 +102,16 @@ public interface ReefDbStrategyDao { ...@@ -102,6 +102,16 @@ public interface ReefDbStrategyDao {
@Cacheable(value = PMFM_STRATEGIES_BY_PROG_LOC_DATE_CACHE) @Cacheable(value = PMFM_STRATEGIES_BY_PROG_LOC_DATE_CACHE)
Set<PmfmStrategyDTO> getPmfmStrategiesByProgramCodeAndLocation(String programCode, Integer monitoringLocationId, LocalDate date); Set<PmfmStrategyDTO> getPmfmStrategiesByProgramCodeAndLocation(String programCode, Integer monitoringLocationId, LocalDate date);
/**
* Retrieve all PMFM strategies that are applied on given programs and date range
*
* @param programCodes program codes
* @param startDate
* @param endDate
* @return set of pmfm strategies
*/
Set<PmfmStrategyDTO> getPmfmStrategiesByProgramCodesAndDates(Collection<String> programCodes, LocalDate startDate, LocalDate endDate);
/** /**
* Retrieve all strategies that are applied on the given program and monitoring location * Retrieve all strategies that are applied on the given program and monitoring location
* *
......
...@@ -241,6 +241,39 @@ public class ReefDbStrategyDaoImpl extends StrategyDaoImpl implements ReefDbStra ...@@ -241,6 +241,39 @@ public class ReefDbStrategyDaoImpl extends StrategyDaoImpl implements ReefDbStra
return ImmutableSet.copyOf(pmfmStrategies); return ImmutableSet.copyOf(pmfmStrategies);
} }
@Override
public Set<PmfmStrategyDTO> getPmfmStrategiesByProgramCodesAndDates(Collection<String> programCodes, LocalDate startDate, LocalDate endDate) {
Set<PmfmStrategyDTO> pmfmStrategies = new HashSet<>();
List<ProgStratDTO> appliedStrategies = getAppliedStrategiesByProgramCodes(programCodes);
for (ProgStratDTO appliedStrategy: appliedStrategies) {
// filter on date range
if (appliedStrategy.getStartDate() != null && appliedStrategy.getEndDate() != null
&& !appliedStrategy.getStartDate().isAfter(endDate) && !appliedStrategy.getEndDate().isBefore(startDate)) {
// add all pmfm strategies in date range
pmfmStrategies.addAll(getPmfmsAppliedStrategy(appliedStrategy.getId()));
}
}
return ImmutableSet.copyOf(pmfmStrategies);
}
@SuppressWarnings("unchecked")
private List<ProgStratDTO> getAppliedStrategiesByProgramCodes(Collection<String> programCodes) {
Query query = createQuery("appliedStrategiesByProgramCodes").setParameterList("programCodes", programCodes);
Iterator<Object[]> rows = query.iterate();
List<ProgStratDTO> result = Lists.newArrayList();
TimeZone dbTimezone = config.getDbTimezone();
while (rows.hasNext()) {
result.add(toProgStratDTO(Arrays.asList(rows.next()).iterator(), dbTimezone));
}
return result;
}
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public List<ProgStratDTO> getStrategiesByProgramCodeAndMonitoringLocationId(String programCode, int monitoringLocationId) { public List<ProgStratDTO> getStrategiesByProgramCodeAndMonitoringLocationId(String programCode, int monitoringLocationId) {
...@@ -915,7 +948,7 @@ public class ReefDbStrategyDaoImpl extends StrategyDaoImpl implements ReefDbStra ...@@ -915,7 +948,7 @@ public class ReefDbStrategyDaoImpl extends StrategyDaoImpl implements ReefDbStra
// code, name // code, name
program.setCode((String) source.next()); program.setCode((String) source.next());
program.setName((String) source.next()); program.setName((String) source.next());
//TODO (report Q3): program.setStatus(Daos.getStatus((String) source.next())); program.setStatus(Daos.getStatus((String) source.next()));
} }
// strategy: id, name // strategy: id, name
......
...@@ -24,6 +24,7 @@ package fr.ifremer.reefdb.dao.system.extraction; ...@@ -24,6 +24,7 @@ package fr.ifremer.reefdb.dao.system.extraction;
*/ */
import fr.ifremer.quadrige3.core.dao.technical.csv.CSVDao; import fr.ifremer.quadrige3.core.dao.technical.csv.CSVDao;
import fr.ifremer.reefdb.dto.referential.pmfm.PmfmDTO;
import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.RowMapper;
import java.util.List; import java.util.List;
...@@ -36,6 +37,14 @@ import java.util.Map; ...@@ -36,6 +37,14 @@ import java.util.Map;
*/ */
public interface ReefDbExtractionResultDao extends CSVDao { public interface ReefDbExtractionResultDao extends CSVDao {
/**
* <p>queryCount.</p>
*
* @param query a {@link String} object.
* @return a {@link java.lang.Long} object.
*/
long queryCount(String query);
/** /**
* <p>queryCount.</p> * <p>queryCount.</p>
* *
...@@ -67,6 +76,14 @@ public interface ReefDbExtractionResultDao extends CSVDao { ...@@ -67,6 +76,14 @@ public interface ReefDbExtractionResultDao extends CSVDao {
List<String> queryStringList(String query, Map<String, Object> queryBindings); List<String> queryStringList(String query, Map<String, Object> queryBindings);
/**
* <p>queryUpdate</p>
*
* @param query a {@link java.lang.String} object.
* @return a int.
*/
int queryUpdate(String query);
/** /**
* <p>queryUpdate.</p> * <p>queryUpdate.</p>
* *
...@@ -75,4 +92,10 @@ public interface ReefDbExtractionResultDao extends CSVDao { ...@@ -75,4 +92,10 @@ public interface ReefDbExtractionResultDao extends CSVDao {
* @return a int. * @return a int.
*/ */
int queryUpdate(String query, Map<String, Object> queryBindings); int queryUpdate(String query, Map<String, Object> queryBindings);
String getPmfmNameForExtraction(PmfmDTO pmfm);
String getPmfmUnitNameForExtraction(PmfmDTO pmfm);
} }
...@@ -23,18 +23,24 @@ package fr.ifremer.reefdb.dao.system.extraction; ...@@ -23,18 +23,24 @@ package fr.ifremer.reefdb.dao.system.extraction;
* #L% * #L%
*/ */
import fr.ifremer.quadrige3.core.dao.referential.transcribing.TranscribingItemExtendDao;
import fr.ifremer.quadrige3.core.dao.technical.Assert;
import fr.ifremer.quadrige3.core.dao.technical.csv.CSVDaoImpl; import fr.ifremer.quadrige3.core.dao.technical.csv.CSVDaoImpl;
import fr.ifremer.reefdb.config.ReefDbConfiguration;
import fr.ifremer.reefdb.dto.referential.pmfm.PmfmDTO;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.dao.DataRetrievalFailureException;
import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.math.BigInteger;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.Properties; import java.util.Properties;
/** /**
...@@ -50,6 +56,12 @@ public class ReefDbExtractionResultDaoImpl extends CSVDaoImpl implements ReefDbE ...@@ -50,6 +56,12 @@ public class ReefDbExtractionResultDaoImpl extends CSVDaoImpl implements ReefDbE
protected final Properties connectionProperties; protected final Properties connectionProperties;
@Resource
protected ReefDbConfiguration config;
@Resource(name = "transcribingItemDao")
private TranscribingItemExtendDao transcribingItemDao;
/** /**
* <p>Constructor for ReefDbExtractionResultDaoImpl.</p> * <p>Constructor for ReefDbExtractionResultDaoImpl.</p>
* *
...@@ -78,24 +90,19 @@ public class ReefDbExtractionResultDaoImpl extends CSVDaoImpl implements ReefDbE ...@@ -78,24 +90,19 @@ public class ReefDbExtractionResultDaoImpl extends CSVDaoImpl implements ReefDbE
this.connectionProperties = connectionProperties; this.connectionProperties = connectionProperties;
} }
@Override
public long queryCount(String query) {
return queryCount(query, null);
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Long queryCount(String query, Map<String, Object> queryBindings) { public Long queryCount(String query, Map<String, Object> queryBindings) {
Long count = queryCount(connectionProperties, query, queryBindings);
return query(connectionProperties, query, queryBindings, resultSet -> { if (count == null) throw new DataRetrievalFailureException(String.format("query count result is null: %s ; bindings=%s", query, queryBindings));
Object result = resultSet.getObject(1); return count;
if (log.isDebugEnabled()) {
log.debug(String.format("queryCount result: %s", result));
}
if (result instanceof Integer) {
return ((Integer) result).longValue();
} else if (result instanceof BigInteger) {
return ((BigInteger) result).longValue();
}
return (Long) result;
});