Tony CHEMIT pushed to branch master-7.x at ultreiaio / ird-observe
Commits:
-
3ba166c4
by Tony CHEMIT at 2018-09-23T20:08:24Z
-
bd699648
by Tony CHEMIT at 2018-09-23T20:08:29Z
-
e72eae33
by Tony CHEMIT at 2018-09-23T20:08:29Z
-
e8cf278f
by Tony CHEMIT at 2018-09-23T20:08:30Z
-
5bd56caf
by Tony CHEMIT at 2018-09-23T20:33:04Z
-
6a9d6644
by Tony CHEMIT at 2018-09-23T20:33:05Z
-
96c75a89
by Tony CHEMIT at 2018-09-23T20:41:19Z
-
99b971a7
by Tony CHEMIT at 2018-09-23T20:46:59Z
-
6521b438
by Tony CHEMIT at 2018-09-23T20:58:12Z
27 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
- client/src/main/java/fr/ird/observe/client/ui/admin/validate/ValidateConfigUI.jcss
- client/src/main/java/fr/ird/observe/client/ui/admin/validate/ValidateUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/dcprefs/FloatingObjectPresetsUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/storage/presets/RemotePresetsUIHandler.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/main/java/fr/ird/observe/services/local/service/actions/synchro/referential/sql/DisableSqlStatementGenerator.java
- services-local/src/main/java/fr/ird/observe/services/local/service/actions/validate/ValidateServiceLocal.java
- services-local/src/main/java/fr/ird/observe/services/local/service/actions/validate/ValidationMessageDetector.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/pom.xml
- services/src/main/java/fr/ird/observe/services/gson/ObserveDtoGsonSupplier.java
- services/src/main/java/fr/ird/observe/services/gson/ReportVariableAdapter.java
- + services/src/main/java/fr/ird/observe/services/gson/ValidationResultDtoAdapter.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/java/fr/ird/observe/services/service/actions/validate/DataValidationResult.java
- + services/src/main/java/fr/ird/observe/services/service/actions/validate/ReferentialValidationResult.java
- services/src/main/java/fr/ird/observe/services/service/actions/validate/ValidateService.java
- services/src/main/java/fr/ird/observe/services/service/actions/validate/ValidationResult.java
- services/src/main/java/fr/ird/observe/services/service/actions/validate/ValidationResultDto.java
- services/src/main/resources/observe-reports.properties
Changes:
| ... | ... | @@ -10,36 +10,39 @@ package fr.ird.observe.client.ui.admin.config; |
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| 11 | 11 |
* published by the Free Software Foundation, either version 3 of the
|
| 12 | 12 |
* License, or (at your option) any later version.
|
| 13 |
- *
|
|
| 13 |
+ *
|
|
| 14 | 14 |
* This program is distributed in the hope that it will be useful,
|
| 15 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | 17 |
* GNU General Public License for more details.
|
| 18 |
- *
|
|
| 18 |
+ *
|
|
| 19 | 19 |
* You should have received a copy of the GNU General Public
|
| 20 | 20 |
* License along with this program. If not, see
|
| 21 | 21 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 25 | 26 |
import fr.ird.observe.client.db.ObserveSwingDataSource;
|
| 26 | 27 |
import fr.ird.observe.client.ui.admin.AdminActionModel;
|
| 27 | 28 |
import fr.ird.observe.client.ui.admin.AdminStep;
|
| 28 | 29 |
import fr.ird.observe.client.ui.admin.AdminUIModel;
|
| 29 | 30 |
import fr.ird.observe.client.ui.admin.report.ReportModel;
|
| 30 | 31 |
import fr.ird.observe.client.ui.tree.selection.SelectionTreeModel;
|
| 32 |
+import fr.ird.observe.dto.IdDto;
|
|
| 31 | 33 |
import fr.ird.observe.dto.IdHelper;
|
| 32 | 34 |
import fr.ird.observe.dto.ObserveModelType;
|
| 33 | 35 |
import fr.ird.observe.dto.data.longline.TripLonglineReference;
|
| 34 | 36 |
import fr.ird.observe.dto.data.seine.TripSeineReference;
|
| 35 | 37 |
import fr.ird.observe.dto.reference.DataDtoReference;
|
| 36 | 38 |
import fr.ird.observe.dto.reference.DataDtoReferenceSet;
|
| 37 |
-import org.apache.logging.log4j.Logger;
|
|
| 38 | 39 |
import org.apache.logging.log4j.LogManager;
|
| 40 |
+import org.apache.logging.log4j.Logger;
|
|
| 39 | 41 |
|
| 40 | 42 |
import java.util.ArrayList;
|
| 41 | 43 |
import java.util.List;
|
| 42 | 44 |
import java.util.Set;
|
| 45 |
+import java.util.stream.Collectors;
|
|
| 43 | 46 |
|
| 44 | 47 |
/**
|
| 45 | 48 |
* Created on 28/11/16.
|
| ... | ... | @@ -99,10 +102,8 @@ public class SelectDataModel extends AdminActionModel { |
| 99 | 102 |
// on doit aussi calculer les ids des marées distantes
|
| 100 | 103 |
ObserveSwingDataSource safeCentralSource = uiModel.getConfigModel().getSafeCentralSource(true);
|
| 101 | 104 |
|
| 102 |
- List<DataDtoReference<?, ?>> existingTrip = new ArrayList<>();
|
|
| 103 |
- |
|
| 104 | 105 |
DataDtoReferenceSet<TripSeineReference> tripSeineSet = safeCentralSource.getTripSeineService().getAllTripSeine();
|
| 105 |
- existingTrip.addAll(tripSeineSet.toSet());
|
|
| 106 |
+ List<DataDtoReference<?, ?>> existingTrip = new ArrayList<>(tripSeineSet.toSet());
|
|
| 106 | 107 |
|
| 107 | 108 |
DataDtoReferenceSet<TripLonglineReference> tripLonglineSet = safeCentralSource.getTripLonglineService().getAllTripLongline();
|
| 108 | 109 |
existingTrip.addAll(tripLonglineSet.toSet());
|
| ... | ... | @@ -136,6 +137,17 @@ public class SelectDataModel extends AdminActionModel { |
| 136 | 137 |
return null;
|
| 137 | 138 |
}
|
| 138 | 139 |
|
| 140 |
+ public ImmutableSet<DataDtoReference> getSelectedTrips() {
|
|
| 141 |
+ ImmutableSet.Builder<DataDtoReference> result = ImmutableSet.builder();
|
|
| 142 |
+ Set<DataDtoReference<?, ?>> data = getSelectionDataModel().getSelectedData();
|
|
| 143 |
+ for (DataDtoReference<?, ?> datum : data) {
|
|
| 144 |
+ if (IdHelper.isTrip(datum)) {
|
|
| 145 |
+ result.add(datum);
|
|
| 146 |
+ }
|
|
| 147 |
+ }
|
|
| 148 |
+ return result.build();
|
|
| 149 |
+ }
|
|
| 150 |
+ |
|
| 139 | 151 |
public void start(AdminUIModel uiModel) {
|
| 140 | 152 |
|
| 141 | 153 |
if (!uiModel.needSelect()) {
|
| ... | ... | @@ -194,6 +206,7 @@ public class SelectDataModel extends AdminActionModel { |
| 194 | 206 |
public boolean validate(AdminUIModel uiModel) {
|
| 195 | 207 |
|
| 196 | 208 |
boolean validate = true;
|
| 209 |
+ boolean empty = selectionDataModel.isSelectionEmpty();
|
|
| 197 | 210 |
|
| 198 | 211 |
if (uiModel.containsOperation(AdminStep.VALIDATE)) {
|
| 199 | 212 |
|
| ... | ... | @@ -202,7 +215,6 @@ public class SelectDataModel extends AdminActionModel { |
| 202 | 215 |
if (validate) {
|
| 203 | 216 |
|
| 204 | 217 |
// il faut au moins une donnee de selectionnee
|
| 205 |
- boolean empty = selectionDataModel.isSelectionEmpty();
|
|
| 206 | 218 |
validate = !empty;
|
| 207 | 219 |
}
|
| 208 | 220 |
}
|
| ... | ... | @@ -213,7 +225,6 @@ public class SelectDataModel extends AdminActionModel { |
| 213 | 225 |
if (validate) {
|
| 214 | 226 |
|
| 215 | 227 |
// il faut au moins une donnee de selectionnee
|
| 216 |
- boolean empty = selectionDataModel.isSelectionEmpty();
|
|
| 217 | 228 |
validate = !empty;
|
| 218 | 229 |
}
|
| 219 | 230 |
}
|
| ... | ... | @@ -224,7 +235,6 @@ public class SelectDataModel extends AdminActionModel { |
| 224 | 235 |
if (validate) {
|
| 225 | 236 |
|
| 226 | 237 |
// il faut au moins une donnee de selectionnee
|
| 227 |
- boolean empty = selectionDataModel.isSelectionEmpty();
|
|
| 228 | 238 |
validate = !empty;
|
| 229 | 239 |
}
|
| 230 | 240 |
}
|
| ... | ... | @@ -234,12 +244,15 @@ public class SelectDataModel extends AdminActionModel { |
| 234 | 244 |
validate &= uiModel.validate(AdminStep.CONFIG);
|
| 235 | 245 |
if (validate) {
|
| 236 | 246 |
|
| 237 |
- // il faut exactement une Trip de selectionnee
|
|
| 238 |
- int selectedCount = selectionDataModel.getSelectedCount();
|
|
| 239 |
- validate = selectedCount == 1;
|
|
| 247 |
+ // il faut au moins une donnee de selectionnee
|
|
| 248 |
+ validate = !empty;
|
|
| 240 | 249 |
}
|
| 241 | 250 |
}
|
| 242 | 251 |
|
| 243 | 252 |
return validate;
|
| 244 | 253 |
}
|
| 254 |
+ |
|
| 255 |
+ public ImmutableSet<String> getSelectedTripIds() {
|
|
| 256 |
+ return ImmutableSet.copyOf(getSelectedTrips().stream().map(IdDto::getId).collect(Collectors.toSet()));
|
|
| 257 |
+ }
|
|
| 245 | 258 |
}
|
| ... | ... | @@ -71,7 +71,7 @@ JToolBar { |
| 71 | 71 |
}
|
| 72 | 72 |
|
| 73 | 73 |
#reportDescription {
|
| 74 |
- text:{getHandler().updateSelectedReportDescrption(stepModel.getSelectedReport())};
|
|
| 74 |
+ text:{getHandler().updateSelectedReportDescription(stepModel.getSelectedReport())};
|
|
| 75 | 75 |
editable:false;
|
| 76 | 76 |
focusable:false;
|
| 77 | 77 |
}
|
| ... | ... | @@ -6,22 +6,22 @@ |
| 6 | 6 |
* %%
|
| 7 | 7 |
* This program is free software: you can redistribute it and/or modify
|
| 8 | 8 |
* it under the terms of the GNU General Public License as
|
| 9 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 9 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 10 | 10 |
* License, or (at your option) any later version.
|
| 11 |
- *
|
|
| 11 |
+ *
|
|
| 12 | 12 |
* This program is distributed in the hope that it will be useful,
|
| 13 | 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 | 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 | 15 |
* GNU General Public License for more details.
|
| 16 |
- *
|
|
| 17 |
- * You should have received a copy of the GNU General Public
|
|
| 16 |
+ *
|
|
| 17 |
+ * You should have received a copy of the GNU General Public
|
|
| 18 | 18 |
* License along with this program. If not, see
|
| 19 | 19 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 20 | 20 |
* #L%
|
| 21 | 21 |
*/
|
| 22 | 22 |
package fr.ird.observe.client.ui.admin.report;
|
| 23 | 23 |
|
| 24 |
-import com.google.common.collect.Lists;
|
|
| 24 |
+import com.google.common.collect.ImmutableSet;
|
|
| 25 | 25 |
import fr.ird.observe.client.ObserveSwingTechnicalException;
|
| 26 | 26 |
import fr.ird.observe.client.db.ObserveSwingDataSource;
|
| 27 | 27 |
import fr.ird.observe.client.ui.admin.AdminStep;
|
| ... | ... | @@ -36,8 +36,9 @@ import fr.ird.observe.services.service.actions.report.DataMatrix; |
| 36 | 36 |
import fr.ird.observe.services.service.actions.report.Report;
|
| 37 | 37 |
import fr.ird.observe.services.service.actions.report.ReportService;
|
| 38 | 38 |
import fr.ird.observe.services.service.actions.report.ReportVariable;
|
| 39 |
-import org.apache.logging.log4j.Logger;
|
|
| 39 |
+import fr.ird.observe.spi.DtoModelHelper;
|
|
| 40 | 40 |
import org.apache.logging.log4j.LogManager;
|
| 41 |
+import org.apache.logging.log4j.Logger;
|
|
| 41 | 42 |
import org.nuiton.decorator.Decorator;
|
| 42 | 43 |
import org.nuiton.decorator.JXPathDecorator;
|
| 43 | 44 |
import org.nuiton.jaxx.runtime.context.JAXXInitialContext;
|
| ... | ... | @@ -57,6 +58,7 @@ import java.awt.Component; |
| 57 | 58 |
import java.awt.Font;
|
| 58 | 59 |
import java.awt.event.ItemEvent;
|
| 59 | 60 |
import java.io.File;
|
| 61 |
+import java.util.ArrayList;
|
|
| 60 | 62 |
import java.util.List;
|
| 61 | 63 |
import java.util.Map;
|
| 62 | 64 |
import java.util.Set;
|
| ... | ... | @@ -71,7 +73,7 @@ import static org.nuiton.i18n.I18n.t; |
| 71 | 73 |
*/
|
| 72 | 74 |
public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHandler<ReportUI> {
|
| 73 | 75 |
|
| 74 |
- public static final String VARIABLE_NAME = "variableName";
|
|
| 76 |
+ private static final String VARIABLE_NAME = "variableName";
|
|
| 75 | 77 |
|
| 76 | 78 |
/** Logger */
|
| 77 | 79 |
private static final Logger log = LogManager.getLogger(ReportUIHandler.class);
|
| ... | ... | @@ -142,14 +144,14 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 142 | 144 |
|
| 143 | 145 |
Font headerFont;
|
| 144 | 146 |
|
| 145 |
- public Font getDefaultFont(JTable table) {
|
|
| 147 |
+ Font getDefaultFont(JTable table) {
|
|
| 146 | 148 |
if (defaultFont == null) {
|
| 147 | 149 |
defaultFont = table.getFont();
|
| 148 | 150 |
}
|
| 149 | 151 |
return defaultFont;
|
| 150 | 152 |
}
|
| 151 | 153 |
|
| 152 |
- public Font getHeaderFont(JTable table) {
|
|
| 154 |
+ Font getHeaderFont(JTable table) {
|
|
| 153 | 155 |
if (headerFont == null) {
|
| 154 | 156 |
headerFont = getDefaultFont(table).deriveFont(Font.BOLD);
|
| 155 | 157 |
}
|
| ... | ... | @@ -187,13 +189,13 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 187 | 189 |
configUI.getExtraConfig().add(extraConfig);
|
| 188 | 190 |
}
|
| 189 | 191 |
|
| 190 |
- public void setModelTypeFromEvent(ItemEvent event) {
|
|
| 192 |
+ void setModelTypeFromEvent(ItemEvent event) {
|
|
| 191 | 193 |
if (event.getStateChange() == ItemEvent.SELECTED) {
|
| 192 | 194 |
getStepModel().setModelType((ObserveModelType) event.getItem());
|
| 193 | 195 |
}
|
| 194 | 196 |
}
|
| 195 | 197 |
|
| 196 |
- public void updateSelectedReportFromEvent(ItemEvent event) {
|
|
| 198 |
+ void updateSelectedReportFromEvent(ItemEvent event) {
|
|
| 197 | 199 |
|
| 198 | 200 |
if (event.getStateChange() == ItemEvent.SELECTED) {
|
| 199 | 201 |
if (log.isInfoEnabled()) {
|
| ... | ... | @@ -204,7 +206,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 204 | 206 |
}
|
| 205 | 207 |
}
|
| 206 | 208 |
|
| 207 |
- public void updateSelectedReport(Report report) {
|
|
| 209 |
+ void updateSelectedReport(Report report) {
|
|
| 208 | 210 |
ui.getModel().setBusy(true);
|
| 209 | 211 |
try {
|
| 210 | 212 |
if (log.isInfoEnabled()) {
|
| ... | ... | @@ -217,14 +219,14 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 217 | 219 |
}
|
| 218 | 220 |
}
|
| 219 | 221 |
|
| 220 |
- public String updateSelectedReportDescrption(Report report) {
|
|
| 222 |
+ String updateSelectedReportDescription(Report report) {
|
|
| 221 | 223 |
if (report == null) {
|
| 222 | 224 |
return t("observe.message.no.report.selected");
|
| 223 | 225 |
}
|
| 224 | 226 |
return t(report.getDescription());
|
| 225 | 227 |
}
|
| 226 | 228 |
|
| 227 |
- public void updateVariable(JComboBox combo, Object value) {
|
|
| 229 |
+ private void updateVariable(JComboBox combo, Object value) {
|
|
| 228 | 230 |
String variableName = (String) combo.getClientProperty(VARIABLE_NAME);
|
| 229 | 231 |
if (variableName == null) {
|
| 230 | 232 |
throw new IllegalStateException(
|
| ... | ... | @@ -236,7 +238,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 236 | 238 |
getStepModel().addVariable(variableName, value);
|
| 237 | 239 |
}
|
| 238 | 240 |
|
| 239 |
- public void chooseReportFile() {
|
|
| 241 |
+ void chooseReportFile() {
|
|
| 240 | 242 |
ReportModel model = ui.getModel().getReportModel();
|
| 241 | 243 |
File f = UIHelper.chooseFile(
|
| 242 | 244 |
ui,
|
| ... | ... | @@ -248,10 +250,10 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 248 | 250 |
model.setReportFile(f);
|
| 249 | 251 |
}
|
| 250 | 252 |
|
| 251 |
- public void copyReportToClipBoard(Report report,
|
|
| 252 |
- ResultTableModel model,
|
|
| 253 |
- boolean copyRowHeaders,
|
|
| 254 |
- boolean copyColumnHeaders) {
|
|
| 253 |
+ void copyReportToClipBoard(Report report,
|
|
| 254 |
+ ResultTableModel model,
|
|
| 255 |
+ boolean copyRowHeaders,
|
|
| 256 |
+ boolean copyColumnHeaders) {
|
|
| 255 | 257 |
if (report == null) {
|
| 256 | 258 |
|
| 257 | 259 |
// pas de report sélectionné, rien à faire
|
| ... | ... | @@ -267,7 +269,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 267 | 269 |
UIHelper.copyToClipBoard(content);
|
| 268 | 270 |
}
|
| 269 | 271 |
|
| 270 |
- protected void onReportsChanged(ReportUI tabUI, List<?> newValue) {
|
|
| 272 |
+ private void onReportsChanged(ReportUI tabUI, List<?> newValue) {
|
|
| 271 | 273 |
|
| 272 | 274 |
if (log.isDebugEnabled()) {
|
| 273 | 275 |
log.debug("New reports : " + newValue);
|
| ... | ... | @@ -281,7 +283,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 281 | 283 |
}
|
| 282 | 284 |
|
| 283 | 285 |
@SuppressWarnings({"unchecked"})
|
| 284 |
- protected void onSelectedReportChanged(ReportUI tabUI, ReportModel model, Report report) {
|
|
| 286 |
+ private void onSelectedReportChanged(ReportUI tabUI, ReportModel model, Report report) {
|
|
| 285 | 287 |
|
| 286 | 288 |
if (log.isInfoEnabled()) {
|
| 287 | 289 |
log.info("New selected report [" + report + "]");
|
| ... | ... | @@ -309,7 +311,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 309 | 311 |
|
| 310 | 312 |
ReportService reportService = dataSource.getReportService();
|
| 311 | 313 |
|
| 312 |
- report = reportService.populateVariables(report, ui.getModel().getSelectDataModel().getSelectedTrip().getId());
|
|
| 314 |
+ report = reportService.populateVariables(report, ui.getModel().getSelectDataModel().getSelectedTripIds());
|
|
| 313 | 315 |
|
| 314 | 316 |
} catch (Exception e) {
|
| 315 | 317 |
throw new ObserveSwingTechnicalException("unable to populate report : " + report.getName(), e);
|
| ... | ... | @@ -322,16 +324,18 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 322 | 324 |
String variableName = variable.getName();
|
| 323 | 325 |
// String value = variables.get(variableName);
|
| 324 | 326 |
Set values = variable.getValues();
|
| 325 |
- List<Object> universe = Lists.newArrayList(values);
|
|
| 327 |
+ List<Object> universe = new ArrayList<>(values);
|
|
| 326 | 328 |
BeanComboBox<Object> combo = new BeanComboBox<>();
|
| 327 | 329 |
|
| 328 | 330 |
combo.setShowReset(true);
|
| 329 | 331 |
variablesPanel.add(combo);
|
| 330 | 332 |
Decorator decorator;
|
| 331 | 333 |
if (ReferentialDto.class.isAssignableFrom(variable.getType()) && !universe.isEmpty()) {
|
| 332 |
- decorator = getDecoratorService().getReferentialReferenceDecorator(variable.getType());
|
|
| 334 |
+ Class type = DtoModelHelper.fromReferentialDto(variable.getType()).toReferenceType();
|
|
| 335 |
+ decorator = getDecoratorService().getReferentialReferenceDecorator(type);
|
|
| 333 | 336 |
} else if (DataDto.class.isAssignableFrom(variable.getType()) && !universe.isEmpty()) {
|
| 334 |
- decorator = getDecoratorService().getDataReferenceDecorator(variable.getType());
|
|
| 337 |
+ Class type = DtoModelHelper.fromDataDto(variable.getType()).toReferenceType();
|
|
| 338 |
+ decorator = getDecoratorService().getDataReferenceDecorator(type);
|
|
| 335 | 339 |
} else {
|
| 336 | 340 |
decorator = getDecoratorService().getDecoratorByType(variable.getType());
|
| 337 | 341 |
}
|
| ... | ... | @@ -372,7 +376,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 372 | 376 |
}
|
| 373 | 377 |
}
|
| 374 | 378 |
|
| 375 |
- protected void onVariablesChanges(ReportModel model, Map<String, Object> variables) {
|
|
| 379 |
+ private void onVariablesChanges(ReportModel model, Map<String, Object> variables) {
|
|
| 376 | 380 |
|
| 377 | 381 |
Report report = model.getSelectedReport();
|
| 378 | 382 |
if (report != null) {
|
| ... | ... | @@ -381,7 +385,7 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 381 | 385 |
}
|
| 382 | 386 |
}
|
| 383 | 387 |
|
| 384 |
- protected void onValidChanged(ReportModel model, boolean valid) {
|
|
| 388 |
+ private void onValidChanged(ReportModel model, boolean valid) {
|
|
| 385 | 389 |
|
| 386 | 390 |
if (log.isInfoEnabled()) {
|
| 387 | 391 |
log.info("valid state changed to " + valid);
|
| ... | ... | @@ -399,11 +403,10 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 399 | 403 |
|
| 400 | 404 |
Report report = model.getSelectedReport();
|
| 401 | 405 |
|
| 406 |
+ ImmutableSet<String> tripIds = ui.getModel().getSelectDataModel().getSelectedTripIds();
|
|
| 402 | 407 |
DataDtoReference trip = ui.getModel().getSelectDataModel().getSelectedTrip();
|
| 403 | 408 |
|
| 404 |
- if (log.isDebugEnabled()) {
|
|
| 405 |
- log.debug("Build result for report [" + report.getName() + "] on " + trip);
|
|
| 406 |
- }
|
|
| 409 |
+ log.info(String.format("Build result for report [%s] on %s", report.getName(), trip));
|
|
| 407 | 410 |
|
| 408 | 411 |
Map<String, Object> variables = model.getVariables();
|
| 409 | 412 |
|
| ... | ... | @@ -421,13 +424,11 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 421 | 424 |
|
| 422 | 425 |
ReportService reportService = dataSource.getReportService();
|
| 423 | 426 |
|
| 424 |
- DataMatrix data = reportService.executeReport(report, trip.getId());
|
|
| 427 |
+ DataMatrix data = reportService.executeReport(report, tripIds);
|
|
| 425 | 428 |
|
| 426 | 429 |
timeLog.log(startTime, "execute", report.getName());
|
| 427 | 430 |
|
| 428 |
- if (log.isInfoEnabled()) {
|
|
| 429 |
- log.info("Result to dispaly:\n" + data.getClipboardContent(true, true, false, '\t'));
|
|
| 430 |
- }
|
|
| 431 |
+ log.info("Result to display:\n" + data.getClipboardContent(true, true, false, '\t'));
|
|
| 431 | 432 |
|
| 432 | 433 |
// calcul des données et contruction du tableau
|
| 433 | 434 |
model.getResultModel().populate(report, data);
|
| ... | ... | @@ -439,17 +440,11 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 439 | 440 |
model.isCopyRowHeaders(),
|
| 440 | 441 |
model.isCopyColumnHeaders());
|
| 441 | 442 |
}
|
| 442 |
- |
|
| 443 | 443 |
} catch (Exception e) {
|
| 444 |
- |
|
| 445 | 444 |
UIHelper.handlingError("Could not obtain report data", e);
|
| 446 |
- |
|
| 447 | 445 |
model.getResultModel().clear();
|
| 448 |
- |
|
| 449 | 446 |
} finally {
|
| 450 |
- |
|
| 451 | 447 |
ui.getModel().setBusy(false);
|
| 452 |
- |
|
| 453 | 448 |
}
|
| 454 | 449 |
}
|
| 455 | 450 |
|
| ... | ... | @@ -457,15 +452,13 @@ public class ReportUIHandler extends AdminTabUIHandler<ReportUI> implements UIHa |
| 457 | 452 |
return ui.getModel().getReportModel();
|
| 458 | 453 |
}
|
| 459 | 454 |
|
| 460 |
- protected void updateValidState(Report report, Map<String, Object> variables) {
|
|
| 461 |
- |
|
| 455 |
+ private void updateValidState(Report report, Map<String, Object> variables) {
|
|
| 462 | 456 |
boolean canExecute = report != null && report.canExecute(variables);
|
| 463 | 457 |
getStepModel().setValid(canExecute);
|
| 464 | 458 |
}
|
| 465 | 459 |
|
| 466 | 460 |
public void destroy() {
|
| 467 | 461 |
ObserveSwingDataSource dataSource = ui.getModel().getConfigModel().getSafeLocalSource(false);
|
| 468 |
- |
|
| 469 | 462 |
if (dataSource.isOpen()) {
|
| 470 | 463 |
dataSource.close();
|
| 471 | 464 |
}
|
| ... | ... | @@ -68,19 +68,19 @@ |
| 68 | 68 |
|
| 69 | 69 |
#ERROR {
|
| 70 | 70 |
_value:{NuitonValidatorScope.ERROR};
|
| 71 |
- text:{NuitonValidatorScope.ERROR.getLabel()};
|
|
| 71 |
+ text:{t(NuitonValidatorScope.ERROR.getLabel())};
|
|
| 72 | 72 |
selected:{getHandler().isScopeSelected(validateModel.getScopes(), ERROR)};
|
| 73 | 73 |
}
|
| 74 | 74 |
|
| 75 | 75 |
#WARNING {
|
| 76 | 76 |
_value:{NuitonValidatorScope.WARNING};
|
| 77 |
- text:{NuitonValidatorScope.WARNING.getLabel()};
|
|
| 77 |
+ text:{t(NuitonValidatorScope.WARNING.getLabel())};
|
|
| 78 | 78 |
selected:{getHandler().isScopeSelected(validateModel.getScopes(), WARNING)};
|
| 79 | 79 |
}
|
| 80 | 80 |
|
| 81 | 81 |
#INFO {
|
| 82 | 82 |
_value:{NuitonValidatorScope.INFO};
|
| 83 |
- text:{NuitonValidatorScope.INFO.getLabel()};
|
|
| 83 |
+ text:{t(NuitonValidatorScope.INFO.getLabel())};
|
|
| 84 | 84 |
selected:{getHandler().isScopeSelected(validateModel.getScopes(), INFO)};
|
| 85 | 85 |
}
|
| 86 | 86 |
|
| ... | ... | @@ -6,15 +6,15 @@ |
| 6 | 6 |
* %%
|
| 7 | 7 |
* This program is free software: you can redistribute it and/or modify
|
| 8 | 8 |
* it under the terms of the GNU General Public License as
|
| 9 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 9 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 10 | 10 |
* License, or (at your option) any later version.
|
| 11 |
- *
|
|
| 11 |
+ *
|
|
| 12 | 12 |
* This program is distributed in the hope that it will be useful,
|
| 13 | 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 | 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 | 15 |
* GNU General Public License for more details.
|
| 16 |
- *
|
|
| 17 |
- * You should have received a copy of the GNU General Public
|
|
| 16 |
+ *
|
|
| 17 |
+ * You should have received a copy of the GNU General Public
|
|
| 18 | 18 |
* License along with this program. If not, see
|
| 19 | 19 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 20 | 20 |
* #L%
|
| ... | ... | @@ -43,6 +43,7 @@ import fr.ird.observe.dto.reference.DataDtoReference; |
| 43 | 43 |
import fr.ird.observe.dto.reference.DtoReference;
|
| 44 | 44 |
import fr.ird.observe.dto.referential.ReferentialLocale;
|
| 45 | 45 |
import fr.ird.observe.services.service.actions.validate.DataValidationRequest;
|
| 46 |
+import fr.ird.observe.services.service.actions.validate.DataValidationResult;
|
|
| 46 | 47 |
import fr.ird.observe.services.service.actions.validate.ReferentialValidationRequest;
|
| 47 | 48 |
import fr.ird.observe.services.service.actions.validate.ValidateService;
|
| 48 | 49 |
import fr.ird.observe.services.service.actions.validate.ValidationResult;
|
| ... | ... | @@ -50,8 +51,8 @@ import fr.ird.observe.services.service.actions.validate.ValidationResultDto; |
| 50 | 51 |
import fr.ird.observe.services.service.actions.validate.ValidationResultDtoMessage;
|
| 51 | 52 |
import fr.ird.observe.services.validation.ValidatorDto;
|
| 52 | 53 |
import org.apache.commons.io.FileUtils;
|
| 53 |
-import org.apache.logging.log4j.Logger;
|
|
| 54 | 54 |
import org.apache.logging.log4j.LogManager;
|
| 55 |
+import org.apache.logging.log4j.Logger;
|
|
| 55 | 56 |
import org.nuiton.jaxx.runtime.context.JAXXInitialContext;
|
| 56 | 57 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 57 | 58 |
import org.nuiton.jaxx.runtime.swing.wizard.ext.WizardState;
|
| ... | ... | @@ -410,7 +411,7 @@ public class ValidateUIHandler extends AdminTabUIHandler<ValidateUI> implements |
| 410 | 411 |
mainRequest.setValidationLengthWeightEnable(config.getValidationLengthWeightEnable());
|
| 411 | 412 |
mainRequest.setSeineBycatchObservedSystemConfig(config.getSeineBycatchObservedSystem());
|
| 412 | 413 |
|
| 413 |
- ValidationResult.Builder<DataValidationRequest> resultBuilder = ValidationResult.builder(ReferentialLocale.valueOf(config.getDbLocale()), mainRequest);
|
|
| 414 |
+ ValidationResult.Builder<DataValidationRequest, DataValidationResult> resultBuilder = DataValidationResult.builder(ReferentialLocale.valueOf(config.getDbLocale()), mainRequest);
|
|
| 414 | 415 |
|
| 415 | 416 |
for (DataDtoReference<?, ?> dataReference : dataModel.getSelectedData()) {
|
| 416 | 417 |
|
| ... | ... | @@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.dcprefs; |
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| 11 | 11 |
* published by the Free Software Foundation, either version 3 of the
|
| 12 | 12 |
* License, or (at your option) any later version.
|
| 13 |
- *
|
|
| 13 |
+ *
|
|
| 14 | 14 |
* This program is distributed in the hope that it will be useful,
|
| 15 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | 17 |
* GNU General Public License for more details.
|
| 18 |
- *
|
|
| 18 |
+ *
|
|
| 19 | 19 |
* You should have received a copy of the GNU General Public
|
| 20 | 20 |
* License along with this program. If not, see
|
| 21 | 21 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| ... | ... | @@ -33,8 +33,12 @@ import org.nuiton.jaxx.runtime.swing.renderer.DecoratorListCellRenderer; |
| 33 | 33 |
|
| 34 | 34 |
import javax.swing.AbstractButton;
|
| 35 | 35 |
import javax.swing.DefaultListModel;
|
| 36 |
+import javax.swing.JComponent;
|
|
| 37 |
+import javax.swing.JSplitPane;
|
|
| 38 |
+import javax.swing.KeyStroke;
|
|
| 36 | 39 |
import javax.swing.SwingUtilities;
|
| 37 | 40 |
import java.awt.BorderLayout;
|
| 41 |
+import java.awt.event.KeyEvent;
|
|
| 38 | 42 |
import java.util.LinkedList;
|
| 39 | 43 |
import java.util.List;
|
| 40 | 44 |
import java.util.Objects;
|
| ... | ... | @@ -69,6 +73,8 @@ public class FloatingObjectPresetsUIHandler implements UIHandler<FloatingObjectP |
| 69 | 73 |
|
| 70 | 74 |
if (o instanceof AbstractButton) {
|
| 71 | 75 |
init(actionMap, (AbstractButton) o);
|
| 76 |
+ } else if (o instanceof JSplitPane) {
|
|
| 77 |
+ init((JSplitPane) o);
|
|
| 72 | 78 |
}
|
| 73 | 79 |
|
| 74 | 80 |
}
|
| ... | ... | @@ -119,6 +125,12 @@ public class FloatingObjectPresetsUIHandler implements UIHandler<FloatingObjectP |
| 119 | 125 |
UIHelper.askFocus(ui.getQuitAction());
|
| 120 | 126 |
}
|
| 121 | 127 |
|
| 128 |
+ |
|
| 129 |
+ protected void init(JSplitPane editor) {
|
|
| 130 |
+ editor.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
|
|
| 131 |
+ .put(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0), "none");
|
|
| 132 |
+ }
|
|
| 133 |
+ |
|
| 122 | 134 |
protected void init(ObserveActionMap actionMap, AbstractButton editor) {
|
| 123 | 135 |
String actionId = (String) editor.getClientProperty(OBSERVE_ACTION);
|
| 124 | 136 |
if (actionId == null) {
|
| ... | ... | @@ -29,8 +29,8 @@ import fr.ird.observe.client.ui.util.UIHelper; |
| 29 | 29 |
import fr.ird.observe.dto.decoration.DecoratorService;
|
| 30 | 30 |
import fr.ird.observe.dto.presets.RemoteDataSourceConfiguration;
|
| 31 | 31 |
import fr.ird.observe.dto.presets.ServerDataSourceConfiguration;
|
| 32 |
-import org.apache.logging.log4j.Logger;
|
|
| 33 | 32 |
import org.apache.logging.log4j.LogManager;
|
| 33 |
+import org.apache.logging.log4j.Logger;
|
|
| 34 | 34 |
import org.nuiton.decorator.Decorator;
|
| 35 | 35 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 36 | 36 |
import org.nuiton.jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
|
| ... | ... | @@ -40,8 +40,11 @@ import javax.swing.ActionMap; |
| 40 | 40 |
import javax.swing.DefaultListModel;
|
| 41 | 41 |
import javax.swing.InputMap;
|
| 42 | 42 |
import javax.swing.JComponent;
|
| 43 |
+import javax.swing.JSplitPane;
|
|
| 44 |
+import javax.swing.KeyStroke;
|
|
| 43 | 45 |
import javax.swing.SwingUtilities;
|
| 44 | 46 |
import java.awt.BorderLayout;
|
| 47 |
+import java.awt.event.KeyEvent;
|
|
| 45 | 48 |
import java.util.List;
|
| 46 | 49 |
import java.util.Objects;
|
| 47 | 50 |
|
| ... | ... | @@ -79,6 +82,8 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 79 | 82 |
|
| 80 | 83 |
if (o instanceof AbstractButton) {
|
| 81 | 84 |
init(inputMap, actionMap, (AbstractButton) o);
|
| 85 |
+ } else if (o instanceof JSplitPane) {
|
|
| 86 |
+ init((JSplitPane) o);
|
|
| 82 | 87 |
}
|
| 83 | 88 |
|
| 84 | 89 |
}
|
| ... | ... | @@ -190,6 +195,11 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 190 | 195 |
|
| 191 | 196 |
}
|
| 192 | 197 |
|
| 198 |
+ protected void init(JSplitPane editor) {
|
|
| 199 |
+ editor.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
|
|
| 200 |
+ .put(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0), "none");
|
|
| 201 |
+ }
|
|
| 202 |
+ |
|
| 193 | 203 |
protected void init(InputMap inputMap, ActionMap actionMap, AbstractButton editor) {
|
| 194 | 204 |
String actionId = (String) editor.getClientProperty(OBSERVE_ACTION);
|
| 195 | 205 |
if (actionId == null) {
|
| ... | ... | @@ -6,15 +6,15 @@ |
| 6 | 6 |
* %%
|
| 7 | 7 |
* This program is free software: you can redistribute it and/or modify
|
| 8 | 8 |
* it under the terms of the GNU General Public License as
|
| 9 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 9 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 10 | 10 |
* License, or (at your option) any later version.
|
| 11 |
- *
|
|
| 11 |
+ *
|
|
| 12 | 12 |
* This program is distributed in the hope that it will be useful,
|
| 13 | 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 | 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 | 15 |
* GNU General Public License for more details.
|
| 16 |
- *
|
|
| 17 |
- * You should have received a copy of the GNU General Public
|
|
| 16 |
+ *
|
|
| 17 |
+ * You should have received a copy of the GNU General Public
|
|
| 18 | 18 |
* License along with this program. If not, see
|
| 19 | 19 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 20 | 20 |
* #L%
|
| ... | ... | @@ -22,6 +22,7 @@ |
| 22 | 22 |
package fr.ird.observe.services.client.service.actions.report;
|
| 23 | 23 |
|
| 24 | 24 |
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 25 | 26 |
import fr.ird.observe.dto.reference.DtoReference;
|
| 26 | 27 |
import fr.ird.observe.services.client.service.ServiceClientTestSupport;
|
| 27 | 28 |
import fr.ird.observe.services.service.actions.report.DataMatrix;
|
| ... | ... | @@ -43,7 +44,7 @@ import java.util.List; |
| 43 | 44 |
|
| 44 | 45 |
/**
|
| 45 | 46 |
* Classe abstraite de test d'un report.
|
| 46 |
- *
|
|
| 47 |
+ * <p>
|
|
| 47 | 48 |
* On définit ici le mécanisme pour tester unitairement un report et son
|
| 48 | 49 |
* résultat.
|
| 49 | 50 |
*
|
| ... | ... | @@ -54,15 +55,45 @@ public abstract class AbstractReportServiceClientTest extends ServiceClientTestS |
| 54 | 55 |
|
| 55 | 56 |
/** Logger */
|
| 56 | 57 |
private static final Logger log = LogManager.getLogger(AbstractReportServiceClientTest.class);
|
| 57 |
- |
|
| 58 |
- protected ReportService service;
|
|
| 59 |
- |
|
| 60 | 58 |
/** La liste de tous les reports connus. */
|
| 61 | 59 |
protected static List<Report> reports;
|
| 62 |
- |
|
| 60 |
+ protected ReportService service;
|
|
| 63 | 61 |
/** Le report à tester. */
|
| 64 | 62 |
private Report report;
|
| 65 | 63 |
|
| 64 |
+ protected static Report getReport(Logger log, String reportId) throws IOException {
|
|
| 65 |
+ if (reports == null) {
|
|
| 66 |
+ |
|
| 67 |
+ URL reportLocation =
|
|
| 68 |
+ AbstractReportServiceClientTest.class.getResource("/observe-reports.properties");
|
|
| 69 |
+ |
|
| 70 |
+ if (log.isInfoEnabled()) {
|
|
| 71 |
+ log.info("Loading reports from " + reportLocation);
|
|
| 72 |
+ }
|
|
| 73 |
+ |
|
| 74 |
+ ReportBuilder builder = new ReportBuilder();
|
|
| 75 |
+ |
|
| 76 |
+ reports = builder.load(reportLocation);
|
|
| 77 |
+ |
|
| 78 |
+ builder.clear();
|
|
| 79 |
+ |
|
| 80 |
+ Assert.assertNotNull(reports);
|
|
| 81 |
+ Assert.assertFalse(reports.isEmpty());
|
|
| 82 |
+ }
|
|
| 83 |
+ |
|
| 84 |
+ Report result = null;
|
|
| 85 |
+ // recuperation du report à tester
|
|
| 86 |
+ for (Report report : reports) {
|
|
| 87 |
+ if (reportId.equals(report.getId())) {
|
|
| 88 |
+ result = report;
|
|
| 89 |
+ break;
|
|
| 90 |
+ }
|
|
| 91 |
+ }
|
|
| 92 |
+ |
|
| 93 |
+ Assert.assertNotNull("Could not find report with id " + reportId, reports);
|
|
| 94 |
+ return result;
|
|
| 95 |
+ }
|
|
| 96 |
+ |
|
| 66 | 97 |
protected abstract String getReportId();
|
| 67 | 98 |
|
| 68 | 99 |
@Before
|
| ... | ... | @@ -81,16 +112,14 @@ public abstract class AbstractReportServiceClientTest extends ServiceClientTestS |
| 81 | 112 |
|
| 82 | 113 |
}
|
| 83 | 114 |
|
| 84 |
- |
|
| 85 | 115 |
/**
|
| 86 | 116 |
* L'unique test à lancer.
|
| 87 |
- *
|
|
| 117 |
+ * <p>
|
|
| 88 | 118 |
* On vérifie :
|
| 89 | 119 |
* <ul>
|
| 90 | 120 |
* <li>la syntaxe du report via {@link #testReportSyntax(Report)}</li>
|
| 91 | 121 |
* <li>le résultat du report via {@link #testReportResult(DataMatrix)}</li>
|
| 92 | 122 |
* </ul>
|
| 93 |
- *
|
|
| 94 | 123 |
*/
|
| 95 | 124 |
@Test
|
| 96 | 125 |
public final void testReport() {
|
| ... | ... | @@ -99,23 +128,25 @@ public abstract class AbstractReportServiceClientTest extends ServiceClientTestS |
| 99 | 128 |
testReportSyntax(report);
|
| 100 | 129 |
|
| 101 | 130 |
// creation de l'executeur de report
|
| 102 |
- report = service.populateVariables(report, ObserveFixtures.TRIP_SEINE_ID_1);
|
|
| 131 |
+ ImmutableSet<String> tripIds = getTripIds();
|
|
| 132 |
+ report = service.populateVariables(report, tripIds);
|
|
| 103 | 133 |
|
| 104 | 134 |
// preparation des variables
|
| 105 | 135 |
prepareVariables();
|
| 106 | 136 |
|
| 107 | 137 |
|
| 108 | 138 |
// on execute le report
|
| 109 |
- DataMatrix result = service.executeReport(report,ObserveFixtures. TRIP_SEINE_ID_1);
|
|
| 110 |
- |
|
| 111 |
- if (log.isInfoEnabled()) {
|
|
| 112 |
- log.info("Result :\n" + result.getClipboardContent(true, true, false, '\t'));
|
|
| 113 |
- }
|
|
| 139 |
+ DataMatrix result = service.executeReport(report, tripIds);
|
|
| 114 | 140 |
|
| 141 |
+ log.info("Result :\n" + result.getClipboardContent(true, true, false, '\t'));
|
|
| 115 | 142 |
// on verifie le resultat
|
| 116 | 143 |
testReportResult(result);
|
| 117 | 144 |
}
|
| 118 | 145 |
|
| 146 |
+ protected ImmutableSet<String> getTripIds() {
|
|
| 147 |
+ return ImmutableSet.of(ObserveFixtures.TRIP_SEINE_ID_1);
|
|
| 148 |
+ }
|
|
| 149 |
+ |
|
| 119 | 150 |
protected void prepareVariables() {
|
| 120 | 151 |
|
| 121 | 152 |
}
|
| ... | ... | @@ -127,9 +158,9 @@ public abstract class AbstractReportServiceClientTest extends ServiceClientTestS |
| 127 | 158 |
if (variableName.equals(variable.getName())) {
|
| 128 | 159 |
|
| 129 | 160 |
Object value = variable.getValues().stream()
|
| 130 |
- .filter(DtoReference.newIdPredicate(id))
|
|
| 131 |
- .findFirst()
|
|
| 132 |
- .orElse(null);
|
|
| 161 |
+ .filter(DtoReference.newIdPredicate(id))
|
|
| 162 |
+ .findFirst()
|
|
| 163 |
+ .orElse(null);
|
|
| 133 | 164 |
|
| 134 | 165 |
variable.setSelectedValue(value);
|
| 135 | 166 |
|
| ... | ... | @@ -143,39 +174,6 @@ public abstract class AbstractReportServiceClientTest extends ServiceClientTestS |
| 143 | 174 |
|
| 144 | 175 |
protected abstract void testReportResult(DataMatrix result);
|
| 145 | 176 |
|
| 146 |
- protected static Report getReport(Logger log, String reportId) throws IOException {
|
|
| 147 |
- if (reports == null) {
|
|
| 148 |
- |
|
| 149 |
- URL reportLocation =
|
|
| 150 |
- AbstractReportServiceClientTest.class.getResource("/observe-reports.properties");
|
|
| 151 |
- |
|
| 152 |
- if (log.isInfoEnabled()) {
|
|
| 153 |
- log.info("Loading reports from " + reportLocation);
|
|
| 154 |
- }
|
|
| 155 |
- |
|
| 156 |
- ReportBuilder builder = new ReportBuilder();
|
|
| 157 |
- |
|
| 158 |
- reports = builder.load(reportLocation);
|
|
| 159 |
- |
|
| 160 |
- builder.clear();
|
|
| 161 |
- |
|
| 162 |
- Assert.assertNotNull(reports);
|
|
| 163 |
- Assert.assertFalse(reports.isEmpty());
|
|
| 164 |
- }
|
|
| 165 |
- |
|
| 166 |
- Report result = null;
|
|
| 167 |
- // recuperation du report à tester
|
|
| 168 |
- for (Report report : reports) {
|
|
| 169 |
- if (reportId.equals(report.getId())) {
|
|
| 170 |
- result = report;
|
|
| 171 |
- break;
|
|
| 172 |
- }
|
|
| 173 |
- }
|
|
| 174 |
- |
|
| 175 |
- Assert.assertNotNull("Could not find report with id " + reportId, reports);
|
|
| 176 |
- return result;
|
|
| 177 |
- }
|
|
| 178 |
- |
|
| 179 | 177 |
protected void assertReportName(Report report,
|
| 180 | 178 |
String name,
|
| 181 | 179 |
String description) {
|
| ... | ... | @@ -10,18 +10,19 @@ package fr.ird.observe.services.local.service.actions.report; |
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| 11 | 11 |
* published by the Free Software Foundation, either version 3 of the
|
| 12 | 12 |
* License, or (at your option) any later version.
|
| 13 |
- *
|
|
| 13 |
+ *
|
|
| 14 | 14 |
* This program is distributed in the hope that it will be useful,
|
| 15 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | 17 |
* GNU General Public License for more details.
|
| 18 |
- *
|
|
| 18 |
+ *
|
|
| 19 | 19 |
* You should have received a copy of the GNU General Public
|
| 20 | 20 |
* License along with this program. If not, see
|
| 21 | 21 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 25 | 26 |
import com.google.common.collect.Maps;
|
| 26 | 27 |
import fr.ird.observe.dto.data.DataDto;
|
| 27 | 28 |
import fr.ird.observe.dto.reference.DataDtoReferenceSet;
|
| ... | ... | @@ -42,6 +43,10 @@ import fr.ird.observe.services.service.actions.report.ReportVariable; |
| 42 | 43 |
import fr.ird.observe.spi.DbModelHelper;
|
| 43 | 44 |
import fr.ird.observe.spi.context.DataDtoEntityContext;
|
| 44 | 45 |
import fr.ird.observe.spi.context.ReferentialDtoEntityContext;
|
| 46 |
+import org.apache.commons.lang3.mutable.MutableInt;
|
|
| 47 |
+import org.apache.logging.log4j.LogManager;
|
|
| 48 |
+import org.apache.logging.log4j.Logger;
|
|
| 49 |
+ |
|
| 45 | 50 |
import java.awt.Dimension;
|
| 46 | 51 |
import java.awt.Point;
|
| 47 | 52 |
import java.io.Serializable;
|
| ... | ... | @@ -53,9 +58,6 @@ import java.util.List; |
| 53 | 58 |
import java.util.Map;
|
| 54 | 59 |
import java.util.Set;
|
| 55 | 60 |
import java.util.TreeMap;
|
| 56 |
-import org.apache.commons.lang3.mutable.MutableInt;
|
|
| 57 |
-import org.apache.logging.log4j.Logger;
|
|
| 58 |
-import org.apache.logging.log4j.LogManager;
|
|
| 59 | 61 |
|
| 60 | 62 |
/**
|
| 61 | 63 |
* @author Tony Chemit - dev@tchemit.fr
|
| ... | ... | @@ -66,11 +68,11 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer |
| 66 | 68 |
private static final Logger log = LogManager.getLogger(ReportServiceLocal.class);
|
| 67 | 69 |
|
| 68 | 70 |
@Override
|
| 69 |
- public Report populateVariables(Report report, String tripId) {
|
|
| 71 |
+ public Report populateVariables(Report report, ImmutableSet<String> tripIds) {
|
|
| 70 | 72 |
|
| 71 | 73 |
Map<String, Object> vars = new TreeMap<>();
|
| 72 | 74 |
|
| 73 |
- vars.put(ReportRequest.TRIP_ID_VARIABLE, tripId);
|
|
| 75 |
+ vars.put(ReportRequest.TRIP_ID_VARIABLE, tripIds);
|
|
| 74 | 76 |
|
| 75 | 77 |
for (ReportVariable variable : report.getVariables()) {
|
| 76 | 78 |
|
| ... | ... | @@ -116,7 +118,7 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer |
| 116 | 118 |
}
|
| 117 | 119 |
|
| 118 | 120 |
@Override
|
| 119 |
- public DataMatrix executeReport(Report report, String tripId) {
|
|
| 121 |
+ public DataMatrix executeReport(Report report, ImmutableSet<String> tripId) {
|
|
| 120 | 122 |
|
| 121 | 123 |
if (report == null) {
|
| 122 | 124 |
|
| ... | ... | @@ -171,7 +173,7 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer |
| 171 | 173 |
return result;
|
| 172 | 174 |
}
|
| 173 | 175 |
|
| 174 |
- private DataMatrix executeReportOperation(ReportOperation executeRequests, Report report, String tripId, DataMatrix incoming) {
|
|
| 176 |
+ private DataMatrix executeReportOperation(ReportOperation executeRequests, Report report, ImmutableSet<String> tripId, DataMatrix incoming) {
|
|
| 175 | 177 |
|
| 176 | 178 |
DataMatrix result = incoming;
|
| 177 | 179 |
|
| ... | ... | @@ -413,7 +415,7 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer |
| 413 | 415 |
return result;
|
| 414 | 416 |
}
|
| 415 | 417 |
|
| 416 |
- private DataMatrix executeReportRequest(ReportRequest request, Report report, String tripId, ReportVariable repeatValues) {
|
|
| 418 |
+ private DataMatrix executeReportRequest(ReportRequest request, Report report, ImmutableSet<String> tripId, ReportVariable repeatValues) {
|
|
| 417 | 419 |
|
| 418 | 420 |
DataMatrix result = new DataMatrix();
|
| 419 | 421 |
|
| ... | ... | @@ -457,7 +459,7 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer |
| 457 | 459 |
return result;
|
| 458 | 460 |
}
|
| 459 | 461 |
|
| 460 |
- private DataMatrix executeReportRequest(ReportRequest request, Report report, String tripId) {
|
|
| 462 |
+ private DataMatrix executeReportRequest(ReportRequest request, Report report, ImmutableSet<String> tripId) {
|
|
| 461 | 463 |
Map<String, Object> params = ReportRequest.extractParams(report, tripId);
|
| 462 | 464 |
|
| 463 | 465 |
return executeReportRequest(request, params);
|
| ... | ... | @@ -650,10 +652,11 @@ public class ReportServiceLocal extends ObserveServiceLocal implements ReportSer |
| 650 | 652 |
|
| 651 | 653 |
AbstractObserveTopiaDao dao = (AbstractObserveTopiaDao) getTopiaPersistenceContext().getDao(TripSeine.class);
|
| 652 | 654 |
|
| 655 |
+ log.info(String.format("Request: %s, params: %s", request, paramsFixes));
|
|
| 653 | 656 |
return dao.findAllFromHql(request, paramsFixes);
|
| 654 | 657 |
}
|
| 655 | 658 |
|
| 656 |
- private void doPopulateRepeatVariables(Report report, String tripId) {
|
|
| 659 |
+ private void doPopulateRepeatVariables(Report report, ImmutableSet<String> tripId) {
|
|
| 657 | 660 |
|
| 658 | 661 |
Map<String, Object> vars = ReportRequest.extractParams(report, tripId);
|
| 659 | 662 |
|
| ... | ... | @@ -43,7 +43,7 @@ public class DisableSqlStatementGenerator { |
| 43 | 43 |
}
|
| 44 | 44 |
|
| 45 | 45 |
public String generateSql(String sourceId) {
|
| 46 |
- return TopiaSqlStatements.generateUpdateStatement(metadataEntity, sourceId, "enabled = false, topiaVersion = topiaVersion + 1");
|
|
| 46 |
+ return TopiaSqlStatements.generateUpdateStatement(metadataEntity, sourceId, "status = 0, topiaVersion = topiaVersion + 1");
|
|
| 47 | 47 |
}
|
| 48 | 48 |
|
| 49 | 49 |
}
|
| ... | ... | @@ -10,12 +10,12 @@ package fr.ird.observe.services.local.service.actions.validate; |
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| 11 | 11 |
* published by the Free Software Foundation, either version 3 of the
|
| 12 | 12 |
* License, or (at your option) any later version.
|
| 13 |
- *
|
|
| 13 |
+ *
|
|
| 14 | 14 |
* This program is distributed in the hope that it will be useful,
|
| 15 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | 17 |
* GNU General Public License for more details.
|
| 18 |
- *
|
|
| 18 |
+ *
|
|
| 19 | 19 |
* You should have received a copy of the GNU General Public
|
| 20 | 20 |
* License along with this program. If not, see
|
| 21 | 21 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| ... | ... | @@ -33,25 +33,24 @@ import fr.ird.observe.dto.reference.ReferentialDtoReference; |
| 33 | 33 |
import fr.ird.observe.dto.referential.ReferentialDto;
|
| 34 | 34 |
import fr.ird.observe.dto.referential.ReferentialLocale;
|
| 35 | 35 |
import fr.ird.observe.dto.referential.SpeciesDto;
|
| 36 |
-import fr.ird.observe.dto.referential.seine.ObservedSystemReference;
|
|
| 37 | 36 |
import fr.ird.observe.entities.Trip;
|
| 38 | 37 |
import fr.ird.observe.entities.referentiel.ObserveReferentialEntity;
|
| 39 | 38 |
import fr.ird.observe.entities.referentiel.Species;
|
| 40 |
-import fr.ird.observe.entities.referentiel.seine.ObservedSystem;
|
|
| 41 | 39 |
import fr.ird.observe.persistence.Entities;
|
| 42 | 40 |
import fr.ird.observe.services.local.service.ObserveServiceLocal;
|
| 43 | 41 |
import fr.ird.observe.services.service.actions.validate.DataValidationRequest;
|
| 42 |
+import fr.ird.observe.services.service.actions.validate.DataValidationResult;
|
|
| 44 | 43 |
import fr.ird.observe.services.service.actions.validate.ReferentialValidationRequest;
|
| 44 |
+import fr.ird.observe.services.service.actions.validate.ReferentialValidationResult;
|
|
| 45 | 45 |
import fr.ird.observe.services.service.actions.validate.ValidateService;
|
| 46 | 46 |
import fr.ird.observe.services.service.actions.validate.ValidationRequest;
|
| 47 |
-import fr.ird.observe.services.service.actions.validate.ValidationResult;
|
|
| 48 | 47 |
import fr.ird.observe.services.service.referential.ReferentialService;
|
| 49 | 48 |
import fr.ird.observe.services.validation.ServiceValidationContext;
|
| 50 | 49 |
import fr.ird.observe.services.validation.ValidationDataContext;
|
| 51 | 50 |
import fr.ird.observe.services.validation.ValidatorsMap;
|
| 52 | 51 |
import fr.ird.observe.spi.DbModelHelper;
|
| 53 |
-import org.apache.logging.log4j.Logger;
|
|
| 54 | 52 |
import org.apache.logging.log4j.LogManager;
|
| 53 |
+import org.apache.logging.log4j.Logger;
|
|
| 55 | 54 |
import org.nuiton.validator.xwork2.XWork2ValidatorUtil;
|
| 56 | 55 |
|
| 57 | 56 |
import java.util.List;
|
| ... | ... | @@ -71,12 +70,12 @@ public class ValidateServiceLocal extends ObserveServiceLocal implements Validat |
| 71 | 70 |
private static final ExecutorService EXECUTOR_SERVICE = Executors.newFixedThreadPool(5);
|
| 72 | 71 |
|
| 73 | 72 |
@Override
|
| 74 |
- public ValidationResult<ReferentialValidationRequest> validateReferential(ReferentialValidationRequest request) {
|
|
| 73 |
+ public ReferentialValidationResult validateReferential(ReferentialValidationRequest request) {
|
|
| 75 | 74 |
|
| 76 |
- Future<ValidationResult<ReferentialValidationRequest>> future = EXECUTOR_SERVICE.submit(() -> {
|
|
| 75 |
+ Future<ReferentialValidationResult> future = EXECUTOR_SERVICE.submit(() -> {
|
|
| 77 | 76 |
|
| 78 | 77 |
ReferentialLocale referentialLocale = getReferentialLocale();
|
| 79 |
- ValidationResult.Builder<ReferentialValidationRequest> resultBuilder = ValidationResult.builder(referentialLocale, request);
|
|
| 78 |
+ ReferentialValidationResult.Builder<ReferentialValidationRequest, ReferentialValidationResult> resultBuilder = ReferentialValidationResult.builder(referentialLocale, request);
|
|
| 80 | 79 |
|
| 81 | 80 |
ServiceValidationContext validationContext = createServiceValidationContext(request);
|
| 82 | 81 |
|
| ... | ... | @@ -101,12 +100,12 @@ public class ValidateServiceLocal extends ObserveServiceLocal implements Validat |
| 101 | 100 |
}
|
| 102 | 101 |
|
| 103 | 102 |
@Override
|
| 104 |
- public ValidationResult<DataValidationRequest> validateData(DataValidationRequest request) {
|
|
| 103 |
+ public DataValidationResult validateData(DataValidationRequest request) {
|
|
| 105 | 104 |
|
| 106 |
- Future<ValidationResult<DataValidationRequest>> future = EXECUTOR_SERVICE.submit(() -> {
|
|
| 105 |
+ Future<DataValidationResult> future = EXECUTOR_SERVICE.submit(() -> {
|
|
| 107 | 106 |
|
| 108 | 107 |
ReferentialLocale referentialLocale = getReferentialLocale();
|
| 109 |
- ValidationResult.Builder<DataValidationRequest> resultBuilder = ValidationResult.builder(referentialLocale, request);
|
|
| 108 |
+ DataValidationResult.Builder<DataValidationRequest, DataValidationResult> resultBuilder = DataValidationResult.builder(referentialLocale, request);
|
|
| 110 | 109 |
|
| 111 | 110 |
ServiceValidationContext validationContext = createServiceValidationContext(request);
|
| 112 | 111 |
|
| ... | ... | @@ -35,6 +35,7 @@ import fr.ird.observe.dto.data.seine.RouteDto; |
| 35 | 35 |
import fr.ird.observe.dto.data.seine.SetSeineDto;
|
| 36 | 36 |
import fr.ird.observe.dto.data.seine.TripSeineDto;
|
| 37 | 37 |
import fr.ird.observe.entities.ObserveEntity;
|
| 38 |
+import fr.ird.observe.services.service.actions.validate.ReferentialValidationResult;
|
|
| 38 | 39 |
import fr.ird.observe.services.service.actions.validate.ValidationResult;
|
| 39 | 40 |
import fr.ird.observe.services.validation.ServiceValidationContext;
|
| 40 | 41 |
import fr.ird.observe.services.validation.ValidatorsMap;
|
| ... | ... | @@ -135,7 +136,7 @@ class ValidationMessageDetector implements SimpleBeanValidatorListener { |
| 135 | 136 |
static ValidationMessageDetector forReferential(ValidatorsMap validators,
|
| 136 | 137 |
ServiceValidationContext validationDataContext,
|
| 137 | 138 |
ReferentialLocale referentialLocale,
|
| 138 |
- ValidationResult.Builder resultBuilder) {
|
|
| 139 |
+ ReferentialValidationResult.Builder resultBuilder) {
|
|
| 139 | 140 |
|
| 140 | 141 |
ImmutableMap.Builder<Class, EntityInterceptor> interceptorsBuilder = ImmutableMap.builder();
|
| 141 | 142 |
|
| ... | ... | @@ -6,15 +6,15 @@ |
| 6 | 6 |
* %%
|
| 7 | 7 |
* This program is free software: you can redistribute it and/or modify
|
| 8 | 8 |
* it under the terms of the GNU General Public License as
|
| 9 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 9 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 10 | 10 |
* License, or (at your option) any later version.
|
| 11 |
- *
|
|
| 11 |
+ *
|
|
| 12 | 12 |
* This program is distributed in the hope that it will be useful,
|
| 13 | 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 | 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 | 15 |
* GNU General Public License for more details.
|
| 16 |
- *
|
|
| 17 |
- * You should have received a copy of the GNU General Public
|
|
| 16 |
+ *
|
|
| 17 |
+ * You should have received a copy of the GNU General Public
|
|
| 18 | 18 |
* License along with this program. If not, see
|
| 19 | 19 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 20 | 20 |
* #L%
|
| ... | ... | @@ -22,6 +22,7 @@ |
| 22 | 22 |
package fr.ird.observe.services.local.service.actions.report;
|
| 23 | 23 |
|
| 24 | 24 |
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 25 | 26 |
import fr.ird.observe.dto.reference.DtoReference;
|
| 26 | 27 |
import fr.ird.observe.services.local.service.ServiceLocalTestSupport;
|
| 27 | 28 |
import fr.ird.observe.services.service.actions.report.DataMatrix;
|
| ... | ... | @@ -33,15 +34,16 @@ import fr.ird.observe.services.service.actions.report.ReportVariable; |
| 33 | 34 |
import fr.ird.observe.test.DatabaseName;
|
| 34 | 35 |
import fr.ird.observe.test.ObserveFixtures;
|
| 35 | 36 |
import fr.ird.observe.test.spi.DatabaseNameConfiguration;
|
| 36 |
-import java.io.IOException;
|
|
| 37 |
-import java.net.URL;
|
|
| 38 |
-import java.util.List;
|
|
| 39 |
-import org.apache.logging.log4j.Logger;
|
|
| 40 | 37 |
import org.apache.logging.log4j.LogManager;
|
| 38 |
+import org.apache.logging.log4j.Logger;
|
|
| 41 | 39 |
import org.junit.Assert;
|
| 42 | 40 |
import org.junit.Before;
|
| 43 | 41 |
import org.junit.Test;
|
| 44 | 42 |
|
| 43 |
+import java.io.IOException;
|
|
| 44 |
+import java.net.URL;
|
|
| 45 |
+import java.util.List;
|
|
| 46 |
+ |
|
| 45 | 47 |
/**
|
| 46 | 48 |
* Classe abstraite de test d'un report.
|
| 47 | 49 |
* <p>
|
| ... | ... | @@ -56,15 +58,45 @@ public abstract class AbstractReportServiceLocalTest extends ServiceLocalTestSup |
| 56 | 58 |
|
| 57 | 59 |
/** Logger */
|
| 58 | 60 |
private static final Logger log = LogManager.getLogger(AbstractReportServiceLocalTest.class);
|
| 59 |
- |
|
| 60 |
- protected ReportService service;
|
|
| 61 |
- |
|
| 62 | 61 |
/** La liste de tous les reports connus. */
|
| 63 | 62 |
protected static List<Report> reports;
|
| 64 |
- |
|
| 63 |
+ protected ReportService service;
|
|
| 65 | 64 |
/** Le report à tester. */
|
| 66 | 65 |
private Report report;
|
| 67 | 66 |
|
| 67 |
+ protected static Report getReport(Logger log, String reportId) throws IOException {
|
|
| 68 |
+ if (reports == null) {
|
|
| 69 |
+ |
|
| 70 |
+ URL reportLocation =
|
|
| 71 |
+ AbstractReportServiceLocalTest.class.getResource("/observe-reports.properties");
|
|
| 72 |
+ |
|
| 73 |
+ if (log.isInfoEnabled()) {
|
|
| 74 |
+ log.info("Loading reports from " + reportLocation);
|
|
| 75 |
+ }
|
|
| 76 |
+ |
|
| 77 |
+ ReportBuilder builder = new ReportBuilder();
|
|
| 78 |
+ |
|
| 79 |
+ reports = builder.load(reportLocation);
|
|
| 80 |
+ |
|
| 81 |
+ builder.clear();
|
|
| 82 |
+ |
|
| 83 |
+ Assert.assertNotNull(reports);
|
|
| 84 |
+ Assert.assertFalse(reports.isEmpty());
|
|
| 85 |
+ }
|
|
| 86 |
+ |
|
| 87 |
+ Report result = null;
|
|
| 88 |
+ // recuperation du report à tester
|
|
| 89 |
+ for (Report report : reports) {
|
|
| 90 |
+ if (reportId.equals(report.getId())) {
|
|
| 91 |
+ result = report;
|
|
| 92 |
+ break;
|
|
| 93 |
+ }
|
|
| 94 |
+ }
|
|
| 95 |
+ |
|
| 96 |
+ Assert.assertNotNull("Could not find report with id " + reportId, reports);
|
|
| 97 |
+ return result;
|
|
| 98 |
+ }
|
|
| 99 |
+ |
|
| 68 | 100 |
protected abstract String getReportId();
|
| 69 | 101 |
|
| 70 | 102 |
@Before
|
| ... | ... | @@ -81,7 +113,6 @@ public abstract class AbstractReportServiceLocalTest extends ServiceLocalTestSup |
| 81 | 113 |
|
| 82 | 114 |
}
|
| 83 | 115 |
|
| 84 |
- |
|
| 85 | 116 |
/**
|
| 86 | 117 |
* L'unique test à lancer.
|
| 87 | 118 |
* <p>
|
| ... | ... | @@ -90,7 +121,6 @@ public abstract class AbstractReportServiceLocalTest extends ServiceLocalTestSup |
| 90 | 121 |
* <li>la syntaxe du report via {@link #testReportSyntax(Report)}</li>
|
| 91 | 122 |
* <li>le résultat du report via {@link #testReportResult(DataMatrix)}</li>
|
| 92 | 123 |
* </ul>
|
| 93 |
- *
|
|
| 94 | 124 |
*/
|
| 95 | 125 |
@Test
|
| 96 | 126 |
public final void testReport() {
|
| ... | ... | @@ -98,24 +128,28 @@ public abstract class AbstractReportServiceLocalTest extends ServiceLocalTestSup |
| 98 | 128 |
// test de la syntaxe du report
|
| 99 | 129 |
testReportSyntax(report);
|
| 100 | 130 |
|
| 131 |
+ ImmutableSet<String> tripIds = getTripIds();
|
|
| 132 |
+ |
|
| 101 | 133 |
// creation de l'executeur de report
|
| 102 |
- report = service.populateVariables(report, ObserveFixtures.TRIP_SEINE_ID_1);
|
|
| 134 |
+ report = service.populateVariables(report, tripIds);
|
|
| 103 | 135 |
|
| 104 | 136 |
// preparation des variables
|
| 105 | 137 |
prepareVariables();
|
| 106 | 138 |
|
| 107 | 139 |
|
| 108 | 140 |
// on execute le report
|
| 109 |
- DataMatrix result = service.executeReport(report, ObserveFixtures.TRIP_SEINE_ID_1);
|
|
| 141 |
+ DataMatrix result = service.executeReport(report, tripIds);
|
|
| 110 | 142 |
|
| 111 |
- if (log.isInfoEnabled()) {
|
|
| 112 |
- log.info("Result :\n" + result.getClipboardContent(true, true, true, ','));
|
|
| 113 |
- }
|
|
| 143 |
+ log.info(String.format("Result :\n%s", result.getClipboardContent(true, true, true, ',')));
|
|
| 114 | 144 |
|
| 115 | 145 |
// on verifie le resultat
|
| 116 | 146 |
testReportResult(result);
|
| 117 | 147 |
}
|
| 118 | 148 |
|
| 149 |
+ protected ImmutableSet<String> getTripIds() {
|
|
| 150 |
+ return ImmutableSet.of(ObserveFixtures.TRIP_SEINE_ID_1);
|
|
| 151 |
+ }
|
|
| 152 |
+ |
|
| 119 | 153 |
protected void prepareVariables() {
|
| 120 | 154 |
|
| 121 | 155 |
}
|
| ... | ... | @@ -143,39 +177,6 @@ public abstract class AbstractReportServiceLocalTest extends ServiceLocalTestSup |
| 143 | 177 |
|
| 144 | 178 |
protected abstract void testReportResult(DataMatrix result);
|
| 145 | 179 |
|
| 146 |
- protected static Report getReport(Logger log, String reportId) throws IOException {
|
|
| 147 |
- if (reports == null) {
|
|
| 148 |
- |
|
| 149 |
- URL reportLocation =
|
|
| 150 |
- AbstractReportServiceLocalTest.class.getResource("/observe-reports.properties");
|
|
| 151 |
- |
|
| 152 |
- if (log.isInfoEnabled()) {
|
|
| 153 |
- log.info("Loading reports from " + reportLocation);
|
|
| 154 |
- }
|
|
| 155 |
- |
|
| 156 |
- ReportBuilder builder = new ReportBuilder();
|
|
| 157 |
- |
|
| 158 |
- reports = builder.load(reportLocation);
|
|
| 159 |
- |
|
| 160 |
- builder.clear();
|
|
| 161 |
- |
|
| 162 |
- Assert.assertNotNull(reports);
|
|
| 163 |
- Assert.assertFalse(reports.isEmpty());
|
|
| 164 |
- }
|
|
| 165 |
- |
|
| 166 |
- Report result = null;
|
|
| 167 |
- // recuperation du report à tester
|
|
| 168 |
- for (Report report : reports) {
|
|
| 169 |
- if (reportId.equals(report.getId())) {
|
|
| 170 |
- result = report;
|
|
| 171 |
- break;
|
|
| 172 |
- }
|
|
| 173 |
- }
|
|
| 174 |
- |
|
| 175 |
- Assert.assertNotNull("Could not find report with id " + reportId, reports);
|
|
| 176 |
- return result;
|
|
| 177 |
- }
|
|
| 178 |
- |
|
| 179 | 180 |
protected void assertReportName(Report report,
|
| 180 | 181 |
String name,
|
| 181 | 182 |
String description) {
|
| ... | ... | @@ -228,12 +229,12 @@ public abstract class AbstractReportServiceLocalTest extends ServiceLocalTestSup |
| 228 | 229 |
|
| 229 | 230 |
protected void assertResultRow(DataMatrix result, int rowId, Object... row) {
|
| 230 | 231 |
Object[] actualRow = result.getData()[rowId];
|
| 231 |
- int index=0;
|
|
| 232 |
+ int index = 0;
|
|
| 232 | 233 |
for (Object o : actualRow) {
|
| 233 |
- if (o==null) {
|
|
| 234 |
+ if (o == null) {
|
|
| 234 | 235 |
Assert.assertEquals(row[index++], o);
|
| 235 |
- }else {
|
|
| 236 |
- Assert.assertArrayEquals(row[index++].toString().split("\\s*\\n\\s*"),o.toString().split("\\s*\\n\\s*"));
|
|
| 236 |
+ } else {
|
|
| 237 |
+ Assert.assertArrayEquals(row[index++].toString().split("\\s*\\n\\s*"), o.toString().split("\\s*\\n\\s*"));
|
|
| 237 | 238 |
}
|
| 238 | 239 |
}
|
| 239 | 240 |
//Assert.assertArrayEquals(row, actualRow);
|
| 1 |
+/*
|
|
| 2 |
+ * #%L
|
|
| 3 |
+ * ObServe :: Services local implementation
|
|
| 4 |
+ * %%
|
|
| 5 |
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 6 |
+ * %%
|
|
| 7 |
+ * This program is free software: you can redistribute it and/or modify
|
|
| 8 |
+ * it under the terms of the GNU General Public License as
|
|
| 9 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 10 |
+ * License, or (at your option) any later version.
|
|
| 11 |
+ *
|
|
| 12 |
+ * This program is distributed in the hope that it will be useful,
|
|
| 13 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 14 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 15 |
+ * GNU General Public License for more details.
|
|
| 16 |
+ *
|
|
| 17 |
+ * You should have received a copy of the GNU General Public
|
|
| 18 |
+ * License along with this program. If not, see
|
|
| 19 |
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 20 |
+ * #L%
|
|
| 21 |
+ */
|
|
| 22 |
+package fr.ird.observe.services.local.service.actions.report;
|
|
| 23 |
+ |
|
| 24 |
+ |
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 26 |
+import fr.ird.observe.services.service.actions.report.DataMatrix;
|
|
| 27 |
+import fr.ird.observe.services.service.actions.report.Report;
|
|
| 28 |
+import fr.ird.observe.services.service.actions.report.ReportRequest;
|
|
| 29 |
+import fr.ird.observe.test.ObserveFixtures;
|
|
| 30 |
+import org.junit.Assert;
|
|
| 31 |
+ |
|
| 32 |
+/**
|
|
| 33 |
+ * Test du report {@code accessoryCatch}.
|
|
| 34 |
+ *
|
|
| 35 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 36 |
+ * @since 1.9
|
|
| 37 |
+ */
|
|
| 38 |
+public class ReportNonTargetDistributionLengthsTest extends AbstractReportServiceLocalTest {
|
|
| 39 |
+ |
|
| 40 |
+ @Override
|
|
| 41 |
+ protected void testReportSyntax(Report report) {
|
|
| 42 |
+ Assert.assertNotNull(report);
|
|
| 43 |
+ assertReportName(
|
|
| 44 |
+ report,
|
|
| 45 |
+ "Distribution des tailles par espèces non ciblées",
|
|
| 46 |
+ "Afficher la nombre d'individus mesurés par classe de taille pour les espèces non ciblées"
|
|
| 47 |
+ );
|
|
| 48 |
+ |
|
| 49 |
+ assertReportDimension(
|
|
| 50 |
+ report,
|
|
| 51 |
+ -1,
|
|
| 52 |
+ 2,
|
|
| 53 |
+ new String[]{"Classe de taille", "Effectif"}
|
|
| 54 |
+ );
|
|
| 55 |
+ |
|
| 56 |
+ assertReportNbRequests(report, 1);
|
|
| 57 |
+ |
|
| 58 |
+ ReportRequest[] requests = report.getRequests();
|
|
| 59 |
+ |
|
| 60 |
+ assertReportRequestDimension(
|
|
| 61 |
+ requests[0],
|
|
| 62 |
+ ReportRequest.RequestLayout.row,
|
|
| 63 |
+ 0,
|
|
| 64 |
+ 0
|
|
| 65 |
+ );
|
|
| 66 |
+ |
|
| 67 |
+ }
|
|
| 68 |
+ |
|
| 69 |
+ @Override
|
|
| 70 |
+ protected String getReportId() {
|
|
| 71 |
+ return "nonTargetDistributionLengths";
|
|
| 72 |
+ }
|
|
| 73 |
+ |
|
| 74 |
+ @Override
|
|
| 75 |
+ protected ImmutableSet<String> getTripIds() {
|
|
| 76 |
+ return ImmutableSet.of(ObserveFixtures.TRIP_SEINE_ID_1, ObserveFixtures.TRIP_SEINE_ID_2);
|
|
| 77 |
+ }
|
|
| 78 |
+ |
|
| 79 |
+ @Override
|
|
| 80 |
+ protected void prepareVariables() {
|
|
| 81 |
+ setVariableValue("speciesId", "fr.ird.observe.entities.referentiel.Species#1239832684439#0.9130769003657221");
|
|
| 82 |
+ }
|
|
| 83 |
+ |
|
| 84 |
+ @Override
|
|
| 85 |
+ protected void testReportResult(DataMatrix result) {
|
|
| 86 |
+ assertResultDimension(result, 2, 1, 0, 1);
|
|
| 87 |
+ assertResultRow(result, 0, "14.0", "1");
|
|
| 88 |
+ }
|
|
| 89 |
+}
|
| ... | ... | @@ -93,6 +93,10 @@ |
| 93 | 93 |
<groupId>io.ultreia.java4all.jaxx</groupId>
|
| 94 | 94 |
<artifactId>jaxx-widgets-gis</artifactId>
|
| 95 | 95 |
</dependency>
|
| 96 |
+ <dependency>
|
|
| 97 |
+ <groupId>io.ultreia.java4all</groupId>
|
|
| 98 |
+ <artifactId>java-lang</artifactId>
|
|
| 99 |
+ </dependency>
|
|
| 96 | 100 |
|
| 97 | 101 |
<!-- XWork -->
|
| 98 | 102 |
<dependency>
|
| ... | ... | @@ -25,6 +25,7 @@ package fr.ird.observe.services.gson; |
| 25 | 25 |
import com.google.gson.GsonBuilder;
|
| 26 | 26 |
import fr.ird.observe.services.service.actions.consolidate.dcp.FloatingObjectModification;
|
| 27 | 27 |
import fr.ird.observe.services.service.actions.report.ReportVariable;
|
| 28 |
+import fr.ird.observe.services.service.actions.validate.ValidationResultDto;
|
|
| 28 | 29 |
import io.ultreia.java4all.http.HResponseError;
|
| 29 | 30 |
import io.ultreia.java4all.http.HResponseErrorAdapter;
|
| 30 | 31 |
|
| ... | ... | @@ -51,7 +52,7 @@ public class ObserveDtoGsonSupplier extends ObserveDtoGsonSupplierSupport { |
| 51 | 52 |
gsonBuilder.registerTypeAdapter(ReportVariable.class, new ReportVariableAdapter());
|
| 52 | 53 |
gsonBuilder.registerTypeAdapter(HResponseError.class, new HResponseErrorAdapter());
|
| 53 | 54 |
gsonBuilder.registerTypeAdapter(FloatingObjectModification.class, new FloatingObjectModificationAdapter());
|
| 54 |
- |
|
| 55 |
+ gsonBuilder.registerTypeAdapter(ValidationResultDto.class, new ValidationResultDtoAdapter());
|
|
| 55 | 56 |
}
|
| 56 | 57 |
return gsonBuilder;
|
| 57 | 58 |
|
| ... | ... | @@ -29,10 +29,9 @@ import com.google.gson.JsonElement; |
| 29 | 29 |
import com.google.gson.JsonObject;
|
| 30 | 30 |
import com.google.gson.JsonParseException;
|
| 31 | 31 |
import fr.ird.observe.dto.data.DataDto;
|
| 32 |
-import fr.ird.observe.dto.reference.DataDtoReference;
|
|
| 33 |
-import fr.ird.observe.dto.reference.ReferentialDtoReference;
|
|
| 34 | 32 |
import fr.ird.observe.dto.referential.ReferentialDto;
|
| 35 | 33 |
import fr.ird.observe.services.service.actions.report.ReportVariable;
|
| 34 |
+import fr.ird.observe.spi.DtoModelHelper;
|
|
| 36 | 35 |
|
| 37 | 36 |
import java.lang.reflect.Type;
|
| 38 | 37 |
import java.util.Set;
|
| ... | ... | @@ -55,10 +54,10 @@ public class ReportVariableAdapter implements JsonDeserializer<ReportVariable> { |
| 55 | 54 |
Class valueType = type;
|
| 56 | 55 |
|
| 57 | 56 |
if (DataDto.class.isAssignableFrom(type)) {
|
| 58 |
- valueType = DataDtoReference.class;
|
|
| 57 |
+ valueType = DtoModelHelper.fromDataDto((Class) type).toReferenceType();
|
|
| 59 | 58 |
}
|
| 60 | 59 |
if (ReferentialDto.class.isAssignableFrom(type)) {
|
| 61 |
- valueType = ReferentialDtoReference.class;
|
|
| 60 |
+ valueType = DtoModelHelper.fromReferentialDto((Class) type).toReferenceType();
|
|
| 62 | 61 |
}
|
| 63 | 62 |
|
| 64 | 63 |
JsonElement valuesJson = reportVariableJson.get(ReportVariable.PROPERTY_VALUES);
|
| 1 |
+package fr.ird.observe.services.gson;
|
|
| 2 |
+ |
|
| 3 |
+/*
|
|
| 4 |
+ * #%L
|
|
| 5 |
+ * ObServe :: Services API
|
|
| 6 |
+ * %%
|
|
| 7 |
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
+ * %%
|
|
| 9 |
+ * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
+ * it under the terms of the GNU General Public License as
|
|
| 11 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
+ * License, or (at your option) any later version.
|
|
| 13 |
+ *
|
|
| 14 |
+ * This program is distributed in the hope that it will be useful,
|
|
| 15 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
+ * GNU General Public License for more details.
|
|
| 18 |
+ *
|
|
| 19 |
+ * You should have received a copy of the GNU General Public
|
|
| 20 |
+ * License along with this program. If not, see
|
|
| 21 |
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
+ * #L%
|
|
| 23 |
+ */
|
|
| 24 |
+ |
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 26 |
+import com.google.common.reflect.TypeToken;
|
|
| 27 |
+import com.google.gson.JsonDeserializationContext;
|
|
| 28 |
+import com.google.gson.JsonDeserializer;
|
|
| 29 |
+import com.google.gson.JsonElement;
|
|
| 30 |
+import com.google.gson.JsonObject;
|
|
| 31 |
+import com.google.gson.JsonParseException;
|
|
| 32 |
+import com.google.gson.JsonSerializationContext;
|
|
| 33 |
+import com.google.gson.JsonSerializer;
|
|
| 34 |
+import fr.ird.observe.dto.reference.DtoReference;
|
|
| 35 |
+import fr.ird.observe.services.service.actions.validate.ValidationResultDto;
|
|
| 36 |
+import fr.ird.observe.services.service.actions.validate.ValidationResultDtoMessage;
|
|
| 37 |
+ |
|
| 38 |
+import java.lang.reflect.Type;
|
|
| 39 |
+import java.util.Set;
|
|
| 40 |
+ |
|
| 41 |
+/**
|
|
| 42 |
+ * Created by tchemit on 23/09/2018.
|
|
| 43 |
+ *
|
|
| 44 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 45 |
+ */
|
|
| 46 |
+public class ValidationResultDtoAdapter implements JsonDeserializer<ValidationResultDto>, JsonSerializer<ValidationResultDto> {
|
|
| 47 |
+ |
|
| 48 |
+ @Override
|
|
| 49 |
+ public ValidationResultDto deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
|
| 50 |
+ JsonObject reportVariableJson = json.getAsJsonObject();
|
|
| 51 |
+ Class<?> type = context.deserialize(reportVariableJson.get("type"), Class.class);
|
|
| 52 |
+ DtoReference dtoReference = context.deserialize(reportVariableJson.get("dtoReference"), type);
|
|
| 53 |
+ Set<ValidationResultDtoMessage> messages = context.deserialize(reportVariableJson.get("messages"), ImmutableSetAdapter.setOf(TypeToken.of(ValidationResultDtoMessage.class)).getType());
|
|
| 54 |
+ return new ValidationResultDto(dtoReference, ImmutableSet.copyOf(messages));
|
|
| 55 |
+ }
|
|
| 56 |
+ |
|
| 57 |
+ @Override
|
|
| 58 |
+ public JsonElement serialize(ValidationResultDto src, Type typeOfSrc, JsonSerializationContext context) {
|
|
| 59 |
+ JsonObject result = new JsonObject();
|
|
| 60 |
+ result.add("type", context.serialize(src.getReference().getReferenceType()));
|
|
| 61 |
+ result.add("dtoReference", context.serialize(src.getReference()));
|
|
| 62 |
+ result.add("messages", context.serialize(src.getMessages().asList()));
|
|
| 63 |
+ return result;
|
|
| 64 |
+ }
|
|
| 65 |
+}
|
| ... | ... | @@ -6,15 +6,15 @@ |
| 6 | 6 |
* %%
|
| 7 | 7 |
* This program is free software: you can redistribute it and/or modify
|
| 8 | 8 |
* it under the terms of the GNU General Public License as
|
| 9 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 9 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 10 | 10 |
* License, or (at your option) any later version.
|
| 11 |
- *
|
|
| 11 |
+ *
|
|
| 12 | 12 |
* This program is distributed in the hope that it will be useful,
|
| 13 | 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 | 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 | 15 |
* GNU General Public License for more details.
|
| 16 |
- *
|
|
| 17 |
- * You should have received a copy of the GNU General Public
|
|
| 16 |
+ *
|
|
| 17 |
+ * You should have received a copy of the GNU General Public
|
|
| 18 | 18 |
* License along with this program. If not, see
|
| 19 | 19 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 20 | 20 |
* #L%
|
| ... | ... | @@ -23,6 +23,7 @@ package fr.ird.observe.services.service.actions.report; |
| 23 | 23 |
|
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.dto.ObserveModelType;
|
| 26 |
+import io.ultreia.java4all.lang.Objects2;
|
|
| 26 | 27 |
import org.apache.logging.log4j.Logger;
|
| 27 | 28 |
import org.apache.logging.log4j.LogManager;
|
| 28 | 29 |
import org.nuiton.util.SortedProperties;
|
| ... | ... | @@ -62,16 +63,13 @@ public class ReportBuilder { |
| 62 | 63 |
|
| 63 | 64 |
/** Logger */
|
| 64 | 65 |
private static final Logger log = LogManager.getLogger(ReportBuilder.class);
|
| 65 |
- |
|
| 66 |
+ /** les operations connues par le système */
|
|
| 67 |
+ protected static Map<String, Class<?>> operations;
|
|
| 66 | 68 |
/** les propriétés chargées par le builder pour construire les reports */
|
| 67 | 69 |
protected Properties properties;
|
| 68 |
- |
|
| 69 | 70 |
/** la liste des lastName sde reports connus par le système */
|
| 70 | 71 |
protected List<String> reportNames;
|
| 71 | 72 |
|
| 72 |
- /** les operations connues par le système */
|
|
| 73 |
- protected static Map<String, Class<?>> operations;
|
|
| 74 |
- |
|
| 75 | 73 |
public List<String> getReportNames() {
|
| 76 | 74 |
return reportNames;
|
| 77 | 75 |
}
|
| ... | ... | @@ -331,7 +329,7 @@ public class ReportBuilder { |
| 331 | 329 |
|
| 332 | 330 |
// on interdit l'utilisation de la variable tripId
|
| 333 | 331 |
if (ReportRequest.TRIP_ID_VARIABLE.equals(id)) {
|
| 334 |
- throw new IllegalArgumentException("La variable tripId n'est pas utilisable (c'est uen variable réservée) pour le report " + reportName);
|
|
| 332 |
+ throw new IllegalArgumentException("La variable tripId n'est pas utilisable (c'est une variable réservée) pour le report " + reportName);
|
|
| 335 | 333 |
}
|
| 336 | 334 |
ids.add(id);
|
| 337 | 335 |
String[] parts = operations.split("\\|");
|
| ... | ... | @@ -341,13 +339,8 @@ public class ReportBuilder { |
| 341 | 339 |
}
|
| 342 | 340 |
String typeStr = parts[0].trim();
|
| 343 | 341 |
String request = parts[1].trim();
|
| 344 |
- Class<?> type;
|
|
| 345 |
- try {
|
|
| 346 |
- type = Class.forName(typeStr);
|
|
| 347 |
- } catch (ClassNotFoundException eee) {
|
|
| 348 |
- throw new IllegalArgumentException("Le type " + typeStr + " n'est pas connu", eee);
|
|
| 349 |
- }
|
|
| 350 |
- ReportVariable variable = new ReportVariable(id, type, request);
|
|
| 342 |
+ Class<?> type = Objects2.forName(typeStr);
|
|
| 343 |
+ ReportVariable<?> variable = new ReportVariable<>(id, type, request);
|
|
| 351 | 344 |
log.debug(String.format("Detects a variable : [%s:%s] = %s (type = %s)", reportName, variable.getName(), variable.getRequest(), variable.getType().getName()));
|
| 352 | 345 |
result.add(variable);
|
| 353 | 346 |
itr.remove();
|
| ... | ... | @@ -386,12 +379,7 @@ public class ReportBuilder { |
| 386 | 379 |
}
|
| 387 | 380 |
String typeStr = parts[0].trim();
|
| 388 | 381 |
String request = parts[1].trim();
|
| 389 |
- Class<?> type = null;
|
|
| 390 |
- try {
|
|
| 391 |
- type = Class.forName(typeStr);
|
|
| 392 |
- } catch (ClassNotFoundException eee) {
|
|
| 393 |
- throw new IllegalArgumentException("Le type " + typeStr + " n'est pas connu", eee);
|
|
| 394 |
- }
|
|
| 382 |
+ Class<?> type = Objects2.forName(typeStr);
|
|
| 395 | 383 |
ReportVariable<?> variable = new ReportVariable<>(id, type, request);
|
| 396 | 384 |
log.debug(String.format("Detects a variable : [%s:%s] = %s (type = %s)", reportName, variable.getName(), variable.getRequest(), variable.getType().getName()));
|
| 397 | 385 |
result.add(variable);
|
| ... | ... | @@ -6,26 +6,27 @@ |
| 6 | 6 |
* %%
|
| 7 | 7 |
* This program is free software: you can redistribute it and/or modify
|
| 8 | 8 |
* it under the terms of the GNU General Public License as
|
| 9 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 9 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 10 | 10 |
* License, or (at your option) any later version.
|
| 11 |
- *
|
|
| 11 |
+ *
|
|
| 12 | 12 |
* This program is distributed in the hope that it will be useful,
|
| 13 | 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 | 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 | 15 |
* GNU General Public License for more details.
|
| 16 |
- *
|
|
| 17 |
- * You should have received a copy of the GNU General Public
|
|
| 16 |
+ *
|
|
| 17 |
+ * You should have received a copy of the GNU General Public
|
|
| 18 | 18 |
* License along with this program. If not, see
|
| 19 | 19 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 20 | 20 |
* #L%
|
| 21 | 21 |
*/
|
| 22 | 22 |
package fr.ird.observe.services.service.actions.report;
|
| 23 | 23 |
|
| 24 |
+import com.google.common.collect.ImmutableSet;
|
|
| 24 | 25 |
import com.google.common.collect.Maps;
|
| 25 | 26 |
import fr.ird.observe.dto.ObserveDto;
|
| 26 | 27 |
import org.apache.commons.lang3.builder.ToStringBuilder;
|
| 27 |
-import org.apache.logging.log4j.Logger;
|
|
| 28 | 28 |
import org.apache.logging.log4j.LogManager;
|
| 29 |
+import org.apache.logging.log4j.Logger;
|
|
| 29 | 30 |
|
| 30 | 31 |
import java.awt.Point;
|
| 31 | 32 |
import java.io.Serializable;
|
| ... | ... | @@ -41,61 +42,16 @@ import java.util.Map; |
| 41 | 42 |
*/
|
| 42 | 43 |
public class ReportRequest implements Serializable, ObserveDto {
|
| 43 | 44 |
|
| 45 |
+ public static final String TRIP_ID_VARIABLE = "tripId";
|
|
| 44 | 46 |
private static final long serialVersionUID = 1L;
|
| 45 |
- |
|
| 46 | 47 |
/** Logger. */
|
| 47 | 48 |
private static final Logger log = LogManager.getLogger(ReportRequest.class);
|
| 48 |
- |
|
| 49 |
- public static final String TRIP_ID_VARIABLE = "tripId";
|
|
| 50 |
- |
|
| 51 |
- /** le layout de la requete. */
|
|
| 52 |
- public enum RequestLayout {
|
|
| 53 |
- /** lorsque les résultats de la requète sont les lignes du résultat. */
|
|
| 54 |
- row,
|
|
| 55 |
- /** lorsque les résultats de la requète sont les colonnes du résultat. */
|
|
| 56 |
- column
|
|
| 57 |
- }
|
|
| 58 |
- |
|
| 59 |
- /** Un repeater optionnel sur la requête. */
|
|
| 60 |
- public static class RequestRepeat implements Serializable, ObserveDto {
|
|
| 61 |
- |
|
| 62 |
- protected final String variableName;
|
|
| 63 |
- |
|
| 64 |
- protected final RequestLayout layout;
|
|
| 65 |
- |
|
| 66 |
- private static final long serialVersionUID = 1L;
|
|
| 67 |
- |
|
| 68 |
- public RequestRepeat(String variableName, RequestLayout layout) {
|
|
| 69 |
- this.variableName = variableName;
|
|
| 70 |
- this.layout = layout;
|
|
| 71 |
- }
|
|
| 72 |
- |
|
| 73 |
- public String getVariableName() {
|
|
| 74 |
- return variableName;
|
|
| 75 |
- }
|
|
| 76 |
- |
|
| 77 |
- public RequestLayout getLayout() {
|
|
| 78 |
- return layout;
|
|
| 79 |
- }
|
|
| 80 |
- |
|
| 81 |
- @Override
|
|
| 82 |
- public String toString() {
|
|
| 83 |
- ToStringBuilder builder = new ToStringBuilder(this);
|
|
| 84 |
- builder.append("variableName", getVariableName());
|
|
| 85 |
- builder.append("layout", getLayout());
|
|
| 86 |
- return builder.toString();
|
|
| 87 |
- }
|
|
| 88 |
- }
|
|
| 89 |
- |
|
| 90 | 49 |
/** layout de la requète. */
|
| 91 | 50 |
protected final RequestLayout layout;
|
| 92 |
- |
|
| 93 | 51 |
/** la requète à exécuter. */
|
| 94 | 52 |
protected final String request;
|
| 95 |
- |
|
| 96 | 53 |
/** la position de la requète. */
|
| 97 | 54 |
protected final Point location;
|
| 98 |
- |
|
| 99 | 55 |
/** le repeater optionel. */
|
| 100 | 56 |
protected final RequestRepeat repeat;
|
| 101 | 57 |
|
| ... | ... | @@ -110,31 +66,7 @@ public class ReportRequest implements Serializable, ObserveDto { |
| 110 | 66 |
location = new Point(x, y);
|
| 111 | 67 |
}
|
| 112 | 68 |
|
| 113 |
- public RequestLayout getLayout() {
|
|
| 114 |
- return layout;
|
|
| 115 |
- }
|
|
| 116 |
- |
|
| 117 |
- public int getX() {
|
|
| 118 |
- return (int) location.getX();
|
|
| 119 |
- }
|
|
| 120 |
- |
|
| 121 |
- public int getY() {
|
|
| 122 |
- return (int) location.getY();
|
|
| 123 |
- }
|
|
| 124 |
- |
|
| 125 |
- public Point getLocation() {
|
|
| 126 |
- return location;
|
|
| 127 |
- }
|
|
| 128 |
- |
|
| 129 |
- public String getRequest() {
|
|
| 130 |
- return request;
|
|
| 131 |
- }
|
|
| 132 |
- |
|
| 133 |
- public RequestRepeat getRepeat() {
|
|
| 134 |
- return repeat;
|
|
| 135 |
- }
|
|
| 136 |
- |
|
| 137 |
- public static Map<String, Object> extractParams(Report report, String tripId) {
|
|
| 69 |
+ public static Map<String, Object> extractParams(Report report, ImmutableSet<String> tripId) {
|
|
| 138 | 70 |
|
| 139 | 71 |
Map<String, Object> params = Maps.newHashMap();
|
| 140 | 72 |
|
| ... | ... | @@ -175,6 +107,30 @@ public class ReportRequest implements Serializable, ObserveDto { |
| 175 | 107 |
return datas;
|
| 176 | 108 |
}
|
| 177 | 109 |
|
| 110 |
+ public RequestLayout getLayout() {
|
|
| 111 |
+ return layout;
|
|
| 112 |
+ }
|
|
| 113 |
+ |
|
| 114 |
+ public int getX() {
|
|
| 115 |
+ return (int) location.getX();
|
|
| 116 |
+ }
|
|
| 117 |
+ |
|
| 118 |
+ public int getY() {
|
|
| 119 |
+ return (int) location.getY();
|
|
| 120 |
+ }
|
|
| 121 |
+ |
|
| 122 |
+ public Point getLocation() {
|
|
| 123 |
+ return location;
|
|
| 124 |
+ }
|
|
| 125 |
+ |
|
| 126 |
+ public String getRequest() {
|
|
| 127 |
+ return request;
|
|
| 128 |
+ }
|
|
| 129 |
+ |
|
| 130 |
+ public RequestRepeat getRepeat() {
|
|
| 131 |
+ return repeat;
|
|
| 132 |
+ }
|
|
| 133 |
+ |
|
| 178 | 134 |
@Override
|
| 179 | 135 |
public String toString() {
|
| 180 | 136 |
ToStringBuilder builder = new ToStringBuilder(this);
|
| ... | ... | @@ -184,4 +140,41 @@ public class ReportRequest implements Serializable, ObserveDto { |
| 184 | 140 |
builder.append("repeatVariable", getRepeat());
|
| 185 | 141 |
return builder.toString();
|
| 186 | 142 |
}
|
| 143 |
+ |
|
| 144 |
+ /** le layout de la requete. */
|
|
| 145 |
+ public enum RequestLayout {
|
|
| 146 |
+ /** lorsque les résultats de la requète sont les lignes du résultat. */
|
|
| 147 |
+ row,
|
|
| 148 |
+ /** lorsque les résultats de la requète sont les colonnes du résultat. */
|
|
| 149 |
+ column
|
|
| 150 |
+ }
|
|
| 151 |
+ |
|
| 152 |
+ /** Un repeater optionnel sur la requête. */
|
|
| 153 |
+ public static class RequestRepeat implements Serializable, ObserveDto {
|
|
| 154 |
+ |
|
| 155 |
+ private static final long serialVersionUID = 1L;
|
|
| 156 |
+ protected final String variableName;
|
|
| 157 |
+ protected final RequestLayout layout;
|
|
| 158 |
+ |
|
| 159 |
+ public RequestRepeat(String variableName, RequestLayout layout) {
|
|
| 160 |
+ this.variableName = variableName;
|
|
| 161 |
+ this.layout = layout;
|
|
| 162 |
+ }
|
|
| 163 |
+ |
|
| 164 |
+ public String getVariableName() {
|
|
| 165 |
+ return variableName;
|
|
| 166 |
+ }
|
|
| 167 |
+ |
|
| 168 |
+ public RequestLayout getLayout() {
|
|
| 169 |
+ return layout;
|
|
| 170 |
+ }
|
|
| 171 |
+ |
|
| 172 |
+ @Override
|
|
| 173 |
+ public String toString() {
|
|
| 174 |
+ ToStringBuilder builder = new ToStringBuilder(this);
|
|
| 175 |
+ builder.append("variableName", getVariableName());
|
|
| 176 |
+ builder.append("layout", getLayout());
|
|
| 177 |
+ return builder.toString();
|
|
| 178 |
+ }
|
|
| 179 |
+ }
|
|
| 187 | 180 |
}
|
| ... | ... | @@ -22,6 +22,7 @@ package fr.ird.observe.services.service.actions.report; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 25 | 26 |
import fr.ird.observe.services.service.ObserveService;
|
| 26 | 27 |
import fr.ird.observe.services.spi.ReadDataPermission;
|
| 27 | 28 |
import fr.ird.observe.services.spi.ReadReferentialPermission;
|
| ... | ... | @@ -35,10 +36,10 @@ public interface ReportService extends ObserveService { |
| 35 | 36 |
@ReadDataPermission
|
| 36 | 37 |
@ReadReferentialPermission
|
| 37 | 38 |
@Post
|
| 38 |
- Report populateVariables(Report report, String tripId);
|
|
| 39 |
+ Report populateVariables(Report report, ImmutableSet<String> tripId);
|
|
| 39 | 40 |
|
| 40 | 41 |
@ReadDataPermission
|
| 41 | 42 |
@ReadReferentialPermission
|
| 42 | 43 |
@Post
|
| 43 |
- DataMatrix executeReport(Report report, String tripId);
|
|
| 44 |
+ DataMatrix executeReport(Report report, ImmutableSet<String> tripId);
|
|
| 44 | 45 |
}
|
| 1 |
+package fr.ird.observe.services.service.actions.validate;
|
|
| 2 |
+ |
|
| 3 |
+/*-
|
|
| 4 |
+ * #%L
|
|
| 5 |
+ * ObServe :: Services API
|
|
| 6 |
+ * %%
|
|
| 7 |
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
+ * %%
|
|
| 9 |
+ * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
+ * it under the terms of the GNU General Public License as
|
|
| 11 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
+ * License, or (at your option) any later version.
|
|
| 13 |
+ *
|
|
| 14 |
+ * This program is distributed in the hope that it will be useful,
|
|
| 15 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
+ * GNU General Public License for more details.
|
|
| 18 |
+ *
|
|
| 19 |
+ * You should have received a copy of the GNU General Public
|
|
| 20 |
+ * License along with this program. If not, see
|
|
| 21 |
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
+ * #L%
|
|
| 23 |
+ */
|
|
| 24 |
+ |
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 26 |
+import fr.ird.observe.dto.referential.ReferentialLocale;
|
|
| 27 |
+ |
|
| 28 |
+/**
|
|
| 29 |
+ * Created by tchemit on 06/08/17.
|
|
| 30 |
+ *
|
|
| 31 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 32 |
+ */
|
|
| 33 |
+public class DataValidationResult extends ValidationResult<DataValidationRequest> {
|
|
| 34 |
+ |
|
| 35 |
+ private final DataValidationRequest request;
|
|
| 36 |
+ |
|
| 37 |
+ private DataValidationResult(DataValidationRequest request, ImmutableSet<ValidationResultDto> data) {
|
|
| 38 |
+ super(data);
|
|
| 39 |
+ this.request = request;
|
|
| 40 |
+ }
|
|
| 41 |
+ |
|
| 42 |
+ @Override
|
|
| 43 |
+ public DataValidationRequest getRequest() {
|
|
| 44 |
+ return request;
|
|
| 45 |
+ }
|
|
| 46 |
+ |
|
| 47 |
+ public static Builder<DataValidationRequest, DataValidationResult> builder(ReferentialLocale referenceLocale, DataValidationRequest request) {
|
|
| 48 |
+ return new Builder<DataValidationRequest, DataValidationResult>(referenceLocale, request) {
|
|
| 49 |
+ |
|
| 50 |
+ @Override
|
|
| 51 |
+ protected DataValidationResult newResult(DataValidationRequest request, ImmutableSet<ValidationResultDto> result) {
|
|
| 52 |
+ return new DataValidationResult(request, result);
|
|
| 53 |
+ }
|
|
| 54 |
+ };
|
|
| 55 |
+ }
|
|
| 56 |
+ |
|
| 57 |
+}
|
| 1 |
+package fr.ird.observe.services.service.actions.validate;
|
|
| 2 |
+ |
|
| 3 |
+/*-
|
|
| 4 |
+ * #%L
|
|
| 5 |
+ * ObServe :: Services API
|
|
| 6 |
+ * %%
|
|
| 7 |
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
+ * %%
|
|
| 9 |
+ * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
+ * it under the terms of the GNU General Public License as
|
|
| 11 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
+ * License, or (at your option) any later version.
|
|
| 13 |
+ *
|
|
| 14 |
+ * This program is distributed in the hope that it will be useful,
|
|
| 15 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
+ * GNU General Public License for more details.
|
|
| 18 |
+ *
|
|
| 19 |
+ * You should have received a copy of the GNU General Public
|
|
| 20 |
+ * License along with this program. If not, see
|
|
| 21 |
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
+ * #L%
|
|
| 23 |
+ */
|
|
| 24 |
+ |
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 26 |
+import fr.ird.observe.dto.referential.ReferentialLocale;
|
|
| 27 |
+ |
|
| 28 |
+/**
|
|
| 29 |
+ * Created by tchemit on 06/08/17.
|
|
| 30 |
+ *
|
|
| 31 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 32 |
+ */
|
|
| 33 |
+public class ReferentialValidationResult extends ValidationResult<ReferentialValidationRequest> {
|
|
| 34 |
+ |
|
| 35 |
+ private final ReferentialValidationRequest request;
|
|
| 36 |
+ |
|
| 37 |
+ private ReferentialValidationResult(ReferentialValidationRequest request, ImmutableSet<ValidationResultDto> data) {
|
|
| 38 |
+ super(data);
|
|
| 39 |
+ this.request = request;
|
|
| 40 |
+ }
|
|
| 41 |
+ |
|
| 42 |
+ @Override
|
|
| 43 |
+ public ReferentialValidationRequest getRequest() {
|
|
| 44 |
+ return request;
|
|
| 45 |
+ }
|
|
| 46 |
+ |
|
| 47 |
+ public static Builder<ReferentialValidationRequest, ReferentialValidationResult> builder(ReferentialLocale referenceLocale, ReferentialValidationRequest request) {
|
|
| 48 |
+ return new Builder<ReferentialValidationRequest, ReferentialValidationResult>(referenceLocale, request) {
|
|
| 49 |
+ |
|
| 50 |
+ @Override
|
|
| 51 |
+ protected ReferentialValidationResult newResult(ReferentialValidationRequest request, ImmutableSet<ValidationResultDto> result) {
|
|
| 52 |
+ return new ReferentialValidationResult(request, result);
|
|
| 53 |
+ }
|
|
| 54 |
+ };
|
|
| 55 |
+ }
|
|
| 56 |
+ |
|
| 57 |
+}
|
| ... | ... | @@ -37,11 +37,11 @@ public interface ValidateService extends ObserveService { |
| 37 | 37 |
|
| 38 | 38 |
@ReadReferentialPermission
|
| 39 | 39 |
@Post
|
| 40 |
- ValidationResult<ReferentialValidationRequest> validateReferential(ReferentialValidationRequest request);
|
|
| 40 |
+ ReferentialValidationResult validateReferential(ReferentialValidationRequest request);
|
|
| 41 | 41 |
|
| 42 | 42 |
@ReadDataPermission
|
| 43 | 43 |
@ReadReferentialPermission
|
| 44 | 44 |
@Post
|
| 45 |
- ValidationResult<DataValidationRequest> validateData(DataValidationRequest request);
|
|
| 45 |
+ DataValidationResult validateData(DataValidationRequest request);
|
|
| 46 | 46 |
|
| 47 | 47 |
}
|
| ... | ... | @@ -10,12 +10,12 @@ package fr.ird.observe.services.service.actions.validate; |
| 10 | 10 |
* it under the terms of the GNU General Public License as
|
| 11 | 11 |
* published by the Free Software Foundation, either version 3 of the
|
| 12 | 12 |
* License, or (at your option) any later version.
|
| 13 |
- *
|
|
| 13 |
+ *
|
|
| 14 | 14 |
* This program is distributed in the hope that it will be useful,
|
| 15 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | 17 |
* GNU General Public License for more details.
|
| 18 |
- *
|
|
| 18 |
+ *
|
|
| 19 | 19 |
* You should have received a copy of the GNU General Public
|
| 20 | 20 |
* License along with this program. If not, see
|
| 21 | 21 |
* <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| ... | ... | @@ -28,8 +28,8 @@ import com.google.common.collect.Multimap; |
| 28 | 28 |
import fr.ird.observe.dto.ObserveDto;
|
| 29 | 29 |
import fr.ird.observe.dto.reference.DtoReference;
|
| 30 | 30 |
import fr.ird.observe.dto.referential.ReferentialLocale;
|
| 31 |
-import org.apache.logging.log4j.Logger;
|
|
| 32 | 31 |
import org.apache.logging.log4j.LogManager;
|
| 32 |
+import org.apache.logging.log4j.Logger;
|
|
| 33 | 33 |
import org.nuiton.validator.bean.simple.SimpleBeanValidatorEvent;
|
| 34 | 34 |
|
| 35 | 35 |
import java.util.ArrayList;
|
| ... | ... | @@ -47,23 +47,15 @@ import static org.nuiton.i18n.I18n.l; |
| 47 | 47 |
*
|
| 48 | 48 |
* @author Tony Chemit - dev@tchemit.fr
|
| 49 | 49 |
*/
|
| 50 |
-public class ValidationResult<R extends ValidationRequest> implements ObserveDto {
|
|
| 50 |
+public abstract class ValidationResult<R extends ValidationRequest> implements ObserveDto {
|
|
| 51 | 51 |
|
| 52 |
- private final R request;
|
|
| 53 | 52 |
private final ImmutableSet<ValidationResultDto> data;
|
| 54 | 53 |
|
| 55 |
- public static <R extends ValidationRequest> Builder<R> builder(ReferentialLocale referenceLocale, R request) {
|
|
| 56 |
- return new Builder<>(referenceLocale, request);
|
|
| 57 |
- }
|
|
| 58 |
- |
|
| 59 |
- private ValidationResult(R request, ImmutableSet<ValidationResultDto> data) {
|
|
| 60 |
- this.request = request;
|
|
| 54 |
+ ValidationResult(ImmutableSet<ValidationResultDto> data) {
|
|
| 61 | 55 |
this.data = data;
|
| 62 | 56 |
}
|
| 63 | 57 |
|
| 64 |
- public R getRequest() {
|
|
| 65 |
- return request;
|
|
| 66 |
- }
|
|
| 58 |
+ public abstract R getRequest();
|
|
| 67 | 59 |
|
| 68 | 60 |
public ImmutableSet<ValidationResultDto> getData() {
|
| 69 | 61 |
return data;
|
| ... | ... | @@ -91,7 +83,7 @@ public class ValidationResult<R extends ValidationRequest> implements ObserveDto |
| 91 | 83 |
*
|
| 92 | 84 |
* @author Tony Chemit - dev@tchemit.fr
|
| 93 | 85 |
*/
|
| 94 |
- public static class Builder<R extends ValidationRequest> {
|
|
| 86 |
+ public static abstract class Builder<R extends ValidationRequest, S extends ValidationResult<R>> {
|
|
| 95 | 87 |
|
| 96 | 88 |
/** Logger. */
|
| 97 | 89 |
private static final Logger log = LogManager.getLogger(Builder.class);
|
| ... | ... | @@ -100,7 +92,7 @@ public class ValidationResult<R extends ValidationRequest> implements ObserveDto |
| 100 | 92 |
private final R request;
|
| 101 | 93 |
private final ReferentialLocale referenceLocale;
|
| 102 | 94 |
|
| 103 |
- private Builder(ReferentialLocale referenceLocale, R request) {
|
|
| 95 |
+ Builder(ReferentialLocale referenceLocale, R request) {
|
|
| 104 | 96 |
this.referenceLocale = referenceLocale;
|
| 105 | 97 |
this.request = request;
|
| 106 | 98 |
data = HashMultimap.create();
|
| ... | ... | @@ -119,12 +111,14 @@ public class ValidationResult<R extends ValidationRequest> implements ObserveDto |
| 119 | 111 |
return this;
|
| 120 | 112 |
}
|
| 121 | 113 |
|
| 122 |
- public ValidationResult<R> build() {
|
|
| 114 |
+ protected abstract S newResult(R request, ImmutableSet<ValidationResultDto> result);
|
|
| 115 |
+ |
|
| 116 |
+ public S build() {
|
|
| 123 | 117 |
ImmutableSet.Builder<ValidationResultDto> result = ImmutableSet.builder();
|
| 124 | 118 |
for (Map.Entry<DtoReference, Collection<ValidationResultDtoMessage>> entry : data.asMap().entrySet()) {
|
| 125 | 119 |
result.add(new ValidationResultDto(entry.getKey(), ImmutableSet.copyOf(entry.getValue())));
|
| 126 | 120 |
}
|
| 127 |
- return new ValidationResult<>(request, result.build());
|
|
| 121 |
+ return newResult(request, result.build());
|
|
| 128 | 122 |
}
|
| 129 | 123 |
|
| 130 | 124 |
private String translateMessage(String message) {
|
| ... | ... | @@ -35,7 +35,7 @@ public class ValidationResultDto { |
| 35 | 35 |
private final DtoReference reference;
|
| 36 | 36 |
private final ImmutableSet<ValidationResultDtoMessage> messages;
|
| 37 | 37 |
|
| 38 |
- ValidationResultDto(DtoReference reference, ImmutableSet<ValidationResultDtoMessage> messages) {
|
|
| 38 |
+ public ValidationResultDto(DtoReference reference, ImmutableSet<ValidationResultDtoMessage> messages) {
|
|
| 39 | 39 |
this.reference = reference;
|
| 40 | 40 |
this.messages = messages;
|
| 41 | 41 |
}
|
| ... | ... | @@ -19,7 +19,6 @@ |
| 19 | 19 |
# <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 20 | 20 |
# #L%
|
| 21 | 21 |
###
|
| 22 |
- |
|
| 23 | 22 |
################################################################################
|
| 24 | 23 |
## Liste des \u00e9quipements (Seine)
|
| 25 | 24 |
################################################################################
|
| ... | ... | @@ -33,10 +32,9 @@ report.tripSeineGearUseFeatures.repeatVariable.gearUseFeaturesId=java.lang.Strin |
| 33 | 32 |
From TripSeineImpl m \
|
| 34 | 33 |
Join m.gearUseFeaturesSeine g \
|
| 35 | 34 |
Where \
|
| 36 |
- m.id = :tripId \
|
|
| 35 |
+ m.id In :tripId \
|
|
| 37 | 36 |
and g in elements (m.gearUseFeaturesSeine) \
|
| 38 | 37 |
Order By g.gear.label2
|
| 39 |
- |
|
| 40 | 38 |
report.tripSeineGearUseFeatures.request.1=0,0|row|\
|
| 41 | 39 |
Select \
|
| 42 | 40 |
concat(CASE When g.gear.code IS NULL Then 'Aucun code' Else g.gear.code End, ' - ', g.gear.label2), \
|
| ... | ... | @@ -44,9 +42,7 @@ report.tripSeineGearUseFeatures.request.1=0,0|row|\ |
| 44 | 42 |
( CASE g.usedInTrip When true Then 'Oui' Else Case g.usedInTrip When false Then 'Non' Else 'Ind\u00e9termin\u00e9' End End )\
|
| 45 | 43 |
From GearUseFeaturesSeineImpl g \
|
| 46 | 44 |
Where g.id = :gearUseFeaturesId
|
| 47 |
- |
|
| 48 | 45 |
report.tripSeineGearUseFeatures.request.1.repeat=gearUseFeaturesId|column
|
| 49 |
- |
|
| 50 | 46 |
################################################################################
|
| 51 | 47 |
## Liste des \u00e9quipements (Longline)
|
| 52 | 48 |
################################################################################
|
| ... | ... | @@ -60,10 +56,9 @@ report.tripLonglineGearUseFeatures.repeatVariable.gearUseFeaturesId=java.lang.St |
| 60 | 56 |
From TripLonglineImpl m \
|
| 61 | 57 |
Join m.gearUseFeaturesLongline g \
|
| 62 | 58 |
Where \
|
| 63 |
- m.id = :tripId \
|
|
| 59 |
+ m.id In :tripId \
|
|
| 64 | 60 |
and g in elements (m.gearUseFeaturesLongline) \
|
| 65 | 61 |
Order By g.gear.label2
|
| 66 |
- |
|
| 67 | 62 |
report.tripLonglineGearUseFeatures.request.1=0,0|row|\
|
| 68 | 63 |
Select \
|
| 69 | 64 |
concat(CASE When g.gear.code IS NULL Then 'Aucun code' Else g.gear.code End, ' - ', g.gear.label2), \
|
| ... | ... | @@ -71,9 +66,7 @@ report.tripLonglineGearUseFeatures.request.1=0,0|row|\ |
| 71 | 66 |
( CASE g.usedInTrip When true Then 'Oui' Else Case g.usedInTrip When false Then 'Non' Else 'Ind\u00e9termin\u00e9' End End )\
|
| 72 | 67 |
From GearUseFeaturesLonglineImpl g \
|
| 73 | 68 |
Where g.id = :gearUseFeaturesId
|
| 74 |
- |
|
| 75 | 69 |
report.tripLonglineGearUseFeatures.request.1.repeat=gearUseFeaturesId|column
|
| 76 |
- |
|
| 77 | 70 |
################################################################################
|
| 78 | 71 |
## Liste des activit\u00e9s avec des comments
|
| 79 | 72 |
################################################################################
|
| ... | ... | @@ -88,10 +81,9 @@ report.activityWithComment.request.1=0,0|row|\ |
| 88 | 81 |
Join r.activitySeine a \
|
| 89 | 82 |
Join a.vesselActivitySeine ab \
|
| 90 | 83 |
Where \
|
| 91 |
- m.id = :tripId \
|
|
| 84 |
+ m.id In :tripId \
|
|
| 92 | 85 |
and a.comment is not null \
|
| 93 | 86 |
Order By r.date, a.time
|
| 94 |
- |
|
| 95 | 87 |
################################################################################
|
| 96 | 88 |
## Liste de toutes les activit\u00e9s et leurs positions
|
| 97 | 89 |
################################################################################
|
| ... | ... | @@ -106,9 +98,8 @@ report.allActivitys.request.1=0,0|row|\ |
| 106 | 98 |
Join r.activitySeine a \
|
| 107 | 99 |
Join a.vesselActivitySeine ab \
|
| 108 | 100 |
Where \
|
| 109 |
- m.id = :tripId \
|
|
| 101 |
+ m.id In :tripId \
|
|
| 110 | 102 |
Order By r.date, a.time
|
| 111 |
- |
|
| 112 | 103 |
################################################################################
|
| 113 | 104 |
## Nombre de cal\u00e9es et captures journali\u00e8res d'une mar\u00e9e
|
| 114 | 105 |
################################################################################
|
| ... | ... | @@ -124,10 +115,9 @@ report.dailySetAndCatch.request.1=0,0|row|\ |
| 124 | 115 |
Join a.setSeine s \
|
| 125 | 116 |
left join s.targetCatch as ct \
|
| 126 | 117 |
Where \
|
| 127 |
- m.id = :tripId \
|
|
| 118 |
+ m.id In :tripId \
|
|
| 128 | 119 |
Group By r.date \
|
| 129 | 120 |
Order By r.date
|
| 130 |
- |
|
| 131 | 121 |
################################################################################
|
| 132 | 122 |
## Utilisation des DCP
|
| 133 | 123 |
################################################################################
|
| ... | ... | @@ -143,16 +133,14 @@ report.dcpUsage.repeatVariable.typeObjetId=java.lang.String|\ |
| 143 | 133 |
Join a.floatingObject dcp \
|
| 144 | 134 |
Join dcp.objectType to \
|
| 145 | 135 |
Where \
|
| 146 |
- m.id = :tripId \
|
|
| 136 |
+ m.id In :tripId \
|
|
| 147 | 137 |
Order by to.code
|
| 148 |
- |
|
| 149 | 138 |
report.dcpUsage.request.1=0,0|row|\
|
| 150 | 139 |
Select concat(str(to.code) , ' - ', to.label2) \
|
| 151 | 140 |
From ObjectTypeImpl to \
|
| 152 | 141 |
Where \
|
| 153 | 142 |
to.id = :typeObjetId
|
| 154 | 143 |
report.dcpUsage.request.1.repeat=typeObjetId|column
|
| 155 |
- |
|
| 156 | 144 |
report.dcpUsage.request.2=1,0|row|\
|
| 157 | 145 |
Select Count(dcp) \
|
| 158 | 146 |
From TripSeineImpl m \
|
| ... | ... | @@ -160,11 +148,10 @@ report.dcpUsage.request.2=1,0|row|\ |
| 160 | 148 |
Join r.activitySeine a \
|
| 161 | 149 |
Join a.floatingObject dcp \
|
| 162 | 150 |
Where \
|
| 163 |
- m.id = :tripId \
|
|
| 151 |
+ m.id In :tripId \
|
|
| 164 | 152 |
and dcp.objectType.id = :typeObjetId \
|
| 165 | 153 |
and dcp.objectOperation.id = 'fr.ird.observe.entities.referentiel.seine.ObjectOperation#1239832686249#0.8268884472438458'
|
| 166 | 154 |
report.dcpUsage.request.2.repeat=typeObjetId|column
|
| 167 |
- |
|
| 168 | 155 |
report.dcpUsage.request.3=2,0|row|\
|
| 169 | 156 |
Select Count(dcp) \
|
| 170 | 157 |
From TripSeineImpl m \
|
| ... | ... | @@ -172,11 +159,10 @@ report.dcpUsage.request.3=2,0|row|\ |
| 172 | 159 |
Join r.activitySeine a \
|
| 173 | 160 |
Join a.floatingObject dcp \
|
| 174 | 161 |
Where \
|
| 175 |
- m.id = :tripId \
|
|
| 162 |
+ m.id In :tripId \
|
|
| 176 | 163 |
and dcp.objectType.id = :typeObjetId \
|
| 177 | 164 |
and dcp.objectOperation.id = 'fr.ird.observe.entities.referentiel.seine.ObjectOperation#1239832686249#0.8431519556575698'
|
| 178 | 165 |
report.dcpUsage.request.3.repeat=typeObjetId|column
|
| 179 |
- |
|
| 180 | 166 |
report.dcpUsage.request.4=3,0|row|\
|
| 181 | 167 |
Select Count(dcp) \
|
| 182 | 168 |
From TripSeineImpl m \
|
| ... | ... | @@ -184,11 +170,10 @@ report.dcpUsage.request.4=3,0|row|\ |
| 184 | 170 |
Join r.activitySeine a \
|
| 185 | 171 |
Join a.floatingObject dcp \
|
| 186 | 172 |
Where \
|
| 187 |
- m.id = :tripId \
|
|
| 173 |
+ m.id In :tripId \
|
|
| 188 | 174 |
and dcp.objectType.id = :typeObjetId \
|
| 189 | 175 |
and dcp.objectOperation.id = 'fr.ird.observe.entities.referentiel.seine.ObjectOperation#1239832686248#0.8669327599318251'
|
| 190 | 176 |
report.dcpUsage.request.4.repeat=typeObjetId|column
|
| 191 |
- |
|
| 192 | 177 |
report.dcpUsage.request.5=4,0|row|\
|
| 193 | 178 |
Select Count(dcp) \
|
| 194 | 179 |
From TripSeineImpl m \
|
| ... | ... | @@ -196,12 +181,11 @@ report.dcpUsage.request.5=4,0|row|\ |
| 196 | 181 |
Join r.activitySeine a \
|
| 197 | 182 |
Join a.floatingObject dcp \
|
| 198 | 183 |
Where \
|
| 199 |
- m.id = :tripId \
|
|
| 184 |
+ m.id In :tripId \
|
|
| 200 | 185 |
and dcp.objectType.id = :typeObjetId \
|
| 201 | 186 |
and dcp.objectFate.id = 'fr.ird.observe.entities.referentiel.seine.ObjectFate#1396860761530#0.8869464242156488' \
|
| 202 | 187 |
and dcp.objectOperation.id != 'fr.ird.observe.entities.referentiel.seine.ObjectOperation#1239832686248#0.8669327599318251'
|
| 203 | 188 |
report.dcpUsage.request.5.repeat=typeObjetId|column
|
| 204 |
- |
|
| 205 | 189 |
report.dcpUsage.request.6=5,0|row|\
|
| 206 | 190 |
Select Count(dcp) \
|
| 207 | 191 |
From TripSeineImpl m \
|
| ... | ... | @@ -209,11 +193,10 @@ report.dcpUsage.request.6=5,0|row|\ |
| 209 | 193 |
Join r.activitySeine a \
|
| 210 | 194 |
Join a.floatingObject dcp \
|
| 211 | 195 |
Where \
|
| 212 |
- m.id = :tripId \
|
|
| 196 |
+ m.id In :tripId \
|
|
| 213 | 197 |
and dcp.objectType.id = :typeObjetId \
|
| 214 | 198 |
and dcp.objectOperation.id = 'fr.ird.observe.entities.referentiel.seine.ObjectOperation#1239832686249#0.7838704130950722'
|
| 215 | 199 |
report.dcpUsage.request.6.repeat=typeObjetId|column
|
| 216 |
- |
|
| 217 | 200 |
report.dcpUsage.request.7=6,0|row| \
|
| 218 | 201 |
Select Sum(efo.count) \
|
| 219 | 202 |
From TripSeineImpl m \
|
| ... | ... | @@ -222,11 +205,10 @@ report.dcpUsage.request.7=6,0|row| \ |
| 222 | 205 |
Join a.floatingObject dcp \
|
| 223 | 206 |
Join dcp.objectObservedSpecies efo \
|
| 224 | 207 |
Where \
|
| 225 |
- m.id = :tripId \
|
|
| 208 |
+ m.id In :tripId \
|
|
| 226 | 209 |
and dcp.objectType.id = :typeObjetId \
|
| 227 | 210 |
and efo.species.speciesGroup.id = 'fr.ird.observe.entities.referentiel.SpeciesGroup#1239832683690#0.24333033683679461'
|
| 228 | 211 |
report.dcpUsage.request.7.repeat=typeObjetId|column
|
| 229 |
- |
|
| 230 | 212 |
################################################################################
|
| 231 | 213 |
## Nombre des cal\u00e9es selon le type d'association
|
| 232 | 214 |
################################################################################
|
| ... | ... | @@ -244,12 +226,11 @@ report.setByAssociation.request.1=0,0|column|\ |
| 244 | 226 |
Join r.activitySeine a, \
|
| 245 | 227 |
ObservedSystemImpl os \
|
| 246 | 228 |
Where \
|
| 247 |
- m.id = :tripId \
|
|
| 229 |
+ m.id In :tripId \
|
|
| 248 | 230 |
and a.setSeine.schoolType = 2 \
|
| 249 | 231 |
and a.setSeine.reasonForNullSet is null \
|
| 250 | 232 |
and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \
|
| 251 | 233 |
and os not in elements(a.observedSystem)
|
| 252 |
- |
|
| 253 | 234 |
report.setByAssociation.request.2=0,1|column|\
|
| 254 | 235 |
Select Count(a) \
|
| 255 | 236 |
From TripSeineImpl m \
|
| ... | ... | @@ -257,12 +238,11 @@ report.setByAssociation.request.2=0,1|column|\ |
| 257 | 238 |
Join r.activitySeine a, \
|
| 258 | 239 |
ObservedSystemImpl os \
|
| 259 | 240 |
Where \
|
| 260 |
- m.id = :tripId \
|
|
| 241 |
+ m.id In :tripId \
|
|
| 261 | 242 |
and a.setSeine.schoolType = 2 \
|
| 262 | 243 |
and a.setSeine.reasonForNullSet is not null \
|
| 263 | 244 |
and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \
|
| 264 | 245 |
and os not in elements(a.observedSystem)
|
| 265 |
- |
|
| 266 | 246 |
report.setByAssociation.request.3=1,0|column|\
|
| 267 | 247 |
Select Count(a) \
|
| 268 | 248 |
From TripSeineImpl m \
|
| ... | ... | @@ -270,12 +250,11 @@ report.setByAssociation.request.3=1,0|column|\ |
| 270 | 250 |
Join r.activitySeine a, \
|
| 271 | 251 |
ObservedSystemImpl os \
|
| 272 | 252 |
Where \
|
| 273 |
- m.id = :tripId \
|
|
| 253 |
+ m.id In :tripId \
|
|
| 274 | 254 |
and a.setSeine.schoolType = 2 \
|
| 275 | 255 |
and a.setSeine.reasonForNullSet is null \
|
| 276 | 256 |
and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \
|
| 277 | 257 |
and os in elements(a.observedSystem)
|
| 278 |
- |
|
| 279 | 258 |
report.setByAssociation.request.4=1,1|column|\
|
| 280 | 259 |
Select Count(a) \
|
| 281 | 260 |
From TripSeineImpl m \
|
| ... | ... | @@ -283,12 +262,11 @@ report.setByAssociation.request.4=1,1|column|\ |
| 283 | 262 |
Join r.activitySeine a, \
|
| 284 | 263 |
ObservedSystemImpl os \
|
| 285 | 264 |
Where \
|
| 286 |
- m.id = :tripId \
|
|
| 265 |
+ m.id In :tripId \
|
|
| 287 | 266 |
and a.setSeine.schoolType = 2 \
|
| 288 | 267 |
and a.setSeine.reasonForNullSet is not null \
|
| 289 | 268 |
and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \
|
| 290 | 269 |
and os in elements(a.observedSystem)
|
| 291 |
- |
|
| 292 | 270 |
report.setByAssociation.request.5=2,0|column|\
|
| 293 | 271 |
Select Count(a) \
|
| 294 | 272 |
From TripSeineImpl m \
|
| ... | ... | @@ -296,12 +274,11 @@ report.setByAssociation.request.5=2,0|column|\ |
| 296 | 274 |
Join r.activitySeine a, \
|
| 297 | 275 |
ObservedSystemImpl os \
|
| 298 | 276 |
Where \
|
| 299 |
- m.id = :tripId \
|
|
| 277 |
+ m.id In :tripId \
|
|
| 300 | 278 |
and a.setSeine.schoolType = 1 \
|
| 301 | 279 |
and a.setSeine.reasonForNullSet is null \
|
| 302 | 280 |
and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \
|
| 303 | 281 |
and os in elements(a.observedSystem)
|
| 304 |
- |
|
| 305 | 282 |
report.setByAssociation.request.6=2,1|column|\
|
| 306 | 283 |
Select Count(a) \
|
| 307 | 284 |
From TripSeineImpl m \
|
| ... | ... | @@ -309,12 +286,11 @@ report.setByAssociation.request.6=2,1|column|\ |
| 309 | 286 |
Join r.activitySeine a, \
|
| 310 | 287 |
ObservedSystemImpl os \
|
| 311 | 288 |
Where \
|
| 312 |
- m.id = :tripId \
|
|
| 289 |
+ m.id In :tripId \
|
|
| 313 | 290 |
and a.setSeine.schoolType = 1 \
|
| 314 | 291 |
and a.setSeine.reasonForNullSet is not null \
|
| 315 | 292 |
and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \
|
| 316 | 293 |
and os in elements(a.observedSystem)
|
| 317 |
- |
|
| 318 | 294 |
report.setByAssociation.request.7=3,0|column|\
|
| 319 | 295 |
Select Count(a) \
|
| 320 | 296 |
From TripSeineImpl m \
|
| ... | ... | @@ -322,12 +298,11 @@ report.setByAssociation.request.7=3,0|column|\ |
| 322 | 298 |
Join r.activitySeine a, \
|
| 323 | 299 |
ObservedSystemImpl os \
|
| 324 | 300 |
Where \
|
| 325 |
- m.id = :tripId \
|
|
| 301 |
+ m.id In :tripId \
|
|
| 326 | 302 |
and a.setSeine.schoolType = 1 \
|
| 327 | 303 |
and a.setSeine.reasonForNullSet is null \
|
| 328 | 304 |
and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \
|
| 329 | 305 |
and os not in elements(a.observedSystem)
|
| 330 |
- |
|
| 331 | 306 |
report.setByAssociation.request.8=3,1|column|\
|
| 332 | 307 |
Select Count(a) \
|
| 333 | 308 |
From TripSeineImpl m \
|
| ... | ... | @@ -335,12 +310,11 @@ report.setByAssociation.request.8=3,1|column|\ |
| 335 | 310 |
Join r.activitySeine a, \
|
| 336 | 311 |
ObservedSystemImpl os \
|
| 337 | 312 |
Where \
|
| 338 |
- m.id = :tripId \
|
|
| 313 |
+ m.id In :tripId \
|
|
| 339 | 314 |
and a.setSeine.schoolType = 1 \
|
| 340 | 315 |
and a.setSeine.reasonForNullSet is not null \
|
| 341 | 316 |
and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \
|
| 342 | 317 |
and os not in elements(a.observedSystem)
|
| 343 |
- |
|
| 344 | 318 |
################################################################################
|
| 345 | 319 |
## Captures thon par type d'association
|
| 346 | 320 |
################################################################################
|
| ... | ... | @@ -351,7 +325,6 @@ report.targetCatchByAssociation.columns=YFT, SKJ, BET, LTA, FRI, Autres, Total |
| 351 | 325 |
report.targetCatchByAssociation.rows=BL sans baleine, BL avec baleine, BO avec requin-baleine, BO sans requin-baleine, Total
|
| 352 | 326 |
report.targetCatchByAssociation.operations.1=SumRow
|
| 353 | 327 |
report.targetCatchByAssociation.operations.2=SumColumn
|
| 354 |
- |
|
| 355 | 328 |
# ligne 1
|
| 356 | 329 |
report.targetCatchByAssociation.request.1=0,0|row|\
|
| 357 | 330 |
Select \
|
| ... | ... | @@ -380,10 +353,9 @@ report.targetCatchByAssociation.request.1=0,0|row|\ |
| 380 | 353 |
with ct.discarded = false, \
|
| 381 | 354 |
ObservedSystemImpl os \
|
| 382 | 355 |
Where \
|
| 383 |
- m.id = :tripId \
|
|
| 356 |
+ m.id In :tripId \
|
|
| 384 | 357 |
and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \
|
| 385 | 358 |
and os not in elements(a.observedSystem)
|
| 386 |
- |
|
| 387 | 359 |
# ligne 2
|
| 388 | 360 |
report.targetCatchByAssociation.request.7=0,1|row|\
|
| 389 | 361 |
Select \
|
| ... | ... | @@ -412,10 +384,9 @@ report.targetCatchByAssociation.request.7=0,1|row|\ |
| 412 | 384 |
with ct.discarded = false, \
|
| 413 | 385 |
ObservedSystemImpl os \
|
| 414 | 386 |
Where \
|
| 415 |
- m.id = :tripId \
|
|
| 387 |
+ m.id In :tripId \
|
|
| 416 | 388 |
and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \
|
| 417 | 389 |
and os in elements(a.observedSystem)
|
| 418 |
- |
|
| 419 | 390 |
# ligne 3
|
| 420 | 391 |
report.targetCatchByAssociation.request.13=0,2|row|\
|
| 421 | 392 |
Select \
|
| ... | ... | @@ -444,10 +415,9 @@ report.targetCatchByAssociation.request.13=0,2|row|\ |
| 444 | 415 |
with ct.discarded = false, \
|
| 445 | 416 |
ObservedSystemImpl os \
|
| 446 | 417 |
Where \
|
| 447 |
- m.id = :tripId \
|
|
| 418 |
+ m.id In :tripId \
|
|
| 448 | 419 |
and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \
|
| 449 | 420 |
and os in elements(a.observedSystem)
|
| 450 |
- |
|
| 451 | 421 |
# ligne 4
|
| 452 | 422 |
report.targetCatchByAssociation.request.19=0,3|row|\
|
| 453 | 423 |
Select \
|
| ... | ... | @@ -476,10 +446,9 @@ report.targetCatchByAssociation.request.19=0,3|row|\ |
| 476 | 446 |
with ct.discarded = false, \
|
| 477 | 447 |
ObservedSystemImpl os \
|
| 478 | 448 |
Where \
|
| 479 |
- m.id = :tripId \
|
|
| 449 |
+ m.id In :tripId \
|
|
| 480 | 450 |
and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \
|
| 481 | 451 |
and os not in elements(a.observedSystem)
|
| 482 |
- |
|
| 483 | 452 |
################################################################################
|
| 484 | 453 |
## Rejets thons selon le type d'association
|
| 485 | 454 |
################################################################################
|
| ... | ... | @@ -490,7 +459,6 @@ report.targetDiscardedByAssociation.columns=YFT, SKJ, BET, LTA, FRI, Autres, Tot |
| 490 | 459 |
report.targetDiscardedByAssociation.rows=BL sans baleine, BL avec baleine, BO avec requin-baleine, BO sans requin-baleine, Total
|
| 491 | 460 |
report.targetDiscardedByAssociation.operations.1=SumRow
|
| 492 | 461 |
report.targetDiscardedByAssociation.operations.2=SumColumn
|
| 493 |
- |
|
| 494 | 462 |
# ligne 1
|
| 495 | 463 |
report.targetDiscardedByAssociation.request.1=0,0|row|\
|
| 496 | 464 |
Select \
|
| ... | ... | @@ -519,10 +487,9 @@ report.targetDiscardedByAssociation.request.1=0,0|row|\ |
| 519 | 487 |
with ct.discarded = true, \
|
| 520 | 488 |
ObservedSystemImpl os \
|
| 521 | 489 |
Where \
|
| 522 |
- m.id = :tripId \
|
|
| 490 |
+ m.id In :tripId \
|
|
| 523 | 491 |
and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \
|
| 524 | 492 |
and os not in elements(a.observedSystem)
|
| 525 |
- |
|
| 526 | 493 |
# ligne 2
|
| 527 | 494 |
report.targetDiscardedByAssociation.request.7=0,1|row|\
|
| 528 | 495 |
Select \
|
| ... | ... | @@ -551,10 +518,9 @@ report.targetDiscardedByAssociation.request.7=0,1|row|\ |
| 551 | 518 |
with ct.discarded = true, \
|
| 552 | 519 |
ObservedSystemImpl os \
|
| 553 | 520 |
Where \
|
| 554 |
- m.id = :tripId \
|
|
| 521 |
+ m.id In :tripId \
|
|
| 555 | 522 |
and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9395222812356602' \
|
| 556 | 523 |
and os in elements(a.observedSystem)
|
| 557 |
- |
|
| 558 | 524 |
# ligne 3
|
| 559 | 525 |
report.targetDiscardedByAssociation.request.13=0,2|row|\
|
| 560 | 526 |
Select \
|
| ... | ... | @@ -583,10 +549,9 @@ report.targetDiscardedByAssociation.request.13=0,2|row|\ |
| 583 | 549 |
with ct.discarded = true, \
|
| 584 | 550 |
ObservedSystemImpl os \
|
| 585 | 551 |
Where \
|
| 586 |
- m.id = :tripId \
|
|
| 552 |
+ m.id In :tripId \
|
|
| 587 | 553 |
and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \
|
| 588 | 554 |
and os in elements(a.observedSystem)
|
| 589 |
- |
|
| 590 | 555 |
# ligne 4
|
| 591 | 556 |
report.targetDiscardedByAssociation.request.19=0,3|row|\
|
| 592 | 557 |
Select \
|
| ... | ... | @@ -615,10 +580,9 @@ report.targetDiscardedByAssociation.request.19=0,3|row|\ |
| 615 | 580 |
with ct.discarded = true, \
|
| 616 | 581 |
ObservedSystemImpl os \
|
| 617 | 582 |
Where \
|
| 618 |
- m.id = :tripId \
|
|
| 583 |
+ m.id In :tripId \
|
|
| 619 | 584 |
and os.topiaId = 'fr.ird.observe.entities.referentiel.seine.ObservedSystem#1239832686428#0.9217864901728908' \
|
| 620 | 585 |
and os not in elements(a.observedSystem)
|
| 621 |
- |
|
| 622 | 586 |
################################################################################
|
| 623 | 587 |
## Captures accessoires observ\u00e9es
|
| 624 | 588 |
################################################################################
|
| ... | ... | @@ -631,7 +595,6 @@ report.accessoryCatch.repeatVariable.speciesId=java.lang.String|\ |
| 631 | 595 |
Select e.id From SpeciesImpl e \
|
| 632 | 596 |
Where e.speciesGroup.id = :speciesGroup \
|
| 633 | 597 |
Order By e.homeId
|
| 634 |
- |
|
| 635 | 598 |
report.accessoryCatch.request.1=0,0|row|\
|
| 636 | 599 |
Select \
|
| 637 | 600 |
concat('[FAO]', (case when e.faoCode is not null then e.faoCode else '-' end), \
|
| ... | ... | @@ -640,7 +603,6 @@ report.accessoryCatch.request.1=0,0|row|\ |
| 640 | 603 |
From SpeciesImpl e \
|
| 641 | 604 |
Where e.id = :speciesId
|
| 642 | 605 |
report.accessoryCatch.request.1.repeat=speciesId|column
|
| 643 |
- |
|
| 644 | 606 |
report.accessoryCatch.request.2=1,0|row|\
|
| 645 | 607 |
Select \
|
| 646 | 608 |
case when Count(ca) > 0 then \
|
| ... | ... | @@ -655,9 +617,8 @@ report.accessoryCatch.request.2=1,0|row|\ |
| 655 | 617 |
with c.schoolType = 2 \
|
| 656 | 618 |
Join c.nonTargetCatch ca \
|
| 657 | 619 |
with ca.species.id = :speciesId \
|
| 658 |
- Where m.id = :tripId
|
|
| 620 |
+ Where m.id In :tripId
|
|
| 659 | 621 |
report.accessoryCatch.request.2.repeat=speciesId|column
|
| 660 |
- |
|
| 661 | 622 |
report.accessoryCatch.request.3=2,0|row|\
|
| 662 | 623 |
Select \
|
| 663 | 624 |
case when Count(ca) > 0 then \
|
| ... | ... | @@ -672,9 +633,8 @@ report.accessoryCatch.request.3=2,0|row|\ |
| 672 | 633 |
with c.schoolType = 1 \
|
| 673 | 634 |
Join c.nonTargetCatch ca \
|
| 674 | 635 |
with ca.species.id = :speciesId \
|
| 675 |
- Where m.id = :tripId
|
|
| 636 |
+ Where m.id In :tripId
|
|
| 676 | 637 |
report.accessoryCatch.request.3.repeat=speciesId|column
|
| 677 |
- |
|
| 678 | 638 |
################################################################################
|
| 679 | 639 |
## Captures accessoires par speciesGroup d'esp\u00e8ces
|
| 680 | 640 |
################################################################################
|
| ... | ... | @@ -683,7 +643,6 @@ report.accessoryCatchByGroup.name=D\u00e9nombrement des captures accessoires et |
| 683 | 643 |
report.accessoryCatchByGroup.description=Afficher les nombres de captures accessoires par groupe d'esp\u00e8ce selon le type de banc et le devenir
|
| 684 | 644 |
report.accessoryCatchByGroup.columns=Esp\u00e8ce, Total BL, Total BO, Sorti vivant/\u00e9chapp\u00e9, Sorti mort, Rejet\u00e9 vivant, Rejet\u00e9 mort, Partiellement conserv\u00e9, Cuve, Cuisine, Autre
|
| 685 | 645 |
report.accessoryCatchByGroup.variable.speciesGroup=fr.ird.observe.dto.referential.SpeciesGroupDto|From SpeciesGroupImpl ge Order By ge.code
|
| 686 |
- |
|
| 687 | 646 |
report.accessoryCatchByGroup.request.1=0,0|row|\
|
| 688 | 647 |
Select \
|
| 689 | 648 |
concat(\
|
| ... | ... | @@ -723,10 +682,9 @@ report.accessoryCatchByGroup.request.1=0,0|row|\ |
| 723 | 682 |
Join c.nonTargetCatch ca \
|
| 724 | 683 |
Join ca.species e \
|
| 725 | 684 |
with e.speciesGroup.id = :speciesGroup \
|
| 726 |
- Where m.id = :tripId \
|
|
| 685 |
+ Where m.id In :tripId \
|
|
| 727 | 686 |
Group by e \
|
| 728 | 687 |
Order By e.homeId
|
| 729 |
- |
|
| 730 | 688 |
###########################################################
|
| 731 | 689 |
## Distribution des tailles par espèces non ciblées
|
| 732 | 690 |
###########################################################
|
| ... | ... | @@ -742,7 +700,7 @@ Join t.route r \ |
| 742 | 700 |
Join r.activitySeine a \
|
| 743 | 701 |
Join a.setSeine.nonTargetSample nts \
|
| 744 | 702 |
Join nts.nonTargetLength ntl \
|
| 745 |
-Where t.id = :tripId
|
|
| 703 |
+Where t.id In :tripId
|
|
| 746 | 704 |
report.nonTargetDistributionLengths.request.1=0,0|row| \
|
| 747 | 705 |
Select ntl.length, sum(ntl.count) \
|
| 748 | 706 |
From TripSeineImpl t \
|
| ... | ... | @@ -750,11 +708,10 @@ Join t.route r \ |
| 750 | 708 |
Join r.activitySeine a \
|
| 751 | 709 |
Join a.setSeine.nonTargetSample nts \
|
| 752 | 710 |
Join nts.nonTargetLength ntl \
|
| 753 |
-Where t.id = :tripId \
|
|
| 711 |
+Where t.id In :tripId \
|
|
| 754 | 712 |
And ntl.species.id = :speciesId \
|
| 755 | 713 |
Group By ntl.length \
|
| 756 | 714 |
Order By ntl.length
|
| 757 |
- |
|
| 758 | 715 |
####################################################################
|
| 759 | 716 |
## Distribution des tailles des conservés par espèces ciblées (LD1)
|
| 760 | 717 |
####################################################################
|
| ... | ... | @@ -770,7 +727,7 @@ Join t.route r \ |
| 770 | 727 |
Join r.activitySeine a \
|
| 771 | 728 |
Join a.setSeine.targetSample ts \
|
| 772 | 729 |
Join ts.targetLength tl \
|
| 773 |
-Where t.id = :tripId \
|
|
| 730 |
+Where t.id In :tripId \
|
|
| 774 | 731 |
And tl.sizeMeasureType = 1 \
|
| 775 | 732 |
And ts.discarded = false
|
| 776 | 733 |
report.targetStoredDistributionLengthsLD1.request.1=0,0|row| \
|
| ... | ... | @@ -780,13 +737,12 @@ Join t.route r \ |
| 780 | 737 |
Join r.activitySeine a \
|
| 781 | 738 |
Join a.setSeine.targetSample ts \
|
| 782 | 739 |
Join ts.targetLength tl \
|
| 783 |
-Where t.id = :tripId \
|
|
| 740 |
+Where t.id In :tripId \
|
|
| 784 | 741 |
And tl.species.id = :speciesId \
|
| 785 | 742 |
And tl.sizeMeasureType = 1 \
|
| 786 | 743 |
And ts.discarded = false \
|
| 787 | 744 |
Group By tl.length \
|
| 788 | 745 |
Order By tl.length
|
| 789 |
- |
|
| 790 | 746 |
################################################################
|
| 791 | 747 |
## Distribution des tailles des rejets par espèces ciblées (LD1)
|
| 792 | 748 |
################################################################
|
| ... | ... | @@ -802,7 +758,7 @@ Join t.route r \ |
| 802 | 758 |
Join r.activitySeine a \
|
| 803 | 759 |
Join a.setSeine.targetSample ts \
|
| 804 | 760 |
Join ts.targetLength tl \
|
| 805 |
-Where t.id = :tripId \
|
|
| 761 |
+Where t.id In :tripId \
|
|
| 806 | 762 |
And tl.sizeMeasureType = 1 \
|
| 807 | 763 |
And ts.discarded = true
|
| 808 | 764 |
report.targetDiscardedDistributionLengthsLD1.request.1=0,0|row| \
|
| ... | ... | @@ -812,13 +768,12 @@ Join t.route r \ |
| 812 | 768 |
Join r.activitySeine a \
|
| 813 | 769 |
Join a.setSeine.targetSample ts \
|
| 814 | 770 |
Join ts.targetLength tl \
|
| 815 |
-Where t.id = :tripId \
|
|
| 771 |
+Where t.id In :tripId \
|
|
| 816 | 772 |
And tl.species.id = :speciesId \
|
| 817 | 773 |
And tl.sizeMeasureType = 1\
|
| 818 | 774 |
And ts.discarded = true \
|
| 819 | 775 |
Group By tl.length \
|
| 820 | 776 |
Order By tl.length
|
| 821 |
- |
|
| 822 | 777 |
###############################################################
|
| 823 | 778 |
## Distribution des tailles des conservés par espèces ciblées (LF)
|
| 824 | 779 |
###############################################################
|
| ... | ... | @@ -834,7 +789,7 @@ Join t.route r \ |
| 834 | 789 |
Join r.activitySeine a \
|
| 835 | 790 |
Join a.setSeine.targetSample ts \
|
| 836 | 791 |
Join ts.targetLength tl \
|
| 837 |
-Where t.id = :tripId \
|
|
| 792 |
+Where t.id In :tripId \
|
|
| 838 | 793 |
And tl.sizeMeasureType = 2 \
|
| 839 | 794 |
And ts.discarded = false
|
| 840 | 795 |
report.targetStoredDistributionLengthsLF.request.1=0,0|row| \
|
| ... | ... | @@ -844,13 +799,12 @@ Join t.route r \ |
| 844 | 799 |
Join r.activitySeine a \
|
| 845 | 800 |
Join a.setSeine.targetSample ts \
|
| 846 | 801 |
Join ts.targetLength tl \
|
| 847 |
-Where t.id = :tripId \
|
|
| 802 |
+Where t.id In :tripId \
|
|
| 848 | 803 |
And tl.species.id = :speciesId \
|
| 849 | 804 |
And tl.sizeMeasureType = 2 \
|
| 850 | 805 |
And ts.discarded = false \
|
| 851 | 806 |
Group By tl.length \
|
| 852 | 807 |
Order By tl.length
|
| 853 |
- |
|
| 854 | 808 |
###############################################################
|
| 855 | 809 |
## Distribution des tailles des rejets par espèces ciblées (LF)
|
| 856 | 810 |
###############################################################
|
| ... | ... | @@ -866,7 +820,7 @@ Join t.route r \ |
| 866 | 820 |
Join r.activitySeine a \
|
| 867 | 821 |
Join a.setSeine.targetSample ts \
|
| 868 | 822 |
Join ts.targetLength tl \
|
| 869 |
-Where t.id = :tripId \
|
|
| 823 |
+Where t.id In :tripId \
|
|
| 870 | 824 |
And tl.sizeMeasureType = 2 \
|
| 871 | 825 |
And ts.discarded = true
|
| 872 | 826 |
report.targetDiscardedDistributionLengthsLF.request.1=0,0|row| \
|
| ... | ... | @@ -876,13 +830,12 @@ Join t.route r \ |
| 876 | 830 |
Join r.activitySeine a \
|
| 877 | 831 |
Join a.setSeine.targetSample ts \
|
| 878 | 832 |
Join ts.targetLength tl \
|
| 879 |
-Where t.id = :tripId \
|
|
| 833 |
+Where t.id In :tripId \
|
|
| 880 | 834 |
And tl.species.id = :speciesId \
|
| 881 | 835 |
And tl.sizeMeasureType = 2 \
|
| 882 | 836 |
And ts.discarded = true \
|
| 883 | 837 |
Group By tl.length \
|
| 884 | 838 |
Order By tl.length
|
| 885 |
- |
|
| 886 | 839 |
############################################
|
| 887 | 840 |
## Répartition des calées par cuves
|
| 888 | 841 |
############################################
|
| ... | ... | @@ -902,6 +855,6 @@ From TripSeineImpl t \ |
| 902 | 855 |
Join t.route r \
|
| 903 | 856 |
Join r.activitySeine a \
|
| 904 | 857 |
Join a.setSeine.targetCatch tc \
|
| 905 |
-Where t.id = :tripId \
|
|
| 858 |
+Where t.id In :tripId \
|
|
| 906 | 859 |
Group By r.date, a.time, a.latitude, a.longitude, tc.weightCategory.species, tc.weightCategory.species.faoCode, tc.well, a.setSeine.schoolType \
|
| 907 | 860 |
Order By r.date, a.time, tc.weightCategory.species, tc.well
|