Commit 5a5eec91 authored by PECQUOT's avatar PECQUOT

[fix] Change EIS nexus url

[enh] Begin a new extraction service ExtractionPerformServiceNewImpl (need xmlquery 1.1+) NOT FINISHED (Mantis #49970)
Signed-off-by: PECQUOT's avatarlp1ee9d <ludovic.pecquot@e-is.pro>
parent e0fcf311
......@@ -172,6 +172,7 @@
<!-- Quadrige3 Core version -->
<quadrige3-core.version>3.6.5</quadrige3-core.version>
<!-- <quadrige3-core.version>3.6.6-SNAPSHOT</quadrige3-core.version>-->
<!-- Last ReefDb launcher version -->
<launcherVersion>3.0.3</launcherVersion>
......@@ -261,7 +262,7 @@
<repositories>
<repository>
<id>reefdb-public-group</id>
<url>http://nexus.e-is.pro/nexus/content/groups/reefdb</url>
<url>http://server.e-is.pro/nexus/content/groups/reefdb</url>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
......@@ -276,7 +277,7 @@
<pluginRepositories>
<pluginRepository>
<id>reefdb-public-group</id>
<url>http://nexus.e-is.pro/nexus/content/groups/reefdb</url>
<url>http://server.e-is.pro/nexus/content/groups/reefdb</url>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
......@@ -342,6 +343,18 @@
<version>${junit.version}</version>
<scope>test</scope>
</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>
<groupId>fr.ifremer.quadrige3</groupId>
<artifactId>quadrige3-test-shared</artifactId>
......@@ -1119,10 +1132,10 @@
<distribution.site.repository>scpexe://${distribution.site.host}${distribution.site.path}</distribution.site.repository>
<distribution.repository.id>eis-nexus-deploy</distribution.repository.id>
<distribution.repository.url>http://nexus.e-is.pro/nexus/content/repositories/reefdb-releases</distribution.repository.url>
<distribution.repository.url>http://server.e-is.pro/nexus/content/repositories/reefdb-releases</distribution.repository.url>
<distribution.snapshotRepository.id>eis-nexus-deploy</distribution.snapshotRepository.id>
<distribution.snapshotRepository.url>http://nexus.e-is.pro/nexus/content/repositories/reefdb-snapshots</distribution.snapshotRepository.url>
<distribution.snapshotRepository.url>http://server.e-is.pro/nexus/content/repositories/reefdb-snapshots</distribution.snapshotRepository.url>
<distribution.internet.url>${distribution.repository.url}</distribution.internet.url>
</properties>
......
......@@ -76,7 +76,7 @@
<repositories>
<repository>
<id>reefdb-public-group</id>
<url>http://nexus.e-is.pro/nexus/content/groups/reefdb</url>
<url>http://server.e-is.pro/nexus/content/groups/reefdb</url>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
......@@ -91,7 +91,7 @@
<pluginRepositories>
<pluginRepository>
<id>reefdb-public-group</id>
<url>http://nexus.e-is.pro/nexus/content/groups/reefdb</url>
<url>http://server.e-is.pro/nexus/content/groups/reefdb</url>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
......@@ -242,12 +242,12 @@
<properties>
<distribution.repository.id>eis-nexus-deploy</distribution.repository.id>
<distribution.repository.url>http://nexus.e-is.pro/nexus/content/repositories/reefdb-releases</distribution.repository.url>
<distribution.repository.url>http://server.e-is.pro/nexus/content/repositories/reefdb-releases</distribution.repository.url>
<distribution.snapshotRepository.id>eis-nexus-deploy</distribution.snapshotRepository.id>
<distribution.snapshotRepository.url>http://nexus.e-is.pro/nexus/content/repositories/reefdb-snapshots</distribution.snapshotRepository.url>
<distribution.snapshotRepository.url>http://server.e-is.pro/nexus/content/repositories/reefdb-snapshots</distribution.snapshotRepository.url>
<distribution.internet.url>http://nexus.e-is.pro/nexus/content/groups/public</distribution.internet.url>
<distribution.internet.url>http://server.e-is.pro/nexus/content/groups/public</distribution.internet.url>
</properties>
</profile>
......
......@@ -60,6 +60,16 @@
<artifactId>quadrige3-test-shared</artifactId>
<scope>test</scope>
</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>
......
......@@ -102,6 +102,16 @@ public interface ReefDbStrategyDao {
@Cacheable(value = PMFM_STRATEGIES_BY_PROG_LOC_DATE_CACHE)
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
*
......
......@@ -241,6 +241,39 @@ public class ReefDbStrategyDaoImpl extends StrategyDaoImpl implements ReefDbStra
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} */
@Override
public List<ProgStratDTO> getStrategiesByProgramCodeAndMonitoringLocationId(String programCode, int monitoringLocationId) {
......@@ -915,7 +948,7 @@ public class ReefDbStrategyDaoImpl extends StrategyDaoImpl implements ReefDbStra
// code, name
program.setCode((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
......
......@@ -36,6 +36,14 @@ import java.util.Map;
*/
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>
*
......@@ -67,6 +75,14 @@ public interface ReefDbExtractionResultDao extends CSVDao {
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>
*
......
......@@ -28,11 +28,11 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.dao.DataRetrievalFailureException;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;
import javax.sql.DataSource;
import java.math.BigInteger;
import java.util.List;
import java.util.Map;
import java.util.Properties;
......@@ -78,24 +78,19 @@ public class ReefDbExtractionResultDaoImpl extends CSVDaoImpl implements ReefDbE
this.connectionProperties = connectionProperties;
}
@Override
public long queryCount(String query) {
return queryCount(query, null);
}
/**
* {@inheritDoc}
*/
@Override
public Long queryCount(String query, Map<String, Object> queryBindings) {
return query(connectionProperties, query, queryBindings, resultSet -> {
Object result = resultSet.getObject(1);
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;
});
Long count = queryCount(connectionProperties, query, queryBindings);
if (count == null) throw new DataRetrievalFailureException(String.format("query count result is null: %s ; bindings=%s", query, queryBindings));
return count;
}
/**
......@@ -106,6 +101,11 @@ public class ReefDbExtractionResultDaoImpl extends CSVDaoImpl implements ReefDbE
return query(connectionProperties, sql, queryBindings, rowMapper);
}
@Override
public int queryUpdate(String query) {
return queryUpdate(query, null);
}
/**
* {@inheritDoc}
*/
......@@ -126,4 +126,5 @@ public class ReefDbExtractionResultDaoImpl extends CSVDaoImpl implements ReefDbE
public List<String> queryStringList(String query, Map<String, Object> queryBindings) {
return query(connectionProperties, query, queryBindings, (resultSet, i) -> resultSet.getString(1));
}
}
......@@ -896,6 +896,16 @@ public class ReefDbBeans extends QuadrigeBeans {
return null;
}
public static void setFilterElements(ExtractionDTO extraction, ExtractionFilterValues extractionFilter, List<? extends QuadrigeBean> elements) {
FilterDTO filter = getFilterOfType(extraction, extractionFilter);
if (filter == null) {
filter = ReefDbBeanFactory.newFilterDTO();
filter.setFilterTypeId(extractionFilter.getFilterTypeId());
extraction.addFilters(filter);
}
filter.setElements(elements);
}
public static List<String> getIdsAsString(Collection<? extends QuadrigeBean> beans) {
if (beans == null)
return null;
......@@ -903,4 +913,11 @@ public class ReefDbBeans extends QuadrigeBeans {
return beans.stream().map(bean -> bean instanceof CodeOnly ? ((CodeOnly) bean).getCode() : bean.getId().toString()).collect(Collectors.toList());
}
public static List<ExtractionPeriodDTO> getExtractionPeriods(ExtractionDTO extraction) {
FilterDTO periodFilter = getFilterOfType(extraction, ExtractionFilterValues.PERIOD);
if (periodFilter == null || periodFilter.getElements() == null) return new ArrayList<>();
return periodFilter.getElements().stream().map((Function<QuadrigeBean, ExtractionPeriodDTO>) ExtractionPeriodDTO.class::cast).collect(Collectors.toList());
}
}
......@@ -36,7 +36,7 @@ public enum ExtractionFilterValues {
PERIOD(null, n("reefdb.core.enums.extractionFilter.period"), false),
PROGRAM(FilterTypeId.PROGRAM, n("reefdb.core.enums.extractionFilter.program"), false),
LOCATION(FilterTypeId.MONITORING_LOCATION, n("reefdb.core.enums.extractionFilter.location"), false),
// CAMPAIGN(FilterTypeId.CAMPAIGN, n("reefdb.core.enums.extractionFilter.campaign"), false),
CAMPAIGN(FilterTypeId.CAMPAIGN, n("reefdb.core.enums.extractionFilter.campaign"), false),
TAXON(FilterTypeId.TAXON_NAME, n("reefdb.core.enums.extractionFilter.taxon"), false),
TAXON_GROUP(FilterTypeId.TAXON_GROUP, n("reefdb.core.enums.extractionFilter.taxonGroup"), false),
DEPARTMENT(FilterTypeId.DEPARTMENT, n("reefdb.core.enums.extractionFilter.department"), false),
......
......@@ -148,7 +148,7 @@ public class ExtractionPerformServiceImpl implements ExtractionPerformService {
context.setUniqueId(System.currentTimeMillis());
context.setRawTableName(String.format(RAW_TABLE_NAME_PATTERN, context.getUniqueId()));
context.setCommonTableName(String.format(COMMON_TABLE_NAME_PATTERN, context.getUniqueId()));
context.setSplitTableName(String.format(SPLIT_TABLE_NAME_PATTERN, context.getUniqueId()));
context.setResultTableName(String.format(SPLIT_TABLE_NAME_PATTERN, context.getUniqueId()));
// create the first temp table
createRawTable(context, outputType);
......@@ -220,7 +220,7 @@ public class ExtractionPerformServiceImpl implements ExtractionPerformService {
nbRowsInserted = insertSplitData(context, outputType);
progressionModel.increments(1);
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("%s rows of split data inserted into %s", nbRowsInserted, context.getSplitTableName()));
LOG.debug(String.format("%s rows of split data inserted into %s", nbRowsInserted, context.getResultTableName()));
}
// final query and write to csv file
......@@ -507,7 +507,7 @@ public class ExtractionPerformServiceImpl implements ExtractionPerformService {
private void createSplitTable(ExtractionContextDTO context, ExtractionOutputType outputType) {
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("DECLARE LOCAL TEMPORARY TABLE ").append(context.getSplitTableName()).append(" (");
queryBuilder.append("DECLARE LOCAL TEMPORARY TABLE ").append(context.getResultTableName()).append(" (");
queryBuilder.append("SURVEY_ID INTEGER, ");
queryBuilder.append("SURVEY_PROG_CD VARCHAR(40), ");
queryBuilder.append("MON_LOC_NM VARCHAR(100), ");
......@@ -889,7 +889,7 @@ public class ExtractionPerformServiceImpl implements ExtractionPerformService {
// common part
StringBuilder insertPart = new StringBuilder();
insertPart.append("INSERT INTO ").append(context.getSplitTableName()).append(LS);
insertPart.append("INSERT INTO ").append(context.getResultTableName()).append(LS);
insertPart.append("SELECT COMMON.SURVEY_ID, COMMON.SURVEY_PROG_CD, COMMON.MON_LOC_NM, COMMON.SURVEY_DT, COMMON.SAMPLING_OPER_ID, COMMON.SAMPLING_OPER_LB, COMMON.MON_LOC_ID, ");
insertPart.append("COMMON.MON_LOC_LB, COMMON.ORDER_ITEM_NM, COMMON.SURVEY_POSITION_LONG, COMMON.SURVEY_POSITION_LAT, COMMON.SAMPLING_EQUIPMENT_NM, COMMON.SAMPLING_OPER_DEP_NM, ");
if (outputType != ExtractionOutputType.PAMPA) {
......@@ -989,7 +989,7 @@ public class ExtractionPerformServiceImpl implements ExtractionPerformService {
query.append(join);
// filter out already present individual measurements
query.append("WHERE COMMON.MEAS_INDIV_ID IS NULL AND NOT EXISTS (SELECT * FROM ");
query.append(context.getSplitTableName());
query.append(context.getResultTableName());
query.append(" SPLIT WHERE SPLIT.SURVEY_ID = COMMON.SURVEY_ID AND SPLIT.SAMPLING_OPER_ID = COMMON.SAMPLING_OPER_ID AND SPLIT.MEAS_INDIV_ID IS NOT NULL )");
nbInsert += extractionResultDao.queryUpdate(query.toString(), null);
......@@ -1198,7 +1198,7 @@ public class ExtractionPerformServiceImpl implements ExtractionPerformService {
// add ordering clause
query.append("FROM ");
query.append(context.getSplitTableName());
query.append(context.getResultTableName());
query.append(" ORDER BY SURVEY_PROG_CD, MON_LOC_NM, SURVEY_DT, SAMPLING_OPER_LB, MEAS_INDIV_ID");
// some field formats
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -291,10 +291,10 @@ reefdb.service.common.progression=%s \: traitement de %s/%s
reefdb.service.control=Contrôle
reefdb.service.controlRule.invalid.message=La règle de contrôle '%s' n'est pas respectée
reefdb.service.extraction.error=Une erreur s'est produite lors de l'extration.
reefdb.service.extraction.fieldName.INPUT_TAXON_NAME_ID=${reefdb.service.extraction.fieldNamePrefix.MEAS}_Identifiant_interne_TAXON_NAME_ID
reefdb.service.extraction.fieldName.INPUT_TAXON_NAME_NM=Taxon_saisi
reefdb.service.extraction.fieldName.TAXON_NAME_ID=${reefdb.service.extraction.fieldNamePrefix.MEAS}_Identifiant_interne_TAXON_NAME_ID
reefdb.service.extraction.fieldName.TAXON_NAME_NM=Taxon_saisi
reefdb.service.extraction.fieldName.MEAS_CM=${reefdb.service.extraction.fieldNamePrefix.MEAS}_Commentaires
reefdb.service.extraction.fieldName.MEAS_DEP_NM=${reefdb.service.extraction.fieldNamePrefix.MEAS}_Organisme_analyste
reefdb.service.extraction.fieldName.MEAS_ANALYST_NM=${reefdb.service.extraction.fieldNamePrefix.MEAS}_Organisme_analyste
reefdb.service.extraction.fieldName.MEAS_IDS=${reefdb.service.extraction.fieldNamePrefix.MEAS}_Identifiants_interne_MEAS_ID
reefdb.service.extraction.fieldName.MEAS_INDIV_ID=${reefdb.service.extraction.fieldNamePrefix.MEAS}_Numero_individu
reefdb.service.extraction.fieldName.MON_LOC_ID=${reefdb.service.extraction.fieldNamePrefix.MON_LOC}_Identifiant
......@@ -325,7 +325,7 @@ reefdb.service.extraction.fieldName.SAMPLING_OPER_POSITION_LONG_MAX=${reefdb.ser
reefdb.service.extraction.fieldName.SAMPLING_OPER_POSITION_LONG_MIN=${reefdb.service.extraction.fieldNamePrefix.SAMPLING_OPER}_Coordonnees_MINX
reefdb.service.extraction.fieldName.SAMPLING_OPER_QUALIF_CM=${reefdb.service.extraction.fieldNamePrefix.SAMPLING_OPER}_Commentaire_qualification
reefdb.service.extraction.fieldName.SAMPLING_OPER_QUALIF_DT=${reefdb.service.extraction.fieldNamePrefix.SAMPLING_OPER}_Date_qualification
reefdb.service.extraction.fieldName.SAMPLING_OPER_QUAL_FLAG=${reefdb.service.extraction.fieldNamePrefix.SAMPLING_OPER}_Niveau_qualite
reefdb.service.extraction.fieldName.SAMPLING_OPER_QUAL_FLAG_NM=${reefdb.service.extraction.fieldNamePrefix.SAMPLING_OPER}_Niveau_qualite
reefdb.service.extraction.fieldName.SAMPLING_OPER_SIZE=${reefdb.service.extraction.fieldNamePrefix.SAMPLING_OPER}_Taille
reefdb.service.extraction.fieldName.SAMPLING_OPER_SIZE_UNIT_SYMBOL=${reefdb.service.extraction.fieldNamePrefix.SAMPLING_OPER}_Unite
reefdb.service.extraction.fieldName.SAMPLING_OPER_TIME=${reefdb.service.extraction.fieldNamePrefix.SAMPLING_OPER}_Heure
......@@ -343,13 +343,13 @@ reefdb.service.extraction.fieldName.SURVEY_POSITION_LONG_MIN=${reefdb.service.ex
reefdb.service.extraction.fieldName.SURVEY_PROG_CD=Programme
reefdb.service.extraction.fieldName.SURVEY_QUALIF_CM=${reefdb.service.extraction.fieldNamePrefix.SURVEY}_Commentaire_qualification
reefdb.service.extraction.fieldName.SURVEY_QUALIF_DT=${reefdb.service.extraction.fieldNamePrefix.SURVEY}_Date_qualification
reefdb.service.extraction.fieldName.SURVEY_QUAL_FLAG=${reefdb.service.extraction.fieldNamePrefix.SURVEY}_Niveau_qualite
reefdb.service.extraction.fieldName.SURVEY_QUAL_FLAG_NM=${reefdb.service.extraction.fieldNamePrefix.SURVEY}_Niveau_qualite
reefdb.service.extraction.fieldName.SURVEY_QUSERS=${reefdb.service.extraction.fieldNamePrefix.SURVEY}_Observateurs
reefdb.service.extraction.fieldName.SURVEY_TIME=${reefdb.service.extraction.fieldNamePrefix.SURVEY}_Heure
reefdb.service.extraction.fieldName.SURVEY_VALID_DT=${reefdb.service.extraction.fieldNamePrefix.SURVEY}_Date_validation
reefdb.service.extraction.fieldName.TAXON_GROUP_NM=Groupe_taxons
reefdb.service.extraction.fieldName.TAXON_MEAS_IDS=${reefdb.service.extraction.fieldNamePrefix.MEAS}_Identifiants_interne_TAXON_MEAS_ID
reefdb.service.extraction.fieldName.TAXON_NAME_NM=Taxon
reefdb.service.extraction.fieldName.REF_TAXON_NM=Taxon
reefdb.service.extraction.fieldName.TAXON_PAMPA=Taxon_pampa
reefdb.service.extraction.fieldNamePrefix.MEAS=MESURE
reefdb.service.extraction.fieldNamePrefix.MON_LOC=STATION
......
......@@ -1754,6 +1754,32 @@
<query-param name="programCode" type="java.lang.String"/>
</query>
<query name="appliedStrategiesByProgramCodes">
<![CDATA[
SELECT DISTINCT
a.appliedStratId,
p.progCd,
p.progNm,
p.status.statusCd,
s.id,
s.stratNm,
ap.id.appliedPeriodStartDt as startDt,
ap.appliedPeriodEndDt as endDt,
dep.depId
FROM
AppliedStrategyImpl a
INNER JOIN a.strategy s
INNER JOIN s.program p
LEFT OUTER JOIN a.appliedPeriods ap
LEFT OUTER JOIN a.department dep
WHERE
p.progCd IN (:programCodes)
ORDER BY
a.strategy.stratNm, ap.id.appliedPeriodStartDt
]]>
<query-param name="programCodes" type="java.lang.String"/>
</query>
<query name="analysisDepartmentByAppliedStrategyId">
<![CDATA[
SELECT DISTINCT
......@@ -1830,6 +1856,7 @@
a.appliedStratId,
p.progCd,
p.progNm,
p.status.statusCd,
s.id,
s.stratNm,
ap.id.appliedPeriodStartDt as startDt,
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
Dali :: Core
%%
Copyright (C) 2017 Ifremer
%%
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%
-->
<queries name="extractionCleanHermeticData">
<query type="delete" table="&amp;tableName">
<where><![CDATA[SURVEY_PROG_CD = '&programCode']]></where>
<where operator="AND"><![CDATA[REC_DEP_ID != &recDepId]]></where>
</query>
</queries>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
Dali :: Core
%%
Copyright (C) 2017 Ifremer
%%
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%
-->
<queries name="extractionCleanRawData">
<query type="delete" table="&amp;tableName">
<where>1=2</where>
<where operator="OR" group="taxonGroup">
<where>TAXON_GROUP_ID IS NULL</where>
<where operator="OR">
<notin field="TAXON_GROUP_ID"><![CDATA[&taxonGroupIds]]></notin>
</where>
</where>
<where operator="OR" group="taxonName">
<where>REF_TAXON_ID IS NULL</where>
<where operator="OR">
<where>
<notin field="REF_TAXON_ID"><![CDATA[&taxonNameIds]]></notin>
</where>
<where operator="AND" group="simple,complete,sinp">
<notin field="TAXON_NAME_ID"><![CDATA[&taxonNameIds]]></notin>
</where>
</where>
</where>
</query>
</queries>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
Dali :: Core
%%
Copyright (C) 2017 Ifremer
%%
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%
-->
<queries name="extractionCountFrom">
<query type="select">
<select alias="COUNT_ALL" type="number">COUNT(*)</select>
<from><![CDATA[&tableName]]></from>
</query>
</queries>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
Dali :: Core
%%
Copyright (C) 2017 Ifremer
%%
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%
-->
<queries name="extractionCreateCommonTable">
<query type="create" temp="false" table="&amp;commonTableName" option="DISTINCT">
<select alias="SURVEY_ID" type="number">RAW.SURVEY_ID</select>
<select alias="SAMPLING_OPER_ID" type="number">RAW.SAMPLING_OPER_ID</select>
<select alias="MEAS_INDIV_ID" type="number">RAW.MEAS_INDIV_ID</select>
<select alias="REF_TAXON_NM" type="text">RAW.REF_TAXON_NM</select>
<select alias="TAXON_NAME_ID" type="number">RAW.TAXON_NAME_ID</select>
<select alias="TAXON_NAME_NM" type="text">RAW.TAXON_NAME_NM</select>
<select alias="TAXON_GROUP_NM" type="text">RAW.TAXON_GROUP_NM</select>
<from alias="RAW"><![CDATA[&rawTableName]]></from>
<where><![CDATA[RAW.MEAS_INDIV_ID IS NOT NULL]]></where>
<union>
<subquery option="DISTINCT">
<subselect alias="SURVEY_ID" type="number">RAW.SURVEY_ID</subselect>
<subselect alias="SAMPLING_OPER_ID" type="number">RAW.SAMPLING_OPER_ID</subselect>
<subselect alias="MEAS_INDIV_ID" type="number">RAW.MEAS_INDIV_ID</subselect>
<subselect alias="REF_TAXON_NM" type="text">RAW.REF_TAXON_NM</subselect>
<subselect alias="TAXON_NAME_ID" type="number">RAW.TAXON_NAME_ID</subselect>
<subselect alias="TAXON_NAME_NM" type="text">RAW.TAXON_NAME_NM</subselect>
<subselect alias="TAXON_GROUP_NM" type="text">RAW.TAXON_GROUP_NM</subselect>
<from alias="RAW"><![CDATA[&rawTableName]]></from>
<where><![CDATA[RAW.MEAS_INDIV_ID IS NULL]]></where>
<where operator="AND"><![CDATA[NOT EXISTS (SELECT RAW2.SURVEY_ID FROM &rawTableName RAW2
WHERE RAW.SURVEY_ID = RAW2.SURVEY_ID
AND ((RAW.SAMPLING_OPER_ID IS NULL AND RAW2.SAMPLING_OPER_ID IS NULL) OR RAW.SAMPLING_OPER_ID = RAW2.SAMPLING_OPER_ID)
AND RAW2.MEAS_INDIV_ID IS NOT NULL)]]></where>
</subquery>
</union>
</query>
</queries>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
Dali :: Core
%%
Copyright (C) 2017 Ifremer
%%
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%
-->
<queries name="extractionCreatePmfmTable">
<query type="create" temp="false" table="&amp;pmfmTableName" option="DISTINCT">
<select alias="PARENT_ID" type="number"><![CDATA[&parentId]]></select>
<select alias="IS_SURVEY_MEAS" type="number">IS_SURVEY_MEAS</select>
<select alias="MEAS_INDIV_ID" type="number">MEAS_INDIV_ID</select>
<select alias="PMFM_ID" type="number">PMFM_ID</select>