Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: d8e8d799 by Tony CHEMIT at 2018-05-23T12:01:04Z Tableaux de synthèse - Closes #916 - - - - - 11 changed files: - client/src/main/java/fr/ird/observe/client/ui/admin/config/SelectDataModel.java - client/src/main/java/fr/ird/observe/client/ui/admin/report/ReportUI.jcss - client/src/main/java/fr/ird/observe/client/ui/admin/report/ReportUIHandler.java - services-client/src/test/java/fr/ird/observe/services/client/service/actions/report/AbstractReportServiceClientTest.java - services-local/src/main/java/fr/ird/observe/services/local/service/actions/report/ReportServiceLocal.java - services-local/src/test/java/fr/ird/observe/services/local/service/actions/report/AbstractReportServiceLocalTest.java - + services-local/src/test/java/fr/ird/observe/services/local/service/actions/report/ReportNonTargetDistributionLengthsTest.java - services/src/main/java/fr/ird/observe/services/service/actions/report/ReportBuilder.java - services/src/main/java/fr/ird/observe/services/service/actions/report/ReportRequest.java - services/src/main/java/fr/ird/observe/services/service/actions/report/ReportService.java - services/src/main/resources/observe-reports.properties Changes: ===================================== client/src/main/java/fr/ird/observe/client/ui/admin/config/SelectDataModel.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/admin/config/SelectDataModel.java +++ b/client/src/main/java/fr/ird/observe/client/ui/admin/config/SelectDataModel.java @@ -22,24 +22,28 @@ package fr.ird.observe.client.ui.admin.config; * #L% */ +import com.google.common.collect.ImmutableSet; import fr.ird.observe.client.db.ObserveSwingDataSource; import fr.ird.observe.client.ui.admin.AdminActionModel; import fr.ird.observe.client.ui.admin.AdminStep; import fr.ird.observe.client.ui.admin.AdminUIModel; import fr.ird.observe.client.ui.admin.report.ReportModel; import fr.ird.observe.client.ui.tree.selection.SelectionTreeModel; +import fr.ird.observe.dto.IdDto; import fr.ird.observe.dto.IdHelper; import fr.ird.observe.dto.ObserveModelType; import fr.ird.observe.dto.data.longline.TripLonglineReference; import fr.ird.observe.dto.data.seine.TripSeineReference; import fr.ird.observe.dto.reference.DataDtoReference; import fr.ird.observe.dto.reference.DataDtoReferenceSet; +import fr.ird.observe.services.service.actions.report.Report; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.List; import java.util.Set; +import java.util.stream.Collectors; /** * Created on 28/11/16. @@ -136,6 +140,17 @@ public class SelectDataModel extends AdminActionModel { return null; } + public ImmutableSet<DataDtoReference> getSelectedTrips() { + ImmutableSet.Builder<DataDtoReference> result = ImmutableSet.builder(); + Set<DataDtoReference<?, ?>> data = getSelectionDataModel().getSelectedData(); + for (DataDtoReference<?, ?> datum : data) { + if (IdHelper.isTrip(datum)) { + result.add(datum); + } + } + return result.build(); + } + public void start(AdminUIModel uiModel) { if (!uiModel.needSelect()) { @@ -236,10 +251,14 @@ public class SelectDataModel extends AdminActionModel { // il faut exactement une Trip de selectionnee int selectedCount = selectionDataModel.getSelectedCount(); - validate = selectedCount == 1; + validate = selectedCount > 0; } } return validate; } + + public ImmutableSet<String> getSelectedTripIds() { + return ImmutableSet.copyOf(getSelectedTrips().stream().map(IdDto::getId).collect(Collectors.toSet())); + } } ===================================== client/src/main/java/fr/ird/observe/client/ui/admin/report/ReportUI.jcss ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/admin/report/ReportUI.jcss +++ b/client/src/main/java/fr/ird/observe/client/ui/admin/report/ReportUI.jcss @@ -71,7 +71,7 @@ JToolBar { } #reportDescription { - text:{getHandler().updateSelectedReportDescrption(stepModel.getSelectedReport())}; + text:{getHandler().updateSelectedReportDescription(stepModel.getSelectedReport())}; editable:false; focusable:false; } ===================================== client/src/main/java/fr/ird/observe/client/ui/admin/report/ReportUIHandler.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/admin/report/ReportUIHandler.java +++ b/client/src/main/java/fr/ird/observe/client/ui/admin/report/ReportUIHandler.java @@ -6,22 +6,22 @@ * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the + * 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 General Public + * + * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. * #L% */ package fr.ird.observe.client.ui.admin.report; -import com.google.common.collect.Lists; +import com.google.common.collect.ImmutableSet; import fr.ird.observe.client.ObserveSwingTechnicalException; import fr.ird.observe.client.db.ObserveSwingDataSource; import fr.ird.observe.client.ui.admin.AdminStep; @@ -57,6 +57,7 @@ import java.awt.Component; import java.awt.Font; import java.awt.event.ItemEvent; import java.io.File; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; @@ -71,7 +72,7 @@ import static org.nuiton.i18n.I18n.t; */ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHandler<ReportUI> { - public static final String VARIABLE_NAME = "variableName"; + private static final String VARIABLE_NAME = "variableName"; /** Logger */ private static final Log log = LogFactory.getLog(ReportUIHandler.class); @@ -142,14 +143,14 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa Font headerFont; - public Font getDefaultFont(JTable table) { + Font getDefaultFont(JTable table) { if (defaultFont == null) { defaultFont = table.getFont(); } return defaultFont; } - public Font getHeaderFont(JTable table) { + Font getHeaderFont(JTable table) { if (headerFont == null) { headerFont = getDefaultFont(table).deriveFont(Font.BOLD); } @@ -187,13 +188,13 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa configUI.getExtraConfig().add(extraConfig); } - public void setModelTypeFromEvent(ItemEvent event) { + void setModelTypeFromEvent(ItemEvent event) { if (event.getStateChange() == ItemEvent.SELECTED) { getStepModel().setModelType((ObserveModelType) event.getItem()); } } - public void updateSelectedReportFromEvent(ItemEvent event) { + void updateSelectedReportFromEvent(ItemEvent event) { if (event.getStateChange() == ItemEvent.SELECTED) { if (log.isInfoEnabled()) { @@ -204,7 +205,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa } } - public void updateSelectedReport(Report report) { + void updateSelectedReport(Report report) { ui.getModel().setBusy(true); try { if (log.isInfoEnabled()) { @@ -217,14 +218,14 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa } } - public String updateSelectedReportDescrption(Report report) { + String updateSelectedReportDescription(Report report) { if (report == null) { return t("observe.message.no.report.selected"); } return t(report.getDescription()); } - public void updateVariable(JComboBox combo, Object value) { + private void updateVariable(JComboBox combo, Object value) { String variableName = (String) combo.getClientProperty(VARIABLE_NAME); if (variableName == null) { throw new IllegalStateException( @@ -236,7 +237,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa getStepModel().addVariable(variableName, value); } - public void chooseReportFile() { + void chooseReportFile() { ReportModel model = ui.getModel().getReportModel(); File f = UIHelper.chooseFile( ui, @@ -248,10 +249,10 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa model.setReportFile(f); } - public void copyReportToClipBoard(Report report, - ResultTableModel model, - boolean copyRowHeaders, - boolean copyColumnHeaders) { + void copyReportToClipBoard(Report report, + ResultTableModel model, + boolean copyRowHeaders, + boolean copyColumnHeaders) { if (report == null) { // pas de report sélectionné, rien à faire @@ -261,13 +262,13 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa if (log.isDebugEnabled()) { log.debug("Will copy result of report " + report.getName()); log.debug("Result dimension : [" + model.getRowCount() + "," + - model.getColumnCount() + "]"); + model.getColumnCount() + "]"); } String content = model.getClipbordContent(copyRowHeaders, copyColumnHeaders); UIHelper.copyToClipBoard(content); } - protected void onReportsChanged(ReportUI tabUI, List<?> newValue) { + private void onReportsChanged(ReportUI tabUI, List<?> newValue) { if (log.isDebugEnabled()) { log.debug("New reports : " + newValue); @@ -281,7 +282,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa } @SuppressWarnings({"unchecked"}) - protected void onSelectedReportChanged(ReportUI tabUI, ReportModel model, Report report) { + private void onSelectedReportChanged(ReportUI tabUI, ReportModel model, Report report) { if (log.isInfoEnabled()) { log.info("New selected report [" + report + "]"); @@ -309,7 +310,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa ReportService reportService = dataSource.getReportService(); - report = reportService.populateVariables(report, ui.getModel().getSelectDataModel().getSelectedTrip().getId()); + report = reportService.populateVariables(report, ui.getModel().getSelectDataModel().getSelectedTripIds()); } catch (Exception e) { throw new ObserveSwingTechnicalException("unable to populate report : " + report.getName(), e); @@ -322,7 +323,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa String variableName = variable.getName(); // String value = variables.get(variableName); Set values = variable.getValues(); - List<Object> universe = Lists.newArrayList(values); + List<Object> universe = new ArrayList<>(values); BeanComboBox<Object> combo = new BeanComboBox<>(); combo.setShowReset(true); @@ -372,7 +373,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa } } - protected void onVariablesChanges(ReportModel model, Map<String, Object> variables) { + private void onVariablesChanges(ReportModel model, Map<String, Object> variables) { Report report = model.getSelectedReport(); if (report != null) { @@ -381,7 +382,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa } } - protected void onValidChanged(ReportModel model, boolean valid) { + private void onValidChanged(ReportModel model, boolean valid) { if (log.isInfoEnabled()) { log.info("valid state changed to " + valid); @@ -399,11 +400,10 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa Report report = model.getSelectedReport(); + ImmutableSet<String> tripIds = ui.getModel().getSelectDataModel().getSelectedTripIds(); DataDtoReference trip = ui.getModel().getSelectDataModel().getSelectedTrip(); - if (log.isDebugEnabled()) { - log.debug("Build result for report [" + report.getName() + "] on " + trip); - } + log.info(String.format("Build result for report [%s] on %s", report.getName(), trip)); Map<String, Object> variables = model.getVariables(); @@ -421,13 +421,11 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa ReportService reportService = dataSource.getReportService(); - DataMatrix data = reportService.executeReport(report, trip.getId()); + DataMatrix data = reportService.executeReport(report, tripIds); timeLog.log(startTime, "execute", report.getName()); - if (log.isInfoEnabled()) { - log.info("Result to dispaly:\n" + data.getClipboardContent(true, true, false, '\t')); - } + log.info("Result to display:\n" + data.getClipboardContent(true, true, false, '\t')); // calcul des données et contruction du tableau model.getResultModel().populate(report, data); @@ -435,21 +433,15 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa // mise a jour du clipboard automatique si requis if (model.isAutoCopyToClipboard()) { copyReportToClipBoard(report, - model.getResultModel(), - model.isCopyRowHeaders(), - model.isCopyColumnHeaders()); + model.getResultModel(), + model.isCopyRowHeaders(), + model.isCopyColumnHeaders()); } - } catch (Exception e) { - UIHelper.handlingError("Could not obtain report data", e); - model.getResultModel().clear(); - } finally { - ui.getModel().setBusy(false); - } } @@ -457,15 +449,13 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa return ui.getModel().getReportModel(); } - protected void updateValidState(Report report, Map<String, Object> variables) { - + private void updateValidState(Report report, Map<String, Object> variables) { boolean canExecute = report != null && report.canExecute(variables); getStepModel().setValid(canExecute); } public void destroy() { ObserveSwingDataSource dataSource = ui.getModel().getConfigModel().getSafeLocalSource(false); - if (dataSource.isOpen()) { dataSource.close(); } ===================================== services-client/src/test/java/fr/ird/observe/services/client/service/actions/report/AbstractReportServiceClientTest.java ===================================== --- a/services-client/src/test/java/fr/ird/observe/services/client/service/actions/report/AbstractReportServiceClientTest.java +++ b/services-client/src/test/java/fr/ird/observe/services/client/service/actions/report/AbstractReportServiceClientTest.java @@ -6,15 +6,15 @@ * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the + * 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 General Public + * + * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. * #L% @@ -22,6 +22,7 @@ package fr.ird.observe.services.client.service.actions.report; +import com.google.common.collect.ImmutableSet; import fr.ird.observe.dto.reference.DtoReference; import fr.ird.observe.services.client.service.ServiceClientTestSupport; import fr.ird.observe.services.service.actions.report.DataMatrix; @@ -43,7 +44,7 @@ import java.util.List; /** * Classe abstraite de test d'un report. - * + * <p> * On définit ici le mécanisme pour tester unitairement un report et son * résultat. * @@ -54,15 +55,45 @@ public abstract class AbstractReportServiceClientTest extends ServiceClientTestS /** Logger */ private static final Log log = LogFactory.getLog(AbstractReportServiceClientTest.class); - - protected ReportService service; - /** La liste de tous les reports connus. */ protected static List<Report> reports; - + protected ReportService service; /** Le report à tester. */ private Report report; + protected static Report getReport(Log log, String reportId) throws IOException { + if (reports == null) { + + URL reportLocation = + AbstractReportServiceClientTest.class.getResource("/observe-reports.properties"); + + if (log.isInfoEnabled()) { + log.info("Loading reports from " + reportLocation); + } + + ReportBuilder builder = new ReportBuilder(); + + reports = builder.load(reportLocation); + + builder.clear(); + + Assert.assertNotNull(reports); + Assert.assertFalse(reports.isEmpty()); + } + + Report result = null; + // recuperation du report à tester + for (Report report : reports) { + if (reportId.equals(report.getId())) { + result = report; + break; + } + } + + Assert.assertNotNull("Could not find report with id " + reportId, reports); + return result; + } + protected abstract String getReportId(); @Before @@ -81,16 +112,14 @@ public abstract class AbstractReportServiceClientTest extends ServiceClientTestS } - /** * L'unique test à lancer. - * + * <p> * On vérifie : * <ul> * <li>la syntaxe du report via {@link #testReportSyntax(Report)}</li> * <li>le résultat du report via {@link #testReportResult(DataMatrix)}</li> * </ul> - * */ @Test public final void testReport() { @@ -99,23 +128,25 @@ public abstract class AbstractReportServiceClientTest extends ServiceClientTestS testReportSyntax(report); // creation de l'executeur de report - report = service.populateVariables(report, ObserveFixtures.TRIP_SEINE_ID_1); + ImmutableSet<String> tripIds = getTripIds(); + report = service.populateVariables(report, tripIds); // preparation des variables prepareVariables(); // on execute le report - DataMatrix result = service.executeReport(report,ObserveFixtures. TRIP_SEINE_ID_1); - - if (log.isInfoEnabled()) { - log.info("Result :\n" + result.getClipboardContent(true, true, false, '\t')); - } + DataMatrix result = service.executeReport(report, tripIds); + log.info("Result :\n" + result.getClipboardContent(true, true, false, '\t')); // on verifie le resultat testReportResult(result); } + protected ImmutableSet<String> getTripIds() { + return ImmutableSet.of(ObserveFixtures.TRIP_SEINE_ID_1); + } + protected void prepareVariables() { } @@ -127,9 +158,9 @@ public abstract class AbstractReportServiceClientTest extends ServiceClientTestS if (variableName.equals(variable.getName())) { Object value = variable.getValues().stream() - .filter(DtoReference.newIdPredicate(id)) - .findFirst() - .orElse(null); + .filter(DtoReference.newIdPredicate(id)) + .findFirst() + .orElse(null); variable.setSelectedValue(value); @@ -143,39 +174,6 @@ public abstract class AbstractReportServiceClientTest extends ServiceClientTestS protected abstract void testReportResult(DataMatrix result); - protected static Report getReport(Log log, String reportId) throws IOException { - if (reports == null) { - - URL reportLocation = - AbstractReportServiceClientTest.class.getResource("/observe-reports.properties"); - - if (log.isInfoEnabled()) { - log.info("Loading reports from " + reportLocation); - } - - ReportBuilder builder = new ReportBuilder(); - - reports = builder.load(reportLocation); - - builder.clear(); - - Assert.assertNotNull(reports); - Assert.assertFalse(reports.isEmpty()); - } - - Report result = null; - // recuperation du report à tester - for (Report report : reports) { - if (reportId.equals(report.getId())) { - result = report; - break; - } - } - - Assert.assertNotNull("Could not find report with id " + reportId, reports); - return result; - } - protected void assertReportName(Report report, String name, String description) { ===================================== services-local/src/main/java/fr/ird/observe/services/local/service/actions/report/ReportServiceLocal.java ===================================== --- a/services-local/src/main/java/fr/ird/observe/services/local/service/actions/report/ReportServiceLocal.java +++ b/services-local/src/main/java/fr/ird/observe/services/local/service/actions/report/ReportServiceLocal.java @@ -22,6 +22,7 @@ package fr.ird.observe.services.local.service.actions.report; * #L% */ +import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; import fr.ird.observe.dto.data.DataDto; import fr.ird.observe.dto.reference.DataDtoReferenceSet; @@ -66,11 +67,11 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer private static final Log log = LogFactory.getLog(ReportServiceLocal.class); @Override - public Report populateVariables(Report report, String tripId) { + public Report populateVariables(Report report, ImmutableSet<String> tripIds) { Map<String, Object> vars = new TreeMap<>(); - vars.put(ReportRequest.TRIP_ID_VARIABLE, tripId); + vars.put(ReportRequest.TRIP_ID_VARIABLE, tripIds); for (ReportVariable variable : report.getVariables()) { @@ -116,7 +117,7 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer } @Override - public DataMatrix executeReport(Report report, String tripId) { + public DataMatrix executeReport(Report report, ImmutableSet<String> tripId) { if (report == null) { @@ -171,7 +172,7 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer return result; } - private DataMatrix executeReportOperation(ReportOperation executeRequests, Report report, String tripId, DataMatrix incoming) { + private DataMatrix executeReportOperation(ReportOperation executeRequests, Report report, ImmutableSet<String> tripId, DataMatrix incoming) { DataMatrix result = incoming; @@ -413,7 +414,7 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer return result; } - private DataMatrix executeReportRequest(ReportRequest request, Report report, String tripId, ReportVariable repeatValues) { + private DataMatrix executeReportRequest(ReportRequest request, Report report, ImmutableSet<String> tripId, ReportVariable repeatValues) { DataMatrix result = new DataMatrix(); @@ -457,7 +458,7 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer return result; } - private DataMatrix executeReportRequest(ReportRequest request, Report report, String tripId) { + private DataMatrix executeReportRequest(ReportRequest request, Report report, ImmutableSet<String> tripId) { Map<String, Object> params = ReportRequest.extractParams(report, tripId); return executeReportRequest(request, params); @@ -653,7 +654,7 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer return dao.findAllFromHql(request, paramsFixes); } - private void doPopulateRepeatVariables(Report report, String tripId) { + private void doPopulateRepeatVariables(Report report, ImmutableSet<String> tripId) { Map<String, Object> vars = ReportRequest.extractParams(report, tripId); ===================================== services-local/src/test/java/fr/ird/observe/services/local/service/actions/report/AbstractReportServiceLocalTest.java ===================================== --- a/services-local/src/test/java/fr/ird/observe/services/local/service/actions/report/AbstractReportServiceLocalTest.java +++ b/services-local/src/test/java/fr/ird/observe/services/local/service/actions/report/AbstractReportServiceLocalTest.java @@ -22,6 +22,7 @@ package fr.ird.observe.services.local.service.actions.report; +import com.google.common.collect.ImmutableSet; import fr.ird.observe.dto.reference.DtoReference; import fr.ird.observe.services.local.service.ServiceLocalTestSupport; import fr.ird.observe.services.service.actions.report.DataMatrix; @@ -33,15 +34,16 @@ import fr.ird.observe.services.service.actions.report.ReportVariable; import fr.ird.observe.test.DatabaseName; import fr.ird.observe.test.ObserveFixtures; import fr.ird.observe.test.spi.DatabaseNameConfiguration; -import java.io.IOException; -import java.net.URL; -import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import java.io.IOException; +import java.net.URL; +import java.util.List; + /** * Classe abstraite de test d'un report. * <p> @@ -98,24 +100,28 @@ public abstract class AbstractReportServiceLocalTest extends ServiceLocalTestSup // test de la syntaxe du report testReportSyntax(report); + ImmutableSet<String> tripIds = getTripIds(); + // creation de l'executeur de report - report = service.populateVariables(report, ObserveFixtures.TRIP_SEINE_ID_1); + report = service.populateVariables(report, tripIds); // preparation des variables prepareVariables(); // on execute le report - DataMatrix result = service.executeReport(report, ObserveFixtures.TRIP_SEINE_ID_1); + DataMatrix result = service.executeReport(report, tripIds); - if (log.isInfoEnabled()) { - log.info("Result :\n" + result.getClipboardContent(true, true, true, ',')); - } + log.info(String.format("Result :\n%s", result.getClipboardContent(true, true, true, ','))); // on verifie le resultat testReportResult(result); } + protected ImmutableSet<String> getTripIds() { + return ImmutableSet.of(ObserveFixtures.TRIP_SEINE_ID_1); + } + protected void prepareVariables() { } ===================================== services-local/src/test/java/fr/ird/observe/services/local/service/actions/report/ReportNonTargetDistributionLengthsTest.java ===================================== --- /dev/null +++ b/services-local/src/test/java/fr/ird/observe/services/local/service/actions/report/ReportNonTargetDistributionLengthsTest.java @@ -0,0 +1,89 @@ +/* + * #%L + * ObServe :: Services local implementation + * %% + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ +package fr.ird.observe.services.local.service.actions.report; + + +import com.google.common.collect.ImmutableSet; +import fr.ird.observe.services.service.actions.report.DataMatrix; +import fr.ird.observe.services.service.actions.report.Report; +import fr.ird.observe.services.service.actions.report.ReportRequest; +import fr.ird.observe.test.ObserveFixtures; +import org.junit.Assert; + +/** + * Test du report {@code accessoryCatch}. + * + * @author Tony Chemit - dev@tchemit.fr + * @since 1.9 + */ +public class ReportNonTargetDistributionLengthsTest extends AbstractReportServiceLocalTest { + + @Override + protected void testReportSyntax(Report report) { + Assert.assertNotNull(report); + assertReportName( + report, + "Distribution des tailles par espèces non ciblées", + "Afficher la nombre d'individus mesurés par classe de taille pour les espèces non ciblées" + ); + + assertReportDimension( + report, + -1, + 2, + new String[]{"Classe de taille", "Effectif"} + ); + + assertReportNbRequests(report, 1); + + ReportRequest[] requests = report.getRequests(); + + assertReportRequestDimension( + requests[0], + ReportRequest.RequestLayout.row, + 0, + 0 + ); + + } + + @Override + protected String getReportId() { + return "nonTargetDistributionLengths"; + } + + @Override + protected ImmutableSet<String> getTripIds() { + return ImmutableSet.of(ObserveFixtures.TRIP_SEINE_ID_1, ObserveFixtures.TRIP_SEINE_ID_2); + } + + @Override + protected void prepareVariables() { + setVariableValue("speciesId", "fr.ird.observe.entities.referentiel.Species#1239832684439#0.9130769003657221"); + } + + @Override + protected void testReportResult(DataMatrix result) { + assertResultDimension(result, 2, 1, 0, 1); + assertResultRow(result, 0, "14.0", "1"); + } +} ===================================== services/src/main/java/fr/ird/observe/services/service/actions/report/ReportBuilder.java ===================================== --- a/services/src/main/java/fr/ird/observe/services/service/actions/report/ReportBuilder.java +++ b/services/src/main/java/fr/ird/observe/services/service/actions/report/ReportBuilder.java @@ -23,6 +23,7 @@ package fr.ird.observe.services.service.actions.report; import fr.ird.observe.dto.ObserveModelType; +import io.ultreia.java4all.lang.Objects2; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.SortedProperties; @@ -50,24 +51,24 @@ import java.util.regex.Pattern; */ public class ReportBuilder { - public static final Pattern REPORT_DEFINITION_PATTERN = Pattern.compile("report.(\\w+).name"); + private static final Pattern REPORT_DEFINITION_PATTERN = Pattern.compile("report.(\\w+).name"); - public static final String REQUEST_PREFIX = "request."; + private static final String REQUEST_PREFIX = "request."; - public static final String OPERATION_PREFIX = "operations."; + private static final String OPERATION_PREFIX = "operations."; - public static final String VARIABLE_PREFIX = "variable."; + private static final String VARIABLE_PREFIX = "variable."; - public static final String REPEAT_VARIABLE_PREFIX = "repeatVariable."; + private static final String REPEAT_VARIABLE_PREFIX = "repeatVariable."; /** Logger */ private static final Log log = LogFactory.getLog(ReportBuilder.class); /** les propriétés chargées par le builder pour construire les reports */ - protected Properties properties; + private Properties properties; /** la liste des lastName sde reports connus par le système */ - protected List<String> reportNames; + private List<String> reportNames; /** les operations connues par le système */ protected static Map<String, Class<?>> operations; @@ -96,7 +97,7 @@ public class ReportBuilder { } - protected List<String> detectReportNames() { + private List<String> detectReportNames() { List<String> reportNames = new ArrayList<>(); Enumeration<Object> keys = properties.keys(); while (keys.hasMoreElements()) { @@ -162,7 +163,7 @@ public class ReportBuilder { ); } - protected Map<String, String> detectReportProperties(String reportName) { + private Map<String, String> detectReportProperties(String reportName) { Map<String, String> dico = new TreeMap<>(); @@ -237,8 +238,8 @@ public class ReportBuilder { return result.toArray(new ReportRequest[0]); } - protected ReportRequest getRequest(String requestDef, - String requestRepeatDef) { + private ReportRequest getRequest(String requestDef, + String requestRepeatDef) { String[] parts = requestDef.split("\\|"); if (parts.length != 3) { @@ -310,7 +311,7 @@ public class ReportBuilder { return result.toArray(new ReportOperation[0]); } - protected ReportVariable[] getVariables(String reportName, Map<String, String> dico) { + private ReportVariable[] getVariables(String reportName, Map<String, String> dico) { List<ReportVariable> result = new ArrayList<>(); Iterator<Map.Entry<String, String>> itr = dico.entrySet().iterator(); List<String> ids = new ArrayList<>(); @@ -331,7 +332,7 @@ public class ReportBuilder { // on interdit l'utilisation de la variable tripId if (ReportRequest.TRIP_ID_VARIABLE.equals(id)) { - throw new IllegalArgumentException("La variable tripId n'est pas utilisable (c'est uen variable réservée) pour le report " + reportName); + throw new IllegalArgumentException("La variable tripId n'est pas utilisable (c'est une variable réservée) pour le report " + reportName); } ids.add(id); String[] parts = operations.split("\\|"); @@ -341,13 +342,8 @@ public class ReportBuilder { } String typeStr = parts[0].trim(); String request = parts[1].trim(); - Class<?> type; - try { - type = Class.forName(typeStr); - } catch (ClassNotFoundException eee) { - throw new IllegalArgumentException("Le type " + typeStr + " n'est pas connu", eee); - } - ReportVariable variable = new ReportVariable(id, type, request); + Class<?> type = Objects2.forName(typeStr); + ReportVariable<?> variable = new ReportVariable<>(id, type, request); log.debug(String.format("Detects a variable : [%s:%s] = %s (type = %s)", reportName, variable.getName(), variable.getRequest(), variable.getType().getName())); result.add(variable); itr.remove(); @@ -355,7 +351,7 @@ public class ReportBuilder { return result.toArray(new ReportVariable[0]); } - protected ReportVariable[] getRepeatVariables(String reportName, Map<String, String> dico) { + private ReportVariable[] getRepeatVariables(String reportName, Map<String, String> dico) { List<ReportVariable> result = new ArrayList<>(); Iterator<Map.Entry<String, String>> itr = dico.entrySet().iterator(); List<String> ids = new ArrayList<>(); @@ -386,12 +382,7 @@ public class ReportBuilder { } String typeStr = parts[0].trim(); String request = parts[1].trim(); - Class<?> type = null; - try { - type = Class.forName(typeStr); - } catch (ClassNotFoundException eee) { - throw new IllegalArgumentException("Le type " + typeStr + " n'est pas connu", eee); - } + Class<?> type = Objects2.forName(typeStr); ReportVariable<?> variable = new ReportVariable<>(id, type, request); log.debug(String.format("Detects a variable : [%s:%s] = %s (type = %s)", reportName, variable.getName(), variable.getRequest(), variable.getType().getName())); result.add(variable); ===================================== services/src/main/java/fr/ird/observe/services/service/actions/report/ReportRequest.java ===================================== --- a/services/src/main/java/fr/ird/observe/services/service/actions/report/ReportRequest.java +++ b/services/src/main/java/fr/ird/observe/services/service/actions/report/ReportRequest.java @@ -21,6 +21,7 @@ */ package fr.ird.observe.services.service.actions.report; +import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; import fr.ird.observe.dto.ObserveDto; import org.apache.commons.lang3.builder.ToStringBuilder; @@ -134,7 +135,7 @@ public class ReportRequest implements Serializable, ObserveDto { return repeat; } - public static Map<String, Object> extractParams(Report report, String tripId) { + public static Map<String, Object> extractParams(Report report, ImmutableSet<String> tripId) { Map<String, Object> params = Maps.newHashMap(); ===================================== services/src/main/java/fr/ird/observe/services/service/actions/report/ReportService.java ===================================== --- a/services/src/main/java/fr/ird/observe/services/service/actions/report/ReportService.java +++ b/services/src/main/java/fr/ird/observe/services/service/actions/report/ReportService.java @@ -22,6 +22,7 @@ package fr.ird.observe.services.service.actions.report; * #L% */ +import com.google.common.collect.ImmutableSet; import fr.ird.observe.services.service.ObserveService; import fr.ird.observe.services.spi.ReadDataPermission; import fr.ird.observe.services.spi.ReadReferentialPermission; @@ -35,10 +36,10 @@ public interface ReportService extends ObserveService { @ReadDataPermission @ReadReferentialPermission @Post - Report populateVariables(Report report, String tripId); + Report populateVariables(Report report, ImmutableSet<String> tripId); @ReadDataPermission @ReadReferentialPermission @Post - DataMatrix executeReport(Report report, String tripId); + DataMatrix executeReport(Report report, ImmutableSet<String> tripId); } ===================================== services/src/main/resources/observe-reports.properties ===================================== --- a/services/src/main/resources/observe-reports.properties +++ b/services/src/main/resources/observe-reports.properties @@ -33,7 +33,7 @@ report.tripSeineGearUseFeatures.repeatVariable.gearUseFeaturesId=java.lang.Strin From TripSeineImpl m \ Join m.gearUseFeaturesSeine g \ Where \ - m.id = :tripId \ + m.id In :tripId \ and g in elements (m.gearUseFeaturesSeine) \ Order By g.gear.label2 @@ -60,7 +60,7 @@ report.tripLonglineGearUseFeatures.repeatVariable.gearUseFeaturesId=java.lang.St From TripLonglineImpl m \ Join m.gearUseFeaturesLongline g \ Where \ - m.id = :tripId \ + m.id In :tripId \ and g in elements (m.gearUseFeaturesLongline) \ Order By g.gear.label2 @@ -88,7 +88,7 @@ report.activityWithComment.request.1=0,0|row|\ Join r.activitySeine a \ Join a.vesselActivitySeine ab \ Where \ - m.id = :tripId \ + m.id In :tripId \ and a.comment is not null \ Order By r.date, a.time @@ -106,7 +106,7 @@ report.allActivitys.request.1=0,0|row|\ Join r.activitySeine a \ Join a.vesselActivitySeine ab \ Where \ - m.id = :tripId \ + m.id In :tripId \ Order By r.date, a.time ################################################################################ @@ -124,7 +124,7 @@ report.dailySetAndCatch.request.1=0,0|row|\ Join a.setSeine s \ left join s.targetCatch as ct \ Where \ - m.id = :tripId \ + m.id In :tripId \ Group By r.date \ Order By r.date @@ -143,7 +143,7 @@ report.dcpUsage.repeatVariable.typeObjetId=java.lang.String|\ Join a.floatingObject dcp \ Join dcp.objectType to \ Where \ - m.id = :tripId \ + m.id In :tripId \ Order by to.code report.dcpUsage.request.1=0,0|row|\ @@ -160,7 +160,7 @@ report.dcpUsage.request.2=1,0|row|\ Join r.activitySeine a \ Join a.floatingObject dcp \ Where \ - m.id = :tripId \ + m.id In :tripId \ and dcp.objectType.id = :typeObjetId \ and dcp.objectOperation.id = 'fr.ird.observe.entities.referentiel.seine.ObjectOperation#1239832686249#0.8268884472438458' report.dcpUsage.request.2.repeat=typeObjetId|column @@ -172,7 +172,7 @@ report.dcpUsage.request.3=2,0|row|\ Join r.activitySeine a \ Join a.floatingObject dcp \ Where \ - m.id = :tripId \ + m.id In :tripId \ and dcp.objectType.id = :typeObjetId \ and dcp.objectOperation.id = 'fr.ird.observe.entities.referentiel.seine.ObjectOperation#1239832686249#0.8431519556575698' report.dcpUsage.request.3.repeat=typeObjetId|column @@ -184,7 +184,7 @@ report.dcpUsage.request.4=3,0|row|\ Join r.activitySeine a \ Join a.floatingObject dcp \ Where \ - m.id = :tripId \ + m.id In :tripId \ and dcp.objectType.id = :typeObjetId \ and dcp.objectOperation.id = 'fr.ird.observe.entities.referentiel.seine.ObjectOperation#1239832686248#0.8669327599318251' report.dcpUsage.request.4.repeat=typeObjetId|column @@ -196,7 +196,7 @@ report.dcpUsage.request.5=4,0|row|\ Join r.activitySeine a \ Join a.floatingObject dcp \ Where \ - m.id = :tripId \ + m.id In :tripId \ and dcp.objectType.id = :typeObjetId \ and dcp.objectFate.id = 'fr.ird.observe.entities.referentiel.seine.ObjectFate#1396860761530#0.8869464242156488' \ and dcp.objectOperation.id != 'fr.ird.observe.entities.referentiel.seine.ObjectOperation#1239832686248#0.8669327599318251' @@ -209,7 +209,7 @@ report.dcpUsage.request.6=5,0|row|\ Join r.activitySeine a \ Join a.floatingObject dcp \ Where \ - m.id = :tripId \ + m.id In :tripId \ and dcp.objectType.id = :typeObjetId \ and dcp.objectOperation.id = 'fr.ird.observe.entities.referentiel.seine.ObjectOperation#1239832686249#0.7838704130950722' report.dcpUsage.request.6.repeat=typeObjetId|column @@ -222,7 +222,7 @@ report.dcpUsage.request.7=6,0|row| \ Join a.floatingObject dcp \ Join dcp.objectObservedSpecies efo \ Where \ - m.id = :tripId \ + m.id In :tripId \ and dcp.objectType.id = :typeObjetId \ and efo.species.speciesGroup.id = 'fr.ird.observe.entities.referentiel.SpeciesGroup#1239832683690#0.24333033683679461' report.dcpUsage.request.7.repeat=typeObjetId|column @@ -244,7 +244,7 @@ report.setByAssociation.request.1=0,0|column|\ Join r.activitySeine a, \ ObservedSystemImpl os \ Where \ - m.id = :tripId \ + m.id In :tripId \ and a.setSeine.schoolType = 2 \ and a.setSeine.reasonForNullSet is null \ and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \ @@ -257,7 +257,7 @@ report.setByAssociation.request.2=0,1|column|\ Join r.activitySeine a, \ ObservedSystemImpl os \ Where \ - m.id = :tripId \ + m.id In :tripId \ and a.setSeine.schoolType = 2 \ and a.setSeine.reasonForNullSet is not null \ and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \ @@ -270,7 +270,7 @@ report.setByAssociation.request.3=1,0|column|\ Join r.activitySeine a, \ ObservedSystemImpl os \ Where \ - m.id = :tripId \ + m.id In :tripId \ and a.setSeine.schoolType = 2 \ and a.setSeine.reasonForNullSet is null \ and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \ @@ -283,7 +283,7 @@ report.setByAssociation.request.4=1,1|column|\ Join r.activitySeine a, \ ObservedSystemImpl os \ Where \ - m.id = :tripId \ + m.id In :tripId \ and a.setSeine.schoolType = 2 \ and a.setSeine.reasonForNullSet is not null \ and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \ @@ -296,7 +296,7 @@ report.setByAssociation.request.5=2,0|column|\ Join r.activitySeine a, \ ObservedSystemImpl os \ Where \ - m.id = :tripId \ + m.id In :tripId \ and a.setSeine.schoolType = 1 \ and a.setSeine.reasonForNullSet is null \ and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \ @@ -309,7 +309,7 @@ report.setByAssociation.request.6=2,1|column|\ Join r.activitySeine a, \ ObservedSystemImpl os \ Where \ - m.id = :tripId \ + m.id In :tripId \ and a.setSeine.schoolType = 1 \ and a.setSeine.reasonForNullSet is not null \ and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \ @@ -322,7 +322,7 @@ report.setByAssociation.request.7=3,0|column|\ Join r.activitySeine a, \ ObservedSystemImpl os \ Where \ - m.id = :tripId \ + m.id In :tripId \ and a.setSeine.schoolType = 1 \ and a.setSeine.reasonForNullSet is null \ and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \ @@ -335,7 +335,7 @@ report.setByAssociation.request.8=3,1|column|\ Join r.activitySeine a, \ ObservedSystemImpl os \ Where \ - m.id = :tripId \ + m.id In :tripId \ and a.setSeine.schoolType = 1 \ and a.setSeine.reasonForNullSet is not null \ and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \ @@ -380,7 +380,7 @@ report.targetCatchByAssociation.request.1=0,0|row|\ with ct.discarded = false, \ ObservedSystemImpl os \ Where \ - m.id = :tripId \ + m.id In :tripId \ and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \ and os not in elements(a.observedSystem) @@ -412,7 +412,7 @@ report.targetCatchByAssociation.request.7=0,1|row|\ with ct.discarded = false, \ ObservedSystemImpl os \ Where \ - m.id = :tripId \ + m.id In :tripId \ and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \ and os in elements(a.observedSystem) @@ -444,7 +444,7 @@ report.targetCatchByAssociation.request.13=0,2|row|\ with ct.discarded = false, \ ObservedSystemImpl os \ Where \ - m.id = :tripId \ + m.id In :tripId \ and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \ and os in elements(a.observedSystem) @@ -476,7 +476,7 @@ report.targetCatchByAssociation.request.19=0,3|row|\ with ct.discarded = false, \ ObservedSystemImpl os \ Where \ - m.id = :tripId \ + m.id In :tripId \ and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \ and os not in elements(a.observedSystem) @@ -519,7 +519,7 @@ report.targetDiscardedByAssociation.request.1=0,0|row|\ with ct.discarded = true, \ ObservedSystemImpl os \ Where \ - m.id = :tripId \ + m.id In :tripId \ and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \ and os not in elements(a.observedSystem) @@ -551,7 +551,7 @@ report.targetDiscardedByAssociation.request.7=0,1|row|\ with ct.discarded = true, \ ObservedSystemImpl os \ Where \ - m.id = :tripId \ + m.id In :tripId \ and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \ and os in elements(a.observedSystem) @@ -583,7 +583,7 @@ report.targetDiscardedByAssociation.request.13=0,2|row|\ with ct.discarded = true, \ ObservedSystemImpl os \ Where \ - m.id = :tripId \ + m.id In :tripId \ and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \ and os in elements(a.observedSystem) @@ -615,7 +615,7 @@ report.targetDiscardedByAssociation.request.19=0,3|row|\ with ct.discarded = true, \ ObservedSystemImpl os \ Where \ - m.id = :tripId \ + m.id In :tripId \ and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \ and os not in elements(a.observedSystem) @@ -655,7 +655,7 @@ report.accessoryCatch.request.2=1,0|row|\ with c.schoolType = 2 \ Join c.nonTargetCatch ca \ with ca.species.id = :speciesId \ - Where m.id = :tripId + Where m.id In :tripId report.accessoryCatch.request.2.repeat=speciesId|column report.accessoryCatch.request.3=2,0|row|\ @@ -672,7 +672,7 @@ report.accessoryCatch.request.3=2,0|row|\ with c.schoolType = 1 \ Join c.nonTargetCatch ca \ with ca.species.id = :speciesId \ - Where m.id = :tripId + Where m.id In :tripId report.accessoryCatch.request.3.repeat=speciesId|column ################################################################################ @@ -723,7 +723,7 @@ report.accessoryCatchByGroup.request.1=0,0|row|\ Join c.nonTargetCatch ca \ Join ca.species e \ with e.speciesGroup.id = :speciesGroup \ - Where m.id = :tripId \ + Where m.id In :tripId \ Group by e \ Order By e.homeId @@ -742,7 +742,7 @@ Join t.route r \ Join r.activitySeine a \ Join a.setSeine.nonTargetSample nts \ Join nts.nonTargetLength ntl \ -Where t.id = :tripId +Where t.id In :tripId report.nonTargetDistributionLengths.request.1=0,0|row| \ Select ntl.length, sum(ntl.count) \ From TripSeineImpl t \ @@ -750,7 +750,7 @@ Join t.route r \ Join r.activitySeine a \ Join a.setSeine.nonTargetSample nts \ Join nts.nonTargetLength ntl \ -Where t.id = :tripId \ +Where t.id In :tripId \ And ntl.species.id = :speciesId \ Group By ntl.length \ Order By ntl.length @@ -770,7 +770,7 @@ Join t.route r \ Join r.activitySeine a \ Join a.setSeine.targetSample ts \ Join ts.targetLength tl \ -Where t.id = :tripId \ +Where t.id In :tripId \ And tl.sizeMeasureType = 1 \ And ts.discarded = false report.targetStoredDistributionLengthsLD1.request.1=0,0|row| \ @@ -780,7 +780,7 @@ Join t.route r \ Join r.activitySeine a \ Join a.setSeine.targetSample ts \ Join ts.targetLength tl \ -Where t.id = :tripId \ +Where t.id In :tripId \ And tl.species.id = :speciesId \ And tl.sizeMeasureType = 1 \ And ts.discarded = false \ @@ -802,7 +802,7 @@ Join t.route r \ Join r.activitySeine a \ Join a.setSeine.targetSample ts \ Join ts.targetLength tl \ -Where t.id = :tripId \ +Where t.id In :tripId \ And tl.sizeMeasureType = 1 \ And ts.discarded = true report.targetDiscardedDistributionLengthsLD1.request.1=0,0|row| \ @@ -812,7 +812,7 @@ Join t.route r \ Join r.activitySeine a \ Join a.setSeine.targetSample ts \ Join ts.targetLength tl \ -Where t.id = :tripId \ +Where t.id In :tripId \ And tl.species.id = :speciesId \ And tl.sizeMeasureType = 1\ And ts.discarded = true \ @@ -834,7 +834,7 @@ Join t.route r \ Join r.activitySeine a \ Join a.setSeine.targetSample ts \ Join ts.targetLength tl \ -Where t.id = :tripId \ +Where t.id In :tripId \ And tl.sizeMeasureType = 2 \ And ts.discarded = false report.targetStoredDistributionLengthsLF.request.1=0,0|row| \ @@ -844,7 +844,7 @@ Join t.route r \ Join r.activitySeine a \ Join a.setSeine.targetSample ts \ Join ts.targetLength tl \ -Where t.id = :tripId \ +Where t.id In :tripId \ And tl.species.id = :speciesId \ And tl.sizeMeasureType = 2 \ And ts.discarded = false \ @@ -866,7 +866,7 @@ Join t.route r \ Join r.activitySeine a \ Join a.setSeine.targetSample ts \ Join ts.targetLength tl \ -Where t.id = :tripId \ +Where t.id In :tripId \ And tl.sizeMeasureType = 2 \ And ts.discarded = true report.targetDiscardedDistributionLengthsLF.request.1=0,0|row| \ @@ -876,7 +876,7 @@ Join t.route r \ Join r.activitySeine a \ Join a.setSeine.targetSample ts \ Join ts.targetLength tl \ -Where t.id = :tripId \ +Where t.id In :tripId \ And tl.species.id = :speciesId \ And tl.sizeMeasureType = 2 \ And ts.discarded = true \ @@ -902,6 +902,6 @@ From TripSeineImpl t \ Join t.route r \ Join r.activitySeine a \ Join a.setSeine.targetCatch tc \ -Where t.id = :tripId \ +Where t.id In :tripId \ Group By r.date, a.time, a.latitude, a.longitude, tc.weightCategory.species, tc.weightCategory.species.faoCode, tc.well, a.setSeine.schoolType \ Order By r.date, a.time, tc.weightCategory.species, tc.well View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/d8e8d799ec1b7adce23a28438292... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/d8e8d799ec1b7adce23a28438292... You're receiving this email because of your account on gitlab.com.