Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
58a53683
by Tony CHEMIT at 2017-08-04T23:48:18+02:00
23 changed files:
- client/src/main/java/fr/ird/observe/client/ui/admin/consolidate/ConsolidateUIHandler.java
- server/src/main/filtered-resources/mapping
- services-topia/src/main/java/fr/ird/observe/services/binder/data/seine/FloatingObjectPartBinder.java
- services-topia/src/main/java/fr/ird/observe/services/binder/referential/seine/ObjectMaterialBinder.java
- services-topia/src/main/java/fr/ird/observe/services/topia/service/actions/consolidate/ConsolidateActivitySeineDataResultBuilder.java
- services-topia/src/main/java/fr/ird/observe/services/topia/service/actions/consolidate/ConsolidateDataServiceTopia.java
- services-topia/src/main/java/fr/ird/observe/services/topia/service/actions/consolidate/ConsolidationActivitySeineDataContext.java
- services-topia/src/test/java/fr/ird/observe/services/topia/service/actions/consolidate/SimplifiedObjectTypeManagerTest.java → services-topia/src/test/java/fr/ird/observe/services/topia/service/actions/consolidate/dcp/SimplifiedObjectTypeManagerTest.java
- services/src/main/java/fr/ird/observe/services/ObserveDtoInitializer.java
- services/src/main/java/fr/ird/observe/services/dto/reference/AbstractReference.java
- services/src/main/java/fr/ird/observe/services/service/actions/consolidate/ConsolidateDataService.java
- services/src/main/java/fr/ird/observe/services/service/actions/consolidate/ConsolidateTripSeineDataResult.java
- + services/src/main/java/fr/ird/observe/services/service/actions/consolidate/dcp/ConsolidateFloatingObjectRequest.java
- persistence/src/main/java/fr/ird/observe/entities/referentiel/seine/ObjectMaterialTopiaDao.java → services/src/main/java/fr/ird/observe/services/service/actions/consolidate/dcp/ConsolidateFloatingObjectResult.java
- + services/src/main/java/fr/ird/observe/services/service/actions/consolidate/dcp/ConsolidateFloatingObjectResultBuilder.java
- + services/src/main/java/fr/ird/observe/services/service/actions/consolidate/dcp/FloatingObjectConsolidateEngine.java
- + services/src/main/java/fr/ird/observe/services/service/actions/consolidate/dcp/FloatingObjectModification.java
- services-topia/src/main/java/fr/ird/observe/services/topia/service/actions/consolidate/SimplifiedObjectTypeManager.java → services/src/main/java/fr/ird/observe/services/service/actions/consolidate/dcp/SimplifiedObjectTypeManager.java
- persistence/src/main/java/fr/ird/observe/entities/referentiel/seine/SimplifiedObjectTypeNode.java → services/src/main/java/fr/ird/observe/services/service/actions/consolidate/dcp/SimplifiedObjectTypeNode.java
- services/src/main/java/fr/ird/observe/services/service/actions/consolidate/ConsolidateActivitySeineDataResult.java → services/src/main/java/fr/ird/observe/services/service/actions/consolidate/set/ConsolidateActivitySeineDataResult.java
- + services/src/main/java/fr/ird/observe/services/service/actions/consolidate/set/NonTargetCatchModification.java
- + services/src/main/java/fr/ird/observe/services/service/actions/consolidate/set/NonTargetLengthModification.java
- + services/src/main/java/fr/ird/observe/services/service/actions/consolidate/set/TargetLengthModification.java
Changes:
| ... | ... | @@ -28,7 +28,7 @@ import fr.ird.observe.client.ui.ObserveKeyStrokes; |
| 28 | 28 |
import fr.ird.observe.client.ui.admin.AdminTabUIHandler;
|
| 29 | 29 |
import fr.ird.observe.client.ui.util.ProgressModel;
|
| 30 | 30 |
import fr.ird.observe.services.dto.reference.DataReference;
|
| 31 |
-import fr.ird.observe.services.service.actions.consolidate.ConsolidateActivitySeineDataResult;
|
|
| 31 |
+import fr.ird.observe.services.service.actions.consolidate.set.ConsolidateActivitySeineDataResult;
|
|
| 32 | 32 |
import fr.ird.observe.services.service.actions.consolidate.ConsolidateDataService;
|
| 33 | 33 |
import fr.ird.observe.services.service.actions.consolidate.ConsolidateTripSeineDataRequest;
|
| 34 | 34 |
import fr.ird.observe.services.service.actions.consolidate.ConsolidateTripSeineDataResult;
|
| ... | ... | @@ -68,6 +68,7 @@ POST /api/v1/LastUpdateDateService/updateReferentialLastUpdateDates |
| 68 | 68 |
GET /api/v1/PingService/getModelVersion v1.PingServiceRestApi.getModelVersion
|
| 69 | 69 |
GET /api/v1/PingService/getServerVersion v1.PingServiceRestApi.getServerVersion
|
| 70 | 70 |
POST /api/v1/actions/consolidate/ConsolidateDataService/consolidateTripSeine v1.actions.consolidate.ConsolidateDataServiceRestApi.consolidateTripSeine
|
| 71 |
+GET /api/v1/actions/consolidate/ConsolidateDataService/newSimplifiedObjectTypeManager v1.actions.consolidate.ConsolidateDataServiceRestApi.newSimplifiedObjectTypeManager
|
|
| 71 | 72 |
POST /api/v1/actions/report/ReportService/executeReport v1.actions.report.ReportServiceRestApi.executeReport
|
| 72 | 73 |
POST /api/v1/actions/report/ReportService/populateVariables v1.actions.report.ReportServiceRestApi.populateVariables
|
| 73 | 74 |
GET /api/v1/actions/synchro/referential/diff/ReferentialSynchronizeDiffService/getEnabledReferentialReferenceSet v1.actions.synchro.referential.diff.ReferentialSynchronizeDiffServiceRestApi.getEnabledReferentialReferenceSet
|
| ... | ... | @@ -57,8 +57,8 @@ public class FloatingObjectPartBinder extends DataBinderSupport<FloatingObjectPa |
| 57 | 57 |
|
| 58 | 58 |
copyEntityDataFieldsToDto(entity, dto);
|
| 59 | 59 |
|
| 60 |
- dto.setWhenArriving(dto.getWhenArriving());
|
|
| 61 |
- dto.setWhenLeaving(dto.getWhenLeaving());
|
|
| 60 |
+ dto.setWhenArriving(entity.getWhenArriving());
|
|
| 61 |
+ dto.setWhenLeaving(entity.getWhenLeaving());
|
|
| 62 | 62 |
dto.setObjectMaterial(toReferentialReference(referentialLocale, entity.getObjectMaterial(), ObjectMaterialDto.class));
|
| 63 | 63 |
|
| 64 | 64 |
}
|
| ... | ... | @@ -84,7 +84,9 @@ public class ObjectMaterialBinder extends ReferentialBinderSupport<ObjectMateria |
| 84 | 84 |
entity.getCode(), getLabel(referentialLocale, entity),
|
| 85 | 85 |
Optional.ofNullable(entity.getParent()).map(ObjectMaterial::getTopiaId).orElse(null),
|
| 86 | 86 |
Optional.ofNullable(entity.getObjectMaterialType()).map(I18nReferentialEntity::getTopiaId).orElse(null),
|
| 87 |
- entity.getValidation());
|
|
| 87 |
+ entity.getValidation(),
|
|
| 88 |
+ entity.isBiodegradable(),
|
|
| 89 |
+ entity.isNonEntangling());
|
|
| 88 | 90 |
|
| 89 | 91 |
}
|
| 90 | 92 |
|
| ... | ... | @@ -97,7 +99,9 @@ public class ObjectMaterialBinder extends ReferentialBinderSupport<ObjectMateria |
| 97 | 99 |
dto.getCode(), getLabel(referentialLocale, dto),
|
| 98 | 100 |
Optional.ofNullable(dto.getParent()).map(r -> r.getPropertyValue(ObjectMaterialDto.PROPERTY_PARENT)).orElse(null),
|
| 99 | 101 |
Optional.ofNullable(dto.getObjectMaterialType()).map(ReferentialReference::getId).orElse(null),
|
| 100 |
- dto.getValidation());
|
|
| 102 |
+ dto.getValidation(),
|
|
| 103 |
+ dto.isBiodegradable(),
|
|
| 104 |
+ dto.isNonEntangling());
|
|
| 101 | 105 |
|
| 102 | 106 |
}
|
| 103 | 107 |
}
|
| ... | ... | @@ -29,15 +29,16 @@ import fr.ird.observe.entities.referentiel.Ocean; |
| 29 | 29 |
import fr.ird.observe.entities.referentiel.Sex;
|
| 30 | 30 |
import fr.ird.observe.entities.referentiel.Species;
|
| 31 | 31 |
import fr.ird.observe.entities.referentiel.Species2;
|
| 32 |
-import fr.ird.observe.entities.seine.ActivitySeine;
|
|
| 33 |
-import fr.ird.observe.entities.seine.ActivitySeines;
|
|
| 34 |
-import fr.ird.observe.entities.seine.FloatingObject;
|
|
| 35 | 32 |
import fr.ird.observe.entities.seine.NonTargetCatch;
|
| 36 | 33 |
import fr.ird.observe.entities.seine.NonTargetLength;
|
| 37 | 34 |
import fr.ird.observe.entities.seine.TargetLength;
|
| 38 | 35 |
import fr.ird.observe.services.dto.constants.ReferentialLocale;
|
| 39 |
-import fr.ird.observe.services.service.actions.consolidate.ConsolidateActivitySeineDataResult;
|
|
| 40 |
-import fr.ird.observe.services.service.actions.consolidate.ConsolidateActivitySeineDataResult.DcpModification;
|
|
| 36 |
+import fr.ird.observe.services.service.actions.consolidate.dcp.ConsolidateFloatingObjectResult;
|
|
| 37 |
+import fr.ird.observe.services.service.actions.consolidate.dcp.FloatingObjectModification;
|
|
| 38 |
+import fr.ird.observe.services.service.actions.consolidate.set.ConsolidateActivitySeineDataResult;
|
|
| 39 |
+import fr.ird.observe.services.service.actions.consolidate.set.NonTargetCatchModification;
|
|
| 40 |
+import fr.ird.observe.services.service.actions.consolidate.set.NonTargetLengthModification;
|
|
| 41 |
+import fr.ird.observe.services.service.actions.consolidate.set.TargetLengthModification;
|
|
| 41 | 42 |
import java.util.Date;
|
| 42 | 43 |
import java.util.Locale;
|
| 43 | 44 |
import java.util.Optional;
|
| ... | ... | @@ -45,9 +46,6 @@ import org.apache.commons.logging.Log; |
| 45 | 46 |
import org.apache.commons.logging.LogFactory;
|
| 46 | 47 |
|
| 47 | 48 |
|
| 48 |
-import static fr.ird.observe.services.service.actions.consolidate.ConsolidateActivitySeineDataResult.NonTargetCatchModification;
|
|
| 49 |
-import static fr.ird.observe.services.service.actions.consolidate.ConsolidateActivitySeineDataResult.NonTargetLengthModification;
|
|
| 50 |
-import static fr.ird.observe.services.service.actions.consolidate.ConsolidateActivitySeineDataResult.TargetLengthModification;
|
|
| 51 | 49 |
import static org.nuiton.i18n.I18n.l;
|
| 52 | 50 |
|
| 53 | 51 |
/**
|
| ... | ... | @@ -63,96 +61,26 @@ public class ConsolidateActivitySeineDataResultBuilder { |
| 63 | 61 |
private static final Log log = LogFactory.getLog(ConsolidateActivitySeineDataResultBuilder.class);
|
| 64 | 62 |
private final ReferentialLocale referenceLocale;
|
| 65 | 63 |
protected final Locale locale;
|
| 66 |
- protected final ActivitySeine activitySeine;
|
|
| 67 | 64 |
private final ImmutableSet.Builder<String> lengthWeightParameterNotFoundBuilder = new ImmutableSet.Builder<>();
|
| 68 | 65 |
private final ImmutableSet.Builder<TargetLengthModification> targetLengthModificationBuilder = new ImmutableSet.Builder<>();
|
| 69 | 66 |
private final ImmutableSet.Builder<NonTargetLengthModification> nonTargetLengthModificationBuilder = new ImmutableSet.Builder<>();
|
| 70 | 67 |
private final ImmutableSet.Builder<NonTargetCatchModification> nonTargetCatchModificationBuilder = new ImmutableSet.Builder<>();
|
| 71 |
- private final ImmutableSet.Builder<DcpModification> dcpModificationBuilder = new ImmutableSet.Builder<>();
|
|
| 68 |
+ private final ImmutableSet.Builder<FloatingObjectModification> dcpModificationBuilder = new ImmutableSet.Builder<>();
|
|
| 72 | 69 |
private SchoolType oldSchoolType;
|
| 73 | 70 |
private SchoolType newSchoolType;
|
| 71 |
+ private final String activitySeineLabel;
|
|
| 72 |
+ private final String activitySeineId;
|
|
| 74 | 73 |
|
| 75 |
- private ConsolidateActivitySeineDataResultBuilder(Locale locale, ReferentialLocale referenceLocale, ActivitySeine activitySeine) {
|
|
| 74 |
+ public ConsolidateActivitySeineDataResultBuilder(Locale locale, ReferentialLocale referenceLocale, String activitySeineId, String activitySeineLabel) {
|
|
| 76 | 75 |
this.locale = locale;
|
| 77 | 76 |
this.referenceLocale = referenceLocale;
|
| 78 |
- this.activitySeine = activitySeine;
|
|
| 77 |
+ this.activitySeineId = activitySeineId;
|
|
| 78 |
+ this.activitySeineLabel = activitySeineLabel;
|
|
| 79 | 79 |
}
|
| 80 | 80 |
|
| 81 |
- public static ConsolidateActivitySeineDataResultBuilder create(Locale locale, ReferentialLocale referenceLocale, ActivitySeine activitySeine) {
|
|
| 82 |
- return new ConsolidateActivitySeineDataResultBuilder(locale, referenceLocale, activitySeine);
|
|
| 83 |
- }
|
|
| 84 |
- |
|
| 85 |
- void flushDcpModification(FloatingObject dcp, String... propertyNamesModified) {
|
|
| 86 |
- |
|
| 87 |
- String dcpLabel = activitySeine.getVesselActivitySeine().getLabel2() + "[" + activitySeine.getTime() + "]" + " - " + (dcp.getObjectOperation() == null ? "" : dcp.getObjectOperation().getLabel2());
|
|
| 88 |
- for (String modifiedProperty : propertyNamesModified) {
|
|
| 89 |
- switch (modifiedProperty) {
|
|
| 90 |
- case FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_BIODEGRADABLE: {
|
|
| 91 |
- |
|
| 92 |
- DcpModification element = new DcpModification();
|
|
| 93 |
- element.setDcpId(dcp.getTopiaId());
|
|
| 94 |
- element.setDcpLabel(dcpLabel);
|
|
| 95 |
- element.setPropertyName(FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_BIODEGRADABLE);
|
|
| 96 |
- element.setNewValue(dcp.getComputedWhenArrivingBiodegradable());
|
|
| 97 |
- dcpModificationBuilder.add(element);
|
|
| 98 |
- |
|
| 99 |
- break;
|
|
| 100 |
- }
|
|
| 101 |
- case FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_NON_ENTANGLING: {
|
|
| 102 |
- |
|
| 103 |
- DcpModification element = new DcpModification();
|
|
| 104 |
- element.setDcpId(dcp.getTopiaId());
|
|
| 105 |
- element.setDcpLabel(dcpLabel);
|
|
| 106 |
- element.setPropertyName(FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_NON_ENTANGLING);
|
|
| 107 |
- element.setNewValue(dcp.getComputedWhenArrivingNonEntangling());
|
|
| 108 |
- dcpModificationBuilder.add(element);
|
|
| 109 |
- |
|
| 110 |
- break;
|
|
| 111 |
- }
|
|
| 112 |
- case FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_SIMPLIFIED_OBJECT_TYPE: {
|
|
| 113 |
- |
|
| 114 |
- DcpModification element = new DcpModification();
|
|
| 115 |
- element.setDcpId(dcp.getTopiaId());
|
|
| 116 |
- element.setDcpLabel(dcpLabel);
|
|
| 117 |
- element.setPropertyName(FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_SIMPLIFIED_OBJECT_TYPE);
|
|
| 118 |
- element.setNewValue(dcp.getComputedWhenArrivingSimplifiedObjectType());
|
|
| 119 |
- dcpModificationBuilder.add(element);
|
|
| 120 |
- break;
|
|
| 121 |
- }
|
|
| 122 |
- case FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_BIODEGRADABLE: {
|
|
| 123 |
- |
|
| 124 |
- DcpModification element = new DcpModification();
|
|
| 125 |
- element.setDcpId(dcp.getTopiaId());
|
|
| 126 |
- element.setDcpLabel(dcpLabel);
|
|
| 127 |
- element.setPropertyName(FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_BIODEGRADABLE);
|
|
| 128 |
- element.setNewValue(dcp.getComputedWhenLeavingBiodegradable());
|
|
| 129 |
- dcpModificationBuilder.add(element);
|
|
| 130 |
- |
|
| 131 |
- break;
|
|
| 132 |
- }
|
|
| 133 |
- case FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_NON_ENTANGLING: {
|
|
| 134 |
- |
|
| 135 |
- DcpModification element = new DcpModification();
|
|
| 136 |
- element.setDcpId(dcp.getTopiaId());
|
|
| 137 |
- element.setDcpLabel(dcpLabel);
|
|
| 138 |
- element.setPropertyName(FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_NON_ENTANGLING);
|
|
| 139 |
- element.setNewValue(dcp.getComputedWhenLeavingNonEntangling());
|
|
| 140 |
- dcpModificationBuilder.add(element);
|
|
| 81 |
+ void flushDcpModification(ConsolidateFloatingObjectResult result) {
|
|
| 141 | 82 |
|
| 142 |
- break;
|
|
| 143 |
- }
|
|
| 144 |
- case FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_SIMPLIFIED_OBJECT_TYPE: {
|
|
| 145 |
- |
|
| 146 |
- DcpModification element = new DcpModification();
|
|
| 147 |
- element.setDcpId(dcp.getTopiaId());
|
|
| 148 |
- element.setDcpLabel(dcpLabel);
|
|
| 149 |
- element.setPropertyName(FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_SIMPLIFIED_OBJECT_TYPE);
|
|
| 150 |
- element.setNewValue(dcp.getComputedWhenLeavingSimplifiedObjectType());
|
|
| 151 |
- dcpModificationBuilder.add(element);
|
|
| 152 |
- break;
|
|
| 153 |
- }
|
|
| 154 |
- }
|
|
| 155 |
- }
|
|
| 83 |
+ dcpModificationBuilder.addAll(result.getFloatingObjectModifications());
|
|
| 156 | 84 |
|
| 157 | 85 |
}
|
| 158 | 86 |
|
| ... | ... | @@ -294,12 +222,12 @@ public class ConsolidateActivitySeineDataResultBuilder { |
| 294 | 222 |
ImmutableSet<TargetLengthModification> targetLengthModifications = targetLengthModificationBuilder.build();
|
| 295 | 223 |
ImmutableSet<NonTargetLengthModification> nonTargetLengthModifications = nonTargetLengthModificationBuilder.build();
|
| 296 | 224 |
ImmutableSet<NonTargetCatchModification> nonTargetCatchModifications = nonTargetCatchModificationBuilder.build();
|
| 297 |
- ImmutableSet<DcpModification> dcpModifications = dcpModificationBuilder.build();
|
|
| 225 |
+ ImmutableSet<FloatingObjectModification> floatingObjectModifications = dcpModificationBuilder.build();
|
|
| 298 | 226 |
|
| 299 | 227 |
boolean noModification = (targetLengthModifications.isEmpty()
|
| 300 | 228 |
&& nonTargetLengthModifications.isEmpty()
|
| 301 | 229 |
&& nonTargetCatchModifications.isEmpty()
|
| 302 |
- && dcpModifications.isEmpty()
|
|
| 230 |
+ && floatingObjectModifications.isEmpty()
|
|
| 303 | 231 |
&& newSchoolType == null);
|
| 304 | 232 |
|
| 305 | 233 |
ConsolidateActivitySeineDataResult consolidateActivitySeineDataResult;
|
| ... | ... | @@ -310,8 +238,8 @@ public class ConsolidateActivitySeineDataResultBuilder { |
| 310 | 238 |
} else {
|
| 311 | 239 |
|
| 312 | 240 |
consolidateActivitySeineDataResult = new ConsolidateActivitySeineDataResult();
|
| 313 |
- consolidateActivitySeineDataResult.setActivitySeineId(activitySeine.getTopiaId());
|
|
| 314 |
- consolidateActivitySeineDataResult.setActivitySeineLabel(ActivitySeines.decorate(referenceLocale.ordinal(), activitySeine));
|
|
| 241 |
+ consolidateActivitySeineDataResult.setActivitySeineId(activitySeineId);
|
|
| 242 |
+ consolidateActivitySeineDataResult.setActivitySeineLabel(activitySeineLabel);
|
|
| 315 | 243 |
|
| 316 | 244 |
if (newSchoolType != null) {
|
| 317 | 245 |
consolidateActivitySeineDataResult.setSchoolTypeChanged(oldSchoolType, newSchoolType);
|
| ... | ... | @@ -319,7 +247,7 @@ public class ConsolidateActivitySeineDataResultBuilder { |
| 319 | 247 |
consolidateActivitySeineDataResult.setTargetLengthModifications(targetLengthModifications);
|
| 320 | 248 |
consolidateActivitySeineDataResult.setNonTargetLengthModifications(nonTargetLengthModifications);
|
| 321 | 249 |
consolidateActivitySeineDataResult.setNonTargetCatchModifications(nonTargetCatchModifications);
|
| 322 |
- consolidateActivitySeineDataResult.setDcpModifications(dcpModifications);
|
|
| 250 |
+ consolidateActivitySeineDataResult.setFloatingObjectModifications(floatingObjectModifications);
|
|
| 323 | 251 |
|
| 324 | 252 |
}
|
| 325 | 253 |
|
| ... | ... | @@ -24,7 +24,6 @@ package fr.ird.observe.services.topia.service.actions.consolidate; |
| 24 | 24 |
|
| 25 | 25 |
import com.google.common.collect.ImmutableMap;
|
| 26 | 26 |
import com.google.common.collect.ImmutableSet;
|
| 27 |
-import fr.ird.observe.common.constants.seine.DcpComputedValue;
|
|
| 28 | 27 |
import fr.ird.observe.common.constants.seine.NonTargetCatchComputedValueSource;
|
| 29 | 28 |
import fr.ird.observe.common.constants.seine.SchoolType;
|
| 30 | 29 |
import fr.ird.observe.entities.LengthWeightComputable;
|
| ... | ... | @@ -34,8 +33,9 @@ import fr.ird.observe.entities.referentiel.LengthWeightParameter; |
| 34 | 33 |
import fr.ird.observe.entities.referentiel.Sex;
|
| 35 | 34 |
import fr.ird.observe.entities.referentiel.SizeMeasureType;
|
| 36 | 35 |
import fr.ird.observe.entities.referentiel.Species;
|
| 37 |
-import fr.ird.observe.entities.referentiel.seine.SimplifiedObjectTypeNode;
|
|
| 36 |
+import fr.ird.observe.entities.referentiel.seine.ObjectMaterial;
|
|
| 38 | 37 |
import fr.ird.observe.entities.seine.ActivitySeine;
|
| 38 |
+import fr.ird.observe.entities.seine.ActivitySeines;
|
|
| 39 | 39 |
import fr.ird.observe.entities.seine.FloatingObject;
|
| 40 | 40 |
import fr.ird.observe.entities.seine.FloatingObjectPart;
|
| 41 | 41 |
import fr.ird.observe.entities.seine.NonTargetCatch;
|
| ... | ... | @@ -50,17 +50,29 @@ import fr.ird.observe.entities.seine.TargetSample; |
| 50 | 50 |
import fr.ird.observe.entities.seine.TripSeine;
|
| 51 | 51 |
import fr.ird.observe.entities.seine.TripSeines;
|
| 52 | 52 |
import fr.ird.observe.persistence.ObserveTopiaPersistenceContext;
|
| 53 |
+import fr.ird.observe.services.binder.data.DataBinderSupport;
|
|
| 53 | 54 |
import fr.ird.observe.services.dto.constants.ReferentialLocale;
|
| 55 |
+import fr.ird.observe.services.dto.seine.FloatingObjectDto;
|
|
| 56 |
+import fr.ird.observe.services.dto.seine.FloatingObjectPartDto;
|
|
| 54 | 57 |
import fr.ird.observe.services.dto.seine.TripSeineDto;
|
| 55 |
-import fr.ird.observe.services.service.actions.consolidate.ConsolidateActivitySeineDataResult;
|
|
| 56 | 58 |
import fr.ird.observe.services.service.actions.consolidate.ConsolidateDataService;
|
| 57 | 59 |
import fr.ird.observe.services.service.actions.consolidate.ConsolidateTripSeineDataRequest;
|
| 58 | 60 |
import fr.ird.observe.services.service.actions.consolidate.ConsolidateTripSeineDataResult;
|
| 61 |
+import fr.ird.observe.services.service.actions.consolidate.dcp.ConsolidateFloatingObjectRequest;
|
|
| 62 |
+import fr.ird.observe.services.service.actions.consolidate.dcp.ConsolidateFloatingObjectResult;
|
|
| 63 |
+import fr.ird.observe.services.service.actions.consolidate.dcp.FloatingObjectConsolidateEngine;
|
|
| 64 |
+import fr.ird.observe.services.service.actions.consolidate.dcp.SimplifiedObjectTypeManager;
|
|
| 65 |
+import fr.ird.observe.services.service.actions.consolidate.dcp.SimplifiedObjectTypeNode;
|
|
| 66 |
+import fr.ird.observe.services.service.actions.consolidate.set.ConsolidateActivitySeineDataResult;
|
|
| 59 | 67 |
import fr.ird.observe.services.topia.service.ObserveServiceTopia;
|
| 60 | 68 |
import java.util.Collection;
|
| 69 |
+import java.util.LinkedHashSet;
|
|
| 70 |
+import java.util.List;
|
|
| 61 | 71 |
import java.util.Locale;
|
| 72 |
+import java.util.Objects;
|
|
| 62 | 73 |
import java.util.Optional;
|
| 63 | 74 |
import java.util.Set;
|
| 75 |
+import java.util.TreeMap;
|
|
| 64 | 76 |
import java.util.stream.Collectors;
|
| 65 | 77 |
import org.apache.commons.collections4.CollectionUtils;
|
| 66 | 78 |
import org.apache.commons.logging.Log;
|
| ... | ... | @@ -85,6 +97,13 @@ public class ConsolidateDataServiceTopia extends ObserveServiceTopia implements |
| 85 | 97 |
return consolidateTripSeineDataResult.orElse(null);
|
| 86 | 98 |
}
|
| 87 | 99 |
|
| 100 |
+ @Override
|
|
| 101 |
+ public SimplifiedObjectTypeManager newSimplifiedObjectTypeManager() {
|
|
| 102 |
+ ObserveTopiaPersistenceContext persistenceContext = getTopiaPersistenceContext();
|
|
| 103 |
+ ImmutableMap<String, SimplifiedObjectTypeNode> materialMapping = create(persistenceContext.getObjectMaterialDao().findAll());
|
|
| 104 |
+ return new SimplifiedObjectTypeManager(materialMapping);
|
|
| 105 |
+ }
|
|
| 106 |
+ |
|
| 88 | 107 |
private Optional<ConsolidateTripSeineDataResult> consolidateTripSeine(ReferentialLocale referenceLocale, String tripSeineId, boolean failIfLenghtWeightParameterNotFound) {
|
| 89 | 108 |
|
| 90 | 109 |
TripSeine tripSeine = loadEntity(TripSeineDto.class, tripSeineId);
|
| ... | ... | @@ -112,24 +131,19 @@ public class ConsolidateDataServiceTopia extends ObserveServiceTopia implements |
| 112 | 131 |
NonTargetCatch.PROPERTY_TOTAL_COUNT_COMPUTED_SOURCE
|
| 113 | 132 |
);
|
| 114 | 133 |
|
| 115 |
- BeanMonitor dcpMonitor = new BeanMonitor(
|
|
| 116 |
- FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_BIODEGRADABLE,
|
|
| 117 |
- FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_NON_ENTANGLING,
|
|
| 118 |
- FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_SIMPLIFIED_OBJECT_TYPE,
|
|
| 119 |
- FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_BIODEGRADABLE,
|
|
| 120 |
- FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_NON_ENTANGLING,
|
|
| 121 |
- FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_SIMPLIFIED_OBJECT_TYPE
|
|
| 122 |
- );
|
|
| 123 |
- |
|
| 124 | 134 |
Locale applicationLocale = serviceContext.getApplicationLocale();
|
| 125 | 135 |
|
| 126 | 136 |
ObserveTopiaPersistenceContext persistenceContext = getTopiaPersistenceContext();
|
| 127 | 137 |
|
| 128 |
- ImmutableMap<String, SimplifiedObjectTypeNode> materialMapping = persistenceContext.getObjectMaterialDao().createMaterialMapping();
|
|
| 129 |
- SimplifiedObjectTypeManager simplifiedObjectTypeManager = new SimplifiedObjectTypeManager(materialMapping);
|
|
| 138 |
+ SimplifiedObjectTypeManager simplifiedObjectTypeManager = newSimplifiedObjectTypeManager();
|
|
| 139 |
+ |
|
| 140 |
+ FloatingObjectConsolidateEngine floatingObjectConsolidateEngine = new FloatingObjectConsolidateEngine(simplifiedObjectTypeManager);
|
|
| 130 | 141 |
|
| 131 | 142 |
ImmutableSet.Builder<ConsolidateActivitySeineDataResult> activitiesResultBuilder = new ImmutableSet.Builder<>();
|
| 132 | 143 |
|
| 144 |
+ DataBinderSupport<FloatingObject, FloatingObjectDto> floatingObjectBinder = getDataBinder(FloatingObjectDto.class);
|
|
| 145 |
+ DataBinderSupport<FloatingObjectPart, FloatingObjectPartDto> floatingObjectPartBinder = getDataBinder(FloatingObjectPartDto.class);
|
|
| 146 |
+ |
|
| 133 | 147 |
for (Route route : tripSeine.getRoute()) {
|
| 134 | 148 |
|
| 135 | 149 |
for (ActivitySeine activitySeine : route.getActivitySeine()) {
|
| ... | ... | @@ -141,7 +155,8 @@ public class ConsolidateDataServiceTopia extends ObserveServiceTopia implements |
| 141 | 155 |
continue;
|
| 142 | 156 |
}
|
| 143 | 157 |
|
| 144 |
- ConsolidateActivitySeineDataResultBuilder resultBuilder = ConsolidateActivitySeineDataResultBuilder.create(applicationLocale, referenceLocale, activitySeine);
|
|
| 158 |
+ |
|
| 159 |
+ ConsolidateActivitySeineDataResultBuilder resultBuilder = new ConsolidateActivitySeineDataResultBuilder(applicationLocale, referenceLocale, activitySeine.getTopiaId(), ActivitySeines.decorate(referenceLocale.ordinal(), activitySeine));
|
|
| 145 | 160 |
|
| 146 | 161 |
ConsolidationActivitySeineDataContext activityContext = new ConsolidationActivitySeineDataContext();
|
| 147 | 162 |
activityContext.locale = applicationLocale;
|
| ... | ... | @@ -154,8 +169,9 @@ public class ConsolidateDataServiceTopia extends ObserveServiceTopia implements |
| 154 | 169 |
activityContext.targetLengthMonitor = targetLengthMonitor;
|
| 155 | 170 |
activityContext.nonTargetLengthMonitor = nonTargetSampleMonitor;
|
| 156 | 171 |
activityContext.nonTargetCatchMonitor = nonTargetCatchMonitor;
|
| 157 |
- activityContext.dcpMonitor = dcpMonitor;
|
|
| 158 |
- activityContext.simplifiedObjectTypeManager = simplifiedObjectTypeManager;
|
|
| 172 |
+ activityContext.floatingObjectConsolidateEngine = floatingObjectConsolidateEngine;
|
|
| 173 |
+ activityContext.floatingObjectBinder = floatingObjectBinder;
|
|
| 174 |
+ activityContext.floatingObjectPartBinder = floatingObjectPartBinder;
|
|
| 159 | 175 |
|
| 160 | 176 |
consolidateActivitySeine(activityContext);
|
| 161 | 177 |
|
| ... | ... | @@ -285,73 +301,20 @@ public class ConsolidateDataServiceTopia extends ObserveServiceTopia implements |
| 285 | 301 |
}
|
| 286 | 302 |
|
| 287 | 303 |
private void updateDcp(FloatingObject dcp, ConsolidationActivitySeineDataContext activityContext) {
|
| 288 |
- activityContext.watchDcp(dcp);
|
|
| 289 |
- |
|
| 290 |
- Set<FloatingObjectPart> whenArriving = dcp.getFloatingObjectPart().stream().filter(p -> p.getWhenArriving() != null).collect(Collectors.toSet());
|
|
| 291 |
- Set<FloatingObjectPart> whenLeaving = dcp.getFloatingObjectPart().stream().filter(p -> p.getWhenLeaving() != null).collect(Collectors.toSet());
|
|
| 292 |
- computeDcpBiodegradable(dcp, whenArriving, whenLeaving);
|
|
| 293 |
- computeDcpNonEntangling(dcp, whenArriving, whenLeaving);
|
|
| 294 |
- computeDcpSimplifiedObjectType(dcp, whenArriving, whenLeaving, activityContext.simplifiedObjectTypeManager);
|
|
| 295 | 304 |
|
| 296 |
- activityContext.flushDcp();
|
|
| 305 |
+ FloatingObjectConsolidateEngine floatingObjectConsolidateEngine = activityContext.floatingObjectConsolidateEngine;
|
|
| 297 | 306 |
|
| 298 |
- }
|
|
| 307 |
+ ReferentialLocale referentialLocale = getReferentialLocale();
|
|
| 308 |
+ DataBinderSupport<FloatingObjectPart, FloatingObjectPartDto> floatingObjectPartBinder = activityContext.floatingObjectPartBinder;
|
|
| 299 | 309 |
|
| 300 |
- private void computeDcpSimplifiedObjectType(FloatingObject dcp, Set<FloatingObjectPart> whenArriving, Set<FloatingObjectPart> whenLeaving, SimplifiedObjectTypeManager simplifiedObjectTypeManager) {
|
|
| 301 |
- String whenArrivingValue = computeDcpSimplifiedObjectType0(whenArriving, simplifiedObjectTypeManager);
|
|
| 302 |
- dcp.setComputedWhenArrivingSimplifiedObjectType(whenArrivingValue);
|
|
| 310 |
+ FloatingObjectDto floatingObjectDto = activityContext.floatingObjectBinder.toData(referentialLocale, dcp);
|
|
| 303 | 311 |
|
| 304 |
- String whenLeavingValue = computeDcpSimplifiedObjectType0(whenLeaving, simplifiedObjectTypeManager);
|
|
| 305 |
- dcp.setComputedWhenLeavingSimplifiedObjectType(whenLeavingValue);
|
|
| 306 |
- }
|
|
| 312 |
+ ImmutableSet<FloatingObjectPartDto> floatingObjectPartDtos = ImmutableSet.copyOf(dcp.getFloatingObjectPart().stream().map(p -> floatingObjectPartBinder.toData(referentialLocale, p)).collect(Collectors.toSet()));
|
|
| 313 |
+ ConsolidateFloatingObjectRequest request = new ConsolidateFloatingObjectRequest(floatingObjectDto, floatingObjectPartDtos);
|
|
| 314 |
+ Optional<ConsolidateFloatingObjectResult> result = floatingObjectConsolidateEngine.consolidate(request);
|
|
| 307 | 315 |
|
| 308 |
- private void computeDcpNonEntangling(FloatingObject dcp, Set<FloatingObjectPart> whenArriving, Set<FloatingObjectPart> whenLeaving) {
|
|
| 309 |
- DcpComputedValue whenArrivingValue = computeDcpNonEntangling0(whenArriving);
|
|
| 310 |
- dcp.setComputedWhenArrivingNonEntangling(whenArrivingValue);
|
|
| 316 |
+ result.ifPresent(r->activityContext.flushDcp(dcp, r));
|
|
| 311 | 317 |
|
| 312 |
- DcpComputedValue whenLeavingValue = computeDcpNonEntangling0(whenLeaving);
|
|
| 313 |
- dcp.setComputedWhenLeavingNonEntangling(whenLeavingValue);
|
|
| 314 |
- }
|
|
| 315 |
- |
|
| 316 |
- private void computeDcpBiodegradable(FloatingObject dcp, Set<FloatingObjectPart> whenArriving, Set<FloatingObjectPart> whenLeaving) {
|
|
| 317 |
- DcpComputedValue whenArrivingValue = computeDcpBiodegradable0(whenArriving);
|
|
| 318 |
- dcp.setComputedWhenArrivingBiodegradable(whenArrivingValue);
|
|
| 319 |
- |
|
| 320 |
- DcpComputedValue whenLeavingValue = computeDcpBiodegradable0(whenLeaving);
|
|
| 321 |
- dcp.setComputedWhenLeavingBiodegradable(whenLeavingValue);
|
|
| 322 |
- }
|
|
| 323 |
- |
|
| 324 |
- private DcpComputedValue computeDcpBiodegradable0(Set<FloatingObjectPart> floatingObjectParts) {
|
|
| 325 |
- DcpComputedValue result = DcpComputedValue.UNKNOWN;
|
|
| 326 |
- if (!floatingObjectParts.isEmpty()) {
|
|
| 327 |
- result = DcpComputedValue.TRUE;
|
|
| 328 |
- for (FloatingObjectPart floatingObjectPart : floatingObjectParts) {
|
|
| 329 |
- if (!floatingObjectPart.getObjectMaterial().isBiodegradable()) {
|
|
| 330 |
- result = DcpComputedValue.FALSE;
|
|
| 331 |
- break;
|
|
| 332 |
- }
|
|
| 333 |
- }
|
|
| 334 |
- }
|
|
| 335 |
- return result;
|
|
| 336 |
- }
|
|
| 337 |
- |
|
| 338 |
- private String computeDcpSimplifiedObjectType0(Set<FloatingObjectPart> floatingObjectParts, SimplifiedObjectTypeManager simplifiedObjectTypeManager) {
|
|
| 339 |
- Set<String> objectMaterialIds = floatingObjectParts.stream().map(p -> p.getObjectMaterial().getTopiaId()).collect(Collectors.toSet());
|
|
| 340 |
- return simplifiedObjectTypeManager.getStandardCode(objectMaterialIds);
|
|
| 341 |
- }
|
|
| 342 |
- |
|
| 343 |
- private DcpComputedValue computeDcpNonEntangling0(Set<FloatingObjectPart> floatingObjectParts) {
|
|
| 344 |
- DcpComputedValue result = DcpComputedValue.UNKNOWN;
|
|
| 345 |
- if (!floatingObjectParts.isEmpty()) {
|
|
| 346 |
- result = DcpComputedValue.TRUE;
|
|
| 347 |
- for (FloatingObjectPart floatingObjectPart : floatingObjectParts) {
|
|
| 348 |
- if (!floatingObjectPart.getObjectMaterial().isNonEntangling()) {
|
|
| 349 |
- result = DcpComputedValue.FALSE;
|
|
| 350 |
- break;
|
|
| 351 |
- }
|
|
| 352 |
- }
|
|
| 353 |
- }
|
|
| 354 |
- return result;
|
|
| 355 | 318 |
}
|
| 356 | 319 |
|
| 357 | 320 |
private void updateNonTargetCatch(ConsolidationActivitySeineDataContext activityContext, NonTargetCatch nonTargetCatch) {
|
| ... | ... | @@ -734,4 +697,54 @@ public class ConsolidateDataServiceTopia extends ObserveServiceTopia implements |
| 734 | 697 |
}
|
| 735 | 698 |
}
|
| 736 | 699 |
|
| 700 |
+ static ImmutableMap<String, SimplifiedObjectTypeNode> create(List<ObjectMaterial> materials) {
|
|
| 701 |
+ TreeMap<String, SimplifiedObjectTypeNode> mappingBuilder = new TreeMap<>();
|
|
| 702 |
+ |
|
| 703 |
+ Set<ObjectMaterial> materialsDone = new LinkedHashSet<>();
|
|
| 704 |
+ Set<ObjectMaterial> materialsTodo = new LinkedHashSet<>(materials);
|
|
| 705 |
+ |
|
| 706 |
+ while (!materialsTodo.isEmpty()) {
|
|
| 707 |
+ |
|
| 708 |
+ Set<ObjectMaterial> currentRoundMaterials;
|
|
| 709 |
+ if (materialsDone.isEmpty()) {
|
|
| 710 |
+ |
|
| 711 |
+ // first round
|
|
| 712 |
+ currentRoundMaterials = materialsTodo.stream().filter(f -> f.getParent() == null).collect(Collectors.toSet());
|
|
| 713 |
+ |
|
| 714 |
+ } else {
|
|
| 715 |
+ currentRoundMaterials = materialsTodo.stream().filter(f -> materialsDone.contains(f.getParent())).collect(Collectors.toSet());
|
|
| 716 |
+ }
|
|
| 717 |
+ |
|
| 718 |
+ materialsDone.addAll(currentRoundMaterials);
|
|
| 719 |
+ materialsTodo.removeAll(currentRoundMaterials);
|
|
| 720 |
+ |
|
| 721 |
+ for (ObjectMaterial currentRoundMaterial : currentRoundMaterials) {
|
|
| 722 |
+ |
|
| 723 |
+ ObjectMaterial simplifiedObjectMaterial = currentRoundMaterial.getSimplifiedObjectMaterial();
|
|
| 724 |
+ |
|
| 725 |
+ SimplifiedObjectTypeNode node;
|
|
| 726 |
+ if (Objects.equals(currentRoundMaterial, simplifiedObjectMaterial)) {
|
|
| 727 |
+ |
|
| 728 |
+ // new node
|
|
| 729 |
+ ObjectMaterial simplifiedParentObjectMaterial = currentRoundMaterial.getSimplifiedParentObjectMaterial();
|
|
| 730 |
+ SimplifiedObjectTypeNode parentNode = simplifiedParentObjectMaterial == null ? null : mappingBuilder.get(simplifiedParentObjectMaterial.getTopiaId());
|
|
| 731 |
+ node = new SimplifiedObjectTypeNode(currentRoundMaterial.getTopiaId(), currentRoundMaterial.getStandardCode(), parentNode);
|
|
| 732 |
+ |
|
| 733 |
+ } else {
|
|
| 734 |
+ |
|
| 735 |
+ // simplified object material is a parent, so must have been process in previous round
|
|
| 736 |
+ Objects.requireNonNull(simplifiedObjectMaterial);
|
|
| 737 |
+ |
|
| 738 |
+ node = mappingBuilder.get(simplifiedObjectMaterial.getTopiaId());
|
|
| 739 |
+ Objects.requireNonNull(node);
|
|
| 740 |
+ |
|
| 741 |
+ }
|
|
| 742 |
+ |
|
| 743 |
+ mappingBuilder.put(currentRoundMaterial.getTopiaId(), node);
|
|
| 744 |
+ |
|
| 745 |
+ }
|
|
| 746 |
+ }
|
|
| 747 |
+ return ImmutableMap.copyOf(mappingBuilder);
|
|
| 748 |
+ }
|
|
| 749 |
+ |
|
| 737 | 750 |
}
|
| ... | ... | @@ -22,6 +22,7 @@ package fr.ird.observe.services.topia.service.actions.consolidate; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import fr.ird.observe.common.constants.seine.DcpComputedValue;
|
|
| 25 | 26 |
import fr.ird.observe.common.constants.seine.SchoolType;
|
| 26 | 27 |
import fr.ird.observe.entities.referentiel.LengthWeightParameter;
|
| 27 | 28 |
import fr.ird.observe.entities.referentiel.LengthWeightParameterNotFoundException;
|
| ... | ... | @@ -32,6 +33,7 @@ import fr.ird.observe.entities.referentiel.SizeMeasureType; |
| 32 | 33 |
import fr.ird.observe.entities.referentiel.Species;
|
| 33 | 34 |
import fr.ird.observe.entities.seine.ActivitySeine;
|
| 34 | 35 |
import fr.ird.observe.entities.seine.FloatingObject;
|
| 36 |
+import fr.ird.observe.entities.seine.FloatingObjectPart;
|
|
| 35 | 37 |
import fr.ird.observe.entities.seine.NonTargetCatch;
|
| 36 | 38 |
import fr.ird.observe.entities.seine.NonTargetLength;
|
| 37 | 39 |
import fr.ird.observe.entities.seine.Route;
|
| ... | ... | @@ -39,6 +41,12 @@ import fr.ird.observe.entities.seine.SetSeine; |
| 39 | 41 |
import fr.ird.observe.entities.seine.TargetLength;
|
| 40 | 42 |
import fr.ird.observe.entities.seine.TripSeine;
|
| 41 | 43 |
import fr.ird.observe.persistence.ObserveTopiaDaoSupplier;
|
| 44 |
+import fr.ird.observe.services.binder.data.DataBinderSupport;
|
|
| 45 |
+import fr.ird.observe.services.dto.seine.FloatingObjectDto;
|
|
| 46 |
+import fr.ird.observe.services.dto.seine.FloatingObjectPartDto;
|
|
| 47 |
+import fr.ird.observe.services.service.actions.consolidate.dcp.ConsolidateFloatingObjectResult;
|
|
| 48 |
+import fr.ird.observe.services.service.actions.consolidate.dcp.FloatingObjectConsolidateEngine;
|
|
| 49 |
+import fr.ird.observe.services.service.actions.consolidate.dcp.FloatingObjectModification;
|
|
| 42 | 50 |
import java.util.Date;
|
| 43 | 51 |
import java.util.Locale;
|
| 44 | 52 |
import org.nuiton.util.beans.BeanMonitor;
|
| ... | ... | @@ -68,11 +76,11 @@ class ConsolidationActivitySeineDataContext { |
| 68 | 76 |
|
| 69 | 77 |
BeanMonitor nonTargetCatchMonitor;
|
| 70 | 78 |
|
| 71 |
- BeanMonitor dcpMonitor;
|
|
| 72 |
- |
|
| 73 | 79 |
ConsolidateActivitySeineDataResultBuilder resultBuilder;
|
| 74 | 80 |
|
| 75 |
- SimplifiedObjectTypeManager simplifiedObjectTypeManager;
|
|
| 81 |
+ FloatingObjectConsolidateEngine floatingObjectConsolidateEngine;
|
|
| 82 |
+ DataBinderSupport<FloatingObject, FloatingObjectDto> floatingObjectBinder;
|
|
| 83 |
+ DataBinderSupport<FloatingObjectPart, FloatingObjectPartDto> floatingObjectPartBinder;
|
|
| 76 | 84 |
|
| 77 | 85 |
public Ocean getOcean() {
|
| 78 | 86 |
return tripSeine.getOcean();
|
| ... | ... | @@ -134,16 +142,43 @@ class ConsolidationActivitySeineDataContext { |
| 134 | 142 |
}
|
| 135 | 143 |
}
|
| 136 | 144 |
|
| 137 |
- void watchDcp(FloatingObject dcp) {
|
|
| 138 |
- dcpMonitor.setBean(dcp);
|
|
| 139 |
- }
|
|
| 140 |
- |
|
| 141 |
- void flushDcp() {
|
|
| 142 |
- if (dcpMonitor.wasModified()) {
|
|
| 143 |
- FloatingObject dcp = (FloatingObject) dcpMonitor.getBean();
|
|
| 144 |
- resultBuilder.flushDcpModification(dcp, dcpMonitor.getModifiedProperties());
|
|
| 145 |
+ void flushDcp(FloatingObject dcp, ConsolidateFloatingObjectResult consolidateFloatingObjectResult) {
|
|
| 146 |
+ resultBuilder.flushDcpModification(consolidateFloatingObjectResult);
|
|
| 147 |
+ for (FloatingObjectModification floatingObjectModification : consolidateFloatingObjectResult.getFloatingObjectModifications()) {
|
|
| 148 |
+ String modifiedProperty = floatingObjectModification.getPropertyName();
|
|
| 149 |
+ switch (modifiedProperty) {
|
|
| 150 |
+ case FloatingObjectDto.PROPERTY_COMPUTED_WHEN_ARRIVING_BIODEGRADABLE: {
|
|
| 151 |
+ |
|
| 152 |
+ dcp.setComputedWhenArrivingBiodegradable((DcpComputedValue) floatingObjectModification.getNewValue());
|
|
| 153 |
+ break;
|
|
| 154 |
+ }
|
|
| 155 |
+ case FloatingObjectDto.PROPERTY_COMPUTED_WHEN_ARRIVING_NON_ENTANGLING: {
|
|
| 156 |
+ |
|
| 157 |
+ dcp.setComputedWhenArrivingNonEntangling((DcpComputedValue) floatingObjectModification.getNewValue());
|
|
| 158 |
+ break;
|
|
| 159 |
+ }
|
|
| 160 |
+ case FloatingObjectDto.PROPERTY_COMPUTED_WHEN_ARRIVING_SIMPLIFIED_OBJECT_TYPE: {
|
|
| 161 |
+ |
|
| 162 |
+ dcp.setComputedWhenArrivingSimplifiedObjectType((String) floatingObjectModification.getNewValue());
|
|
| 163 |
+ break;
|
|
| 164 |
+ }
|
|
| 165 |
+ case FloatingObjectDto.PROPERTY_COMPUTED_WHEN_LEAVING_BIODEGRADABLE: {
|
|
| 166 |
+ |
|
| 167 |
+ dcp.setComputedWhenLeavingBiodegradable((DcpComputedValue) floatingObjectModification.getNewValue());
|
|
| 168 |
+ break;
|
|
| 169 |
+ }
|
|
| 170 |
+ case FloatingObjectDto.PROPERTY_COMPUTED_WHEN_LEAVING_NON_ENTANGLING: {
|
|
| 171 |
+ |
|
| 172 |
+ dcp.setComputedWhenLeavingNonEntangling((DcpComputedValue) floatingObjectModification.getNewValue());
|
|
| 173 |
+ break;
|
|
| 174 |
+ }
|
|
| 175 |
+ case FloatingObjectDto.PROPERTY_COMPUTED_WHEN_LEAVING_SIMPLIFIED_OBJECT_TYPE: {
|
|
| 176 |
+ |
|
| 177 |
+ dcp.setComputedWhenLeavingSimplifiedObjectType((String) floatingObjectModification.getNewValue());
|
|
| 178 |
+ break;
|
|
| 179 |
+ }
|
|
| 180 |
+ }
|
|
| 145 | 181 |
}
|
| 146 |
- dcpMonitor.setBean(null);
|
|
| 147 | 182 |
}
|
| 148 | 183 |
|
| 149 | 184 |
void flushTargetLength() {
|
| 1 |
-package fr.ird.observe.services.topia.service.actions.consolidate;
|
|
| 1 |
+package fr.ird.observe.services.topia.service.actions.consolidate.dcp;
|
|
| 2 | 2 |
|
| 3 | 3 |
/*-
|
| 4 | 4 |
* #%L
|
| ... | ... | @@ -22,10 +22,10 @@ package fr.ird.observe.services.topia.service.actions.consolidate; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
-import com.google.common.collect.ImmutableMap;
|
|
| 26 | 25 |
import com.google.common.collect.ImmutableSet;
|
| 27 |
-import fr.ird.observe.entities.referentiel.seine.SimplifiedObjectTypeNode;
|
|
| 28 |
-import fr.ird.observe.persistence.ObserveTopiaPersistenceContext;
|
|
| 26 |
+import fr.ird.observe.services.service.actions.consolidate.ConsolidateDataService;
|
|
| 27 |
+import fr.ird.observe.services.service.actions.consolidate.dcp.SimplifiedObjectTypeManager;
|
|
| 28 |
+import fr.ird.observe.services.service.actions.consolidate.dcp.SimplifiedObjectTypeNode;
|
|
| 29 | 29 |
import fr.ird.observe.services.topia.service.AbstractServiceTopiaTest;
|
| 30 | 30 |
import fr.ird.observe.test.DatabaseName;
|
| 31 | 31 |
import fr.ird.observe.test.spi.DatabaseNameConfiguration;
|
| ... | ... | @@ -46,12 +46,8 @@ public class SimplifiedObjectTypeManagerTest extends AbstractServiceTopiaTest { |
| 46 | 46 |
|
| 47 | 47 |
@Before
|
| 48 | 48 |
public void setUp() throws Exception {
|
| 49 |
- try (ObserveTopiaPersistenceContext persistenceContext = topiaTestMethodResource.newPersistenceContext()) {
|
|
| 50 |
- |
|
| 51 |
- ImmutableMap<String, SimplifiedObjectTypeNode> materialMapping = persistenceContext.getObjectMaterialDao().createMaterialMapping();
|
|
| 52 |
- simplifiedObjectTypeManager = new SimplifiedObjectTypeManager(materialMapping);
|
|
| 53 |
- }
|
|
| 54 | 49 |
|
| 50 |
+ simplifiedObjectTypeManager = topiaTestMethodResource.newService(ConsolidateDataService.class).newSimplifiedObjectTypeManager();
|
|
| 55 | 51 |
|
| 56 | 52 |
}
|
| 57 | 53 |
|
| ... | ... | @@ -693,7 +693,9 @@ public class ObserveDtoInitializer { |
| 693 | 693 |
flushReferential(referentialDefaultDefinitionBuilder(ObjectMaterialDto.class)
|
| 694 | 694 |
.addProperty(String.class, ObjectMaterialDto.PROPERTY_PARENT)
|
| 695 | 695 |
.addProperty(String.class, ObjectMaterialDto.PROPERTY_OBJECT_MATERIAL_TYPE)
|
| 696 |
- .addProperty(String.class, ObjectMaterialDto.PROPERTY_VALIDATION));
|
|
| 696 |
+ .addProperty(String.class, ObjectMaterialDto.PROPERTY_VALIDATION)
|
|
| 697 |
+ .addProperty(boolean.class, ObjectMaterialDto.PROPERTY_BIODEGRADABLE)
|
|
| 698 |
+ .addProperty(boolean.class, ObjectMaterialDto.PROPERTY_NON_ENTANGLING));
|
|
| 697 | 699 |
}
|
| 698 | 700 |
|
| 699 | 701 |
@Override
|
| ... | ... | @@ -155,6 +155,10 @@ public abstract class AbstractReference<D extends IdDto> implements ObserveDto, |
| 155 | 155 |
return labelPropertyValues[propertyIndex];
|
| 156 | 156 |
}
|
| 157 | 157 |
|
| 158 |
+ public Boolean getBooleanPropertyValue(String propertyName) {
|
|
| 159 |
+ return (Boolean) getPropertyValue(propertyName);
|
|
| 160 |
+ }
|
|
| 161 |
+ |
|
| 158 | 162 |
public Serializable[] getLabelPropertyValues() {
|
| 159 | 163 |
return labelPropertyValues;
|
| 160 | 164 |
}
|
| ... | ... | @@ -23,7 +23,9 @@ package fr.ird.observe.services.service.actions.consolidate; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.services.service.ObserveService;
|
| 26 |
+import fr.ird.observe.services.service.actions.consolidate.dcp.SimplifiedObjectTypeManager;
|
|
| 26 | 27 |
import fr.ird.observe.services.spi.ReadDataPermission;
|
| 28 |
+import fr.ird.observe.services.spi.ReadReferentialPermission;
|
|
| 27 | 29 |
import fr.ird.observe.services.spi.Write;
|
| 28 | 30 |
import fr.ird.observe.services.spi.WriteDataPermission;
|
| 29 | 31 |
import io.ultreia.java4all.http.spi.Post;
|
| ... | ... | @@ -38,6 +40,9 @@ import io.ultreia.java4all.http.spi.Post; |
| 38 | 40 |
*/
|
| 39 | 41 |
public interface ConsolidateDataService extends ObserveService {
|
| 40 | 42 |
|
| 43 |
+ @ReadReferentialPermission
|
|
| 44 |
+ SimplifiedObjectTypeManager newSimplifiedObjectTypeManager();
|
|
| 45 |
+ |
|
| 41 | 46 |
/**
|
| 42 | 47 |
* Effectue la consolitation à partir de la demande passé en paramètre et retourne les résultats pour les marées
|
| 43 | 48 |
* modifiées.
|
| ... | ... | @@ -24,6 +24,7 @@ package fr.ird.observe.services.service.actions.consolidate; |
| 24 | 24 |
|
| 25 | 25 |
import com.google.common.collect.ImmutableSet;
|
| 26 | 26 |
import fr.ird.observe.services.dto.ObserveDto;
|
| 27 |
+import fr.ird.observe.services.service.actions.consolidate.set.ConsolidateActivitySeineDataResult;
|
|
| 27 | 28 |
import java.io.Serializable;
|
| 28 | 29 |
|
| 29 | 30 |
/**
|
| 1 |
+package fr.ird.observe.services.service.actions.consolidate.dcp;
|
|
| 2 |
+ |
|
| 3 |
+import com.google.common.collect.ImmutableSet;
|
|
| 4 |
+import fr.ird.observe.services.dto.ObserveDto;
|
|
| 5 |
+import fr.ird.observe.services.dto.seine.FloatingObjectDto;
|
|
| 6 |
+import fr.ird.observe.services.dto.seine.FloatingObjectPartDto;
|
|
| 7 |
+import java.util.stream.Collectors;
|
|
| 8 |
+ |
|
| 9 |
+/**
|
|
| 10 |
+ * Created by tchemit on 04/08/17.
|
|
| 11 |
+ *
|
|
| 12 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 13 |
+ */
|
|
| 14 |
+public class ConsolidateFloatingObjectRequest implements ObserveDto {
|
|
| 15 |
+ |
|
| 16 |
+ private final FloatingObjectDto dcp;
|
|
| 17 |
+ private final ImmutableSet<FloatingObjectPartDto> whenArriving;
|
|
| 18 |
+ private final ImmutableSet<FloatingObjectPartDto> whenLeaving;
|
|
| 19 |
+ |
|
| 20 |
+ |
|
| 21 |
+ public ConsolidateFloatingObjectRequest(FloatingObjectDto dcp, ImmutableSet<FloatingObjectPartDto> floatingObjectParts) {
|
|
| 22 |
+ this.dcp = dcp;
|
|
| 23 |
+ whenArriving = ImmutableSet.copyOf(floatingObjectParts.stream().filter(p -> p.getWhenArriving() != null).collect(Collectors.toSet()));
|
|
| 24 |
+ whenLeaving = ImmutableSet.copyOf(floatingObjectParts.stream().filter(p -> p.getWhenLeaving() != null).collect(Collectors.toSet()));
|
|
| 25 |
+ }
|
|
| 26 |
+ |
|
| 27 |
+ public FloatingObjectDto getDcp() {
|
|
| 28 |
+ return dcp;
|
|
| 29 |
+ }
|
|
| 30 |
+ |
|
| 31 |
+ public ImmutableSet<FloatingObjectPartDto> getWhenArriving() {
|
|
| 32 |
+ return whenArriving;
|
|
| 33 |
+ }
|
|
| 34 |
+ |
|
| 35 |
+ public ImmutableSet<FloatingObjectPartDto> getWhenLeaving() {
|
|
| 36 |
+ return whenLeaving;
|
|
| 37 |
+ }
|
|
| 38 |
+}
|
| 1 |
-package fr.ird.observe.entities.referentiel.seine;
|
|
| 1 |
+package fr.ird.observe.services.service.actions.consolidate.dcp;
|
|
| 2 | 2 |
|
| 3 |
-/*-
|
|
| 3 |
+/*
|
|
| 4 | 4 |
* #%L
|
| 5 |
- * ObServe :: Persistence
|
|
| 5 |
+ * ObServe :: Services
|
|
| 6 | 6 |
* %%
|
| 7 | 7 |
* Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
| 8 | 8 |
* %%
|
| ... | ... | @@ -22,10 +22,34 @@ package fr.ird.observe.entities.referentiel.seine; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
-import com.google.common.collect.ImmutableMap;
|
|
| 25 |
+import com.google.common.collect.ImmutableSet;
|
|
| 26 |
+import fr.ird.observe.services.dto.ObserveDto;
|
|
| 27 |
+import java.io.Serializable;
|
|
| 26 | 28 |
|
| 27 |
-public class ObjectMaterialTopiaDao extends AbstractObjectMaterialTopiaDao<ObjectMaterial> {
|
|
| 28 |
- public ImmutableMap<String, SimplifiedObjectTypeNode> createMaterialMapping() {
|
|
| 29 |
- return SimplifiedObjectTypeNode.create(findAll());
|
|
| 29 |
+/**
|
|
| 30 |
+ * Pour retourner le résultat de la consolidation d'une activité de type Seine.
|
|
| 31 |
+ * <p>
|
|
| 32 |
+ * Un tel objet est créé uniquement si des modifications on été effectuée sur l'activité.
|
|
| 33 |
+ * <p>
|
|
| 34 |
+ * Created on 28/08/15.
|
|
| 35 |
+ *
|
|
| 36 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 37 |
+ */
|
|
| 38 |
+public class ConsolidateFloatingObjectResult implements Serializable, ObserveDto {
|
|
| 39 |
+ |
|
| 40 |
+ private static final long serialVersionUID = 1L;
|
|
| 41 |
+ |
|
| 42 |
+ /**
|
|
| 43 |
+ * L'ensemble des modifications sur les objets flottants.
|
|
| 44 |
+ */
|
|
| 45 |
+ private final ImmutableSet<FloatingObjectModification> floatingObjectModifications;
|
|
| 46 |
+ |
|
| 47 |
+ ConsolidateFloatingObjectResult(ImmutableSet<FloatingObjectModification> floatingObjectModifications) {
|
|
| 48 |
+ this.floatingObjectModifications = floatingObjectModifications;
|
|
| 30 | 49 |
}
|
| 50 |
+ |
|
| 51 |
+ public ImmutableSet<FloatingObjectModification> getFloatingObjectModifications() {
|
|
| 52 |
+ return floatingObjectModifications;
|
|
| 53 |
+ }
|
|
| 54 |
+ |
|
| 31 | 55 |
}
|
| 1 |
+package fr.ird.observe.services.service.actions.consolidate.dcp;
|
|
| 2 |
+ |
|
| 3 |
+/*
|
|
| 4 |
+ * #%L
|
|
| 5 |
+ * ObServe :: Services ToPIA Implementation
|
|
| 6 |
+ * %%
|
|
| 7 |
+ * Copyright (C) 2008 - 2017 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.services.dto.seine.FloatingObjectDto;
|
|
| 27 |
+import java.util.Optional;
|
|
| 28 |
+ |
|
| 29 |
+/**
|
|
| 30 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 31 |
+ * @since 7.0
|
|
| 32 |
+ */
|
|
| 33 |
+public class ConsolidateFloatingObjectResultBuilder {
|
|
| 34 |
+ |
|
| 35 |
+ private final ImmutableSet.Builder<FloatingObjectModification> modificationsBuilder = new ImmutableSet.Builder<>();
|
|
| 36 |
+ |
|
| 37 |
+ public Optional<ConsolidateFloatingObjectResult> build() {
|
|
| 38 |
+ |
|
| 39 |
+ ImmutableSet<FloatingObjectModification> modifications = modificationsBuilder.build();
|
|
| 40 |
+ |
|
| 41 |
+ boolean noModification = modifications.isEmpty();
|
|
| 42 |
+ |
|
| 43 |
+ return Optional.ofNullable(noModification ? null : new ConsolidateFloatingObjectResult(modifications));
|
|
| 44 |
+ |
|
| 45 |
+ }
|
|
| 46 |
+ |
|
| 47 |
+ void flushDcpModification(FloatingObjectDto dcp, String... propertyNamesModified) {
|
|
| 48 |
+ |
|
| 49 |
+ for (String modifiedProperty : propertyNamesModified) {
|
|
| 50 |
+ switch (modifiedProperty) {
|
|
| 51 |
+ case FloatingObjectDto.PROPERTY_COMPUTED_WHEN_ARRIVING_BIODEGRADABLE: {
|
|
| 52 |
+ |
|
| 53 |
+ FloatingObjectModification element = new FloatingObjectModification(dcp.getId(), modifiedProperty, dcp.getComputedWhenArrivingBiodegradable());
|
|
| 54 |
+ modificationsBuilder.add(element);
|
|
| 55 |
+ |
|
| 56 |
+ break;
|
|
| 57 |
+ }
|
|
| 58 |
+ case FloatingObjectDto.PROPERTY_COMPUTED_WHEN_ARRIVING_NON_ENTANGLING: {
|
|
| 59 |
+ |
|
| 60 |
+ FloatingObjectModification element = new FloatingObjectModification(dcp.getId(), modifiedProperty, dcp.getComputedWhenArrivingNonEntangling());
|
|
| 61 |
+ modificationsBuilder.add(element);
|
|
| 62 |
+ |
|
| 63 |
+ break;
|
|
| 64 |
+ }
|
|
| 65 |
+ case FloatingObjectDto.PROPERTY_COMPUTED_WHEN_ARRIVING_SIMPLIFIED_OBJECT_TYPE: {
|
|
| 66 |
+ |
|
| 67 |
+ FloatingObjectModification element = new FloatingObjectModification(dcp.getId(), modifiedProperty, dcp.getComputedWhenArrivingSimplifiedObjectType());
|
|
| 68 |
+ modificationsBuilder.add(element);
|
|
| 69 |
+ break;
|
|
| 70 |
+ }
|
|
| 71 |
+ case FloatingObjectDto.PROPERTY_COMPUTED_WHEN_LEAVING_BIODEGRADABLE: {
|
|
| 72 |
+ |
|
| 73 |
+ FloatingObjectModification element = new FloatingObjectModification(dcp.getId(), modifiedProperty, dcp.getComputedWhenArrivingBiodegradable());
|
|
| 74 |
+ modificationsBuilder.add(element);
|
|
| 75 |
+ break;
|
|
| 76 |
+ }
|
|
| 77 |
+ case FloatingObjectDto.PROPERTY_COMPUTED_WHEN_LEAVING_NON_ENTANGLING: {
|
|
| 78 |
+ |
|
| 79 |
+ FloatingObjectModification element = new FloatingObjectModification(dcp.getId(), FloatingObjectDto.PROPERTY_COMPUTED_WHEN_LEAVING_NON_ENTANGLING, dcp.getComputedWhenLeavingNonEntangling());
|
|
| 80 |
+ modificationsBuilder.add(element);
|
|
| 81 |
+ |
|
| 82 |
+ break;
|
|
| 83 |
+ }
|
|
| 84 |
+ case FloatingObjectDto.PROPERTY_COMPUTED_WHEN_LEAVING_SIMPLIFIED_OBJECT_TYPE: {
|
|
| 85 |
+ |
|
| 86 |
+ FloatingObjectModification element = new FloatingObjectModification(dcp.getId(), FloatingObjectDto.PROPERTY_COMPUTED_WHEN_LEAVING_SIMPLIFIED_OBJECT_TYPE, dcp.getComputedWhenLeavingSimplifiedObjectType());
|
|
| 87 |
+ modificationsBuilder.add(element);
|
|
| 88 |
+ break;
|
|
| 89 |
+ }
|
|
| 90 |
+ }
|
|
| 91 |
+ }
|
|
| 92 |
+ |
|
| 93 |
+ }
|
|
| 94 |
+}
|
| 1 |
+package fr.ird.observe.services.service.actions.consolidate.dcp;
|
|
| 2 |
+ |
|
| 3 |
+import com.google.common.collect.ImmutableSet;
|
|
| 4 |
+import fr.ird.observe.common.constants.seine.DcpComputedValue;
|
|
| 5 |
+import fr.ird.observe.services.dto.referential.seine.ObjectMaterialDto;
|
|
| 6 |
+import fr.ird.observe.services.dto.seine.FloatingObjectDto;
|
|
| 7 |
+import fr.ird.observe.services.dto.seine.FloatingObjectPartDto;
|
|
| 8 |
+import java.util.Optional;
|
|
| 9 |
+import java.util.Set;
|
|
| 10 |
+import java.util.stream.Collectors;
|
|
| 11 |
+import org.nuiton.util.beans.BeanMonitor;
|
|
| 12 |
+ |
|
| 13 |
+/**
|
|
| 14 |
+ * Created by tchemit on 04/08/17.
|
|
| 15 |
+ *
|
|
| 16 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 17 |
+ */
|
|
| 18 |
+public class FloatingObjectConsolidateEngine {
|
|
| 19 |
+ |
|
| 20 |
+ private final SimplifiedObjectTypeManager simplifiedObjectTypeManager;
|
|
| 21 |
+ |
|
| 22 |
+ private static class FloatingObjectConsolidateContext {
|
|
| 23 |
+ |
|
| 24 |
+ final ConsolidateFloatingObjectResultBuilder resultBuilder;
|
|
| 25 |
+ final BeanMonitor dcpMonitor;
|
|
| 26 |
+ |
|
| 27 |
+ FloatingObjectConsolidateContext(ConsolidateFloatingObjectResultBuilder resultBuilder) {
|
|
| 28 |
+ this.resultBuilder = resultBuilder;
|
|
| 29 |
+ dcpMonitor = new BeanMonitor(
|
|
| 30 |
+ FloatingObjectDto.PROPERTY_COMPUTED_WHEN_ARRIVING_BIODEGRADABLE,
|
|
| 31 |
+ FloatingObjectDto.PROPERTY_COMPUTED_WHEN_ARRIVING_NON_ENTANGLING,
|
|
| 32 |
+ FloatingObjectDto.PROPERTY_COMPUTED_WHEN_ARRIVING_SIMPLIFIED_OBJECT_TYPE,
|
|
| 33 |
+ FloatingObjectDto.PROPERTY_COMPUTED_WHEN_LEAVING_BIODEGRADABLE,
|
|
| 34 |
+ FloatingObjectDto.PROPERTY_COMPUTED_WHEN_LEAVING_NON_ENTANGLING,
|
|
| 35 |
+ FloatingObjectDto.PROPERTY_COMPUTED_WHEN_LEAVING_SIMPLIFIED_OBJECT_TYPE
|
|
| 36 |
+ );
|
|
| 37 |
+ }
|
|
| 38 |
+ |
|
| 39 |
+ |
|
| 40 |
+ void watchDcp(FloatingObjectDto dcp) {
|
|
| 41 |
+ dcpMonitor.setBean(dcp);
|
|
| 42 |
+ }
|
|
| 43 |
+ |
|
| 44 |
+ void flushDcp() {
|
|
| 45 |
+ if (dcpMonitor.wasModified()) {
|
|
| 46 |
+ FloatingObjectDto dcp = (FloatingObjectDto) dcpMonitor.getBean();
|
|
| 47 |
+ resultBuilder.flushDcpModification(dcp, dcpMonitor.getModifiedProperties());
|
|
| 48 |
+ }
|
|
| 49 |
+ dcpMonitor.setBean(null);
|
|
| 50 |
+ }
|
|
| 51 |
+ }
|
|
| 52 |
+ |
|
| 53 |
+ public FloatingObjectConsolidateEngine(SimplifiedObjectTypeManager simplifiedObjectTypeManager) {
|
|
| 54 |
+ this.simplifiedObjectTypeManager = simplifiedObjectTypeManager;
|
|
| 55 |
+ }
|
|
| 56 |
+ |
|
| 57 |
+ public Optional<ConsolidateFloatingObjectResult> consolidate(ConsolidateFloatingObjectRequest request) {
|
|
| 58 |
+ |
|
| 59 |
+ ConsolidateFloatingObjectResultBuilder builder = new ConsolidateFloatingObjectResultBuilder();
|
|
| 60 |
+ FloatingObjectConsolidateContext context = new FloatingObjectConsolidateContext(builder);
|
|
| 61 |
+ |
|
| 62 |
+ FloatingObjectDto dcp = request.getDcp();
|
|
| 63 |
+ |
|
| 64 |
+ context.watchDcp(dcp);
|
|
| 65 |
+ |
|
| 66 |
+ ImmutableSet<FloatingObjectPartDto> whenArriving = request.getWhenArriving();
|
|
| 67 |
+ ImmutableSet<FloatingObjectPartDto> whenLeaving = request.getWhenLeaving();
|
|
| 68 |
+ |
|
| 69 |
+ computeDcpSimplifiedObjectType(dcp, whenArriving, whenLeaving);
|
|
| 70 |
+ computeDcpNonEntangling(dcp, whenArriving, whenLeaving);
|
|
| 71 |
+ computeDcpBiodegradable(dcp, whenArriving, whenLeaving);
|
|
| 72 |
+ |
|
| 73 |
+ context.flushDcp();
|
|
| 74 |
+ |
|
| 75 |
+ return builder.build();
|
|
| 76 |
+ |
|
| 77 |
+ }
|
|
| 78 |
+ |
|
| 79 |
+ private void computeDcpSimplifiedObjectType(FloatingObjectDto dcp, Set<FloatingObjectPartDto> whenArriving, Set<FloatingObjectPartDto> whenLeaving) {
|
|
| 80 |
+ String whenArrivingValue = computeDcpSimplifiedObjectType0(whenArriving);
|
|
| 81 |
+ dcp.setComputedWhenArrivingSimplifiedObjectType(whenArrivingValue);
|
|
| 82 |
+ |
|
| 83 |
+ String whenLeavingValue = computeDcpSimplifiedObjectType0(whenLeaving);
|
|
| 84 |
+ dcp.setComputedWhenLeavingSimplifiedObjectType(whenLeavingValue);
|
|
| 85 |
+ }
|
|
| 86 |
+ |
|
| 87 |
+ private void computeDcpNonEntangling(FloatingObjectDto dcp, Set<FloatingObjectPartDto> whenArriving, Set<FloatingObjectPartDto> whenLeaving) {
|
|
| 88 |
+ DcpComputedValue whenArrivingValue = computeDcpNonEntangling0(whenArriving);
|
|
| 89 |
+ dcp.setComputedWhenArrivingNonEntangling(whenArrivingValue);
|
|
| 90 |
+ |
|
| 91 |
+ DcpComputedValue whenLeavingValue = computeDcpNonEntangling0(whenLeaving);
|
|
| 92 |
+ dcp.setComputedWhenLeavingNonEntangling(whenLeavingValue);
|
|
| 93 |
+ }
|
|
| 94 |
+ |
|
| 95 |
+ private void computeDcpBiodegradable(FloatingObjectDto dcp, Set<FloatingObjectPartDto> whenArriving, Set<FloatingObjectPartDto> whenLeaving) {
|
|
| 96 |
+ DcpComputedValue whenArrivingValue = computeDcpBiodegradable0(whenArriving);
|
|
| 97 |
+ dcp.setComputedWhenArrivingBiodegradable(whenArrivingValue);
|
|
| 98 |
+ |
|
| 99 |
+ DcpComputedValue whenLeavingValue = computeDcpBiodegradable0(whenLeaving);
|
|
| 100 |
+ dcp.setComputedWhenLeavingBiodegradable(whenLeavingValue);
|
|
| 101 |
+ }
|
|
| 102 |
+ |
|
| 103 |
+ private DcpComputedValue computeDcpBiodegradable0(Set<FloatingObjectPartDto> FloatingObjectPartDtos) {
|
|
| 104 |
+ DcpComputedValue result = DcpComputedValue.UNKNOWN;
|
|
| 105 |
+ if (!FloatingObjectPartDtos.isEmpty()) {
|
|
| 106 |
+ result = DcpComputedValue.TRUE;
|
|
| 107 |
+ for (FloatingObjectPartDto FloatingObjectPartDto : FloatingObjectPartDtos) {
|
|
| 108 |
+ if (!FloatingObjectPartDto.getObjectMaterial().getBooleanPropertyValue(ObjectMaterialDto.PROPERTY_BIODEGRADABLE)) {
|
|
| 109 |
+ result = DcpComputedValue.FALSE;
|
|
| 110 |
+ break;
|
|
| 111 |
+ }
|
|
| 112 |
+ }
|
|
| 113 |
+ }
|
|
| 114 |
+ return result;
|
|
| 115 |
+ }
|
|
| 116 |
+ |
|
| 117 |
+ private String computeDcpSimplifiedObjectType0(Set<FloatingObjectPartDto> FloatingObjectPartDtos) {
|
|
| 118 |
+ Set<String> objectMaterialIds = FloatingObjectPartDtos.stream().map(p -> p.getObjectMaterial().getId()).collect(Collectors.toSet());
|
|
| 119 |
+ return simplifiedObjectTypeManager.getStandardCode(objectMaterialIds);
|
|
| 120 |
+ }
|
|
| 121 |
+ |
|
| 122 |
+ private DcpComputedValue computeDcpNonEntangling0(Set<FloatingObjectPartDto> FloatingObjectPartDtos) {
|
|
| 123 |
+ DcpComputedValue result = DcpComputedValue.UNKNOWN;
|
|
| 124 |
+ if (!FloatingObjectPartDtos.isEmpty()) {
|
|
| 125 |
+ result = DcpComputedValue.TRUE;
|
|
| 126 |
+ for (FloatingObjectPartDto FloatingObjectPartDto : FloatingObjectPartDtos) {
|
|
| 127 |
+ if (!FloatingObjectPartDto.getObjectMaterial().getBooleanPropertyValue(ObjectMaterialDto.PROPERTY_NON_ENTANGLING)) {
|
|
| 128 |
+ result = DcpComputedValue.FALSE;
|
|
| 129 |
+ break;
|
|
| 130 |
+ }
|
|
| 131 |
+ }
|
|
| 132 |
+ }
|
|
| 133 |
+ return result;
|
|
| 134 |
+ }
|
|
| 135 |
+ |
|
| 136 |
+}
|
| 1 |
+package fr.ird.observe.services.service.actions.consolidate.dcp;
|
|
| 2 |
+ |
|
| 3 |
+import java.io.Serializable;
|
|
| 4 |
+ |
|
| 5 |
+/**
|
|
| 6 |
+ * Created by tchemit on 04/08/17.
|
|
| 7 |
+ *
|
|
| 8 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 9 |
+ */
|
|
| 10 |
+public class FloatingObjectModification implements Serializable {
|
|
| 11 |
+ |
|
| 12 |
+ private static final long serialVersionUID = 1L;
|
|
| 13 |
+ |
|
| 14 |
+ private final String dcpId;
|
|
| 15 |
+ |
|
| 16 |
+ private final String propertyName;
|
|
| 17 |
+ |
|
| 18 |
+ private final Serializable newValue;
|
|
| 19 |
+ |
|
| 20 |
+ public FloatingObjectModification(String dcpId, String propertyName, Serializable newValue) {
|
|
| 21 |
+ this.dcpId = dcpId;
|
|
| 22 |
+ this.propertyName = propertyName;
|
|
| 23 |
+ this.newValue = newValue;
|
|
| 24 |
+ }
|
|
| 25 |
+ |
|
| 26 |
+ public String getDcpId() {
|
|
| 27 |
+ return dcpId;
|
|
| 28 |
+ }
|
|
| 29 |
+ |
|
| 30 |
+ public String getPropertyName() {
|
|
| 31 |
+ return propertyName;
|
|
| 32 |
+ }
|
|
| 33 |
+ |
|
| 34 |
+ public Serializable getNewValue() {
|
|
| 35 |
+ return newValue;
|
|
| 36 |
+ }
|
|
| 37 |
+ |
|
| 38 |
+}
|
| 1 |
-package fr.ird.observe.services.topia.service.actions.consolidate;
|
|
| 1 |
+package fr.ird.observe.services.service.actions.consolidate.dcp;
|
|
| 2 | 2 |
|
| 3 | 3 |
/*-
|
| 4 | 4 |
* #%L
|
| ... | ... | @@ -23,7 +23,7 @@ package fr.ird.observe.services.topia.service.actions.consolidate; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import com.google.common.collect.ImmutableMap;
|
| 26 |
-import fr.ird.observe.entities.referentiel.seine.SimplifiedObjectTypeNode;
|
|
| 26 |
+import fr.ird.observe.services.dto.ObserveDto;
|
|
| 27 | 27 |
import java.util.Comparator;
|
| 28 | 28 |
import java.util.Iterator;
|
| 29 | 29 |
import java.util.LinkedList;
|
| ... | ... | @@ -37,21 +37,20 @@ import java.util.Set; |
| 37 | 37 |
* @author Tony Chemit - dev@tchemit.fr
|
| 38 | 38 |
* @since 7.0
|
| 39 | 39 |
*/
|
| 40 |
-class SimplifiedObjectTypeManager {
|
|
| 41 |
- |
|
| 40 |
+public class SimplifiedObjectTypeManager implements ObserveDto {
|
|
| 42 | 41 |
|
| 43 | 42 |
// For each object material, get his simplified object type node
|
| 44 | 43 |
private final ImmutableMap<String, SimplifiedObjectTypeNode> mapping;
|
| 45 | 44 |
|
| 46 |
- SimplifiedObjectTypeManager(ImmutableMap<String, SimplifiedObjectTypeNode> mapping) {
|
|
| 45 |
+ public SimplifiedObjectTypeManager(ImmutableMap<String, SimplifiedObjectTypeNode> mapping) {
|
|
| 47 | 46 |
this.mapping = mapping;
|
| 48 | 47 |
}
|
| 49 | 48 |
|
| 50 |
- SimplifiedObjectTypeNode getNodeForStandardCode(String standardCode) {
|
|
| 49 |
+ public SimplifiedObjectTypeNode getNodeForStandardCode(String standardCode) {
|
|
| 51 | 50 |
return mapping.values().stream().filter(n -> n.getStandardCode().equals(standardCode)).findFirst().orElseThrow(IllegalArgumentException::new);
|
| 52 | 51 |
}
|
| 53 | 52 |
|
| 54 |
- String getStandardCode(Set<String> objectMaterialIds) {
|
|
| 53 |
+ public String getStandardCode(Set<String> objectMaterialIds) {
|
|
| 55 | 54 |
List<SimplifiedObjectTypeNode> availableNodes = new LinkedList<>();
|
| 56 | 55 |
for (String objectMaterialId : objectMaterialIds) {
|
| 57 | 56 |
availableNodes.add(mapping.get(objectMaterialId));
|
| 1 |
-package fr.ird.observe.entities.referentiel.seine;
|
|
| 1 |
+package fr.ird.observe.services.service.actions.consolidate.dcp;
|
|
| 2 | 2 |
|
| 3 | 3 |
/*-
|
| 4 | 4 |
* #%L
|
| ... | ... | @@ -23,14 +23,9 @@ package fr.ird.observe.entities.referentiel.seine; |
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 | 25 |
import com.google.common.collect.ImmutableList;
|
| 26 |
-import com.google.common.collect.ImmutableMap;
|
|
| 27 |
-import java.util.LinkedHashSet;
|
|
| 28 | 26 |
import java.util.LinkedList;
|
| 29 | 27 |
import java.util.List;
|
| 30 | 28 |
import java.util.Objects;
|
| 31 |
-import java.util.Set;
|
|
| 32 |
-import java.util.TreeMap;
|
|
| 33 |
-import java.util.stream.Collectors;
|
|
| 34 | 29 |
|
| 35 | 30 |
/**
|
| 36 | 31 |
* Created by tchemit on 02/08/17.
|
| ... | ... | @@ -39,64 +34,14 @@ import java.util.stream.Collectors; |
| 39 | 34 |
*/
|
| 40 | 35 |
public class SimplifiedObjectTypeNode {
|
| 41 | 36 |
|
| 42 |
- static ImmutableMap<String, SimplifiedObjectTypeNode> create(List<ObjectMaterial> materials) {
|
|
| 43 |
- TreeMap<String, SimplifiedObjectTypeNode> mappingBuilder = new TreeMap<>();
|
|
| 44 |
- |
|
| 45 |
- Set<ObjectMaterial> materialsDone = new LinkedHashSet<>();
|
|
| 46 |
- Set<ObjectMaterial> materialsTodo = new LinkedHashSet<>(materials);
|
|
| 47 |
- |
|
| 48 |
- while (!materialsTodo.isEmpty()) {
|
|
| 49 |
- |
|
| 50 |
- Set<ObjectMaterial> currentRoundMaterials;
|
|
| 51 |
- if (materialsDone.isEmpty()) {
|
|
| 52 |
- |
|
| 53 |
- // first round
|
|
| 54 |
- currentRoundMaterials = materialsTodo.stream().filter(f -> f.getParent() == null).collect(Collectors.toSet());
|
|
| 55 |
- |
|
| 56 |
- } else {
|
|
| 57 |
- currentRoundMaterials = materialsTodo.stream().filter(f -> materialsDone.contains(f.getParent())).collect(Collectors.toSet());
|
|
| 58 |
- }
|
|
| 59 |
- |
|
| 60 |
- materialsDone.addAll(currentRoundMaterials);
|
|
| 61 |
- materialsTodo.removeAll(currentRoundMaterials);
|
|
| 62 |
- |
|
| 63 |
- for (ObjectMaterial currentRoundMaterial : currentRoundMaterials) {
|
|
| 64 |
- |
|
| 65 |
- ObjectMaterial simplifiedObjectMaterial = currentRoundMaterial.getSimplifiedObjectMaterial();
|
|
| 66 |
- |
|
| 67 |
- SimplifiedObjectTypeNode node;
|
|
| 68 |
- if (Objects.equals(currentRoundMaterial, simplifiedObjectMaterial)) {
|
|
| 69 |
- |
|
| 70 |
- // new node
|
|
| 71 |
- ObjectMaterial simplifiedParentObjectMaterial = currentRoundMaterial.getSimplifiedParentObjectMaterial();
|
|
| 72 |
- SimplifiedObjectTypeNode parentNode = simplifiedParentObjectMaterial == null ? null : mappingBuilder.get(simplifiedParentObjectMaterial.getTopiaId());
|
|
| 73 |
- node = new SimplifiedObjectTypeNode(currentRoundMaterial, parentNode);
|
|
| 74 |
- |
|
| 75 |
- } else {
|
|
| 76 |
- |
|
| 77 |
- // simplified object material is a parent, so must have been process in previous round
|
|
| 78 |
- Objects.requireNonNull(simplifiedObjectMaterial);
|
|
| 79 |
- |
|
| 80 |
- node = mappingBuilder.get(simplifiedObjectMaterial.getTopiaId());
|
|
| 81 |
- Objects.requireNonNull(node);
|
|
| 82 |
- |
|
| 83 |
- }
|
|
| 84 |
- |
|
| 85 |
- mappingBuilder.put(currentRoundMaterial.getTopiaId(), node);
|
|
| 86 |
- |
|
| 87 |
- }
|
|
| 88 |
- }
|
|
| 89 |
- return ImmutableMap.copyOf(mappingBuilder);
|
|
| 90 |
- }
|
|
| 91 |
- |
|
| 92 | 37 |
private final int level;
|
| 93 | 38 |
private final String id;
|
| 94 | 39 |
private final String standardCode;
|
| 95 | 40 |
private final SimplifiedObjectTypeNode parent;
|
| 96 | 41 |
|
| 97 |
- private SimplifiedObjectTypeNode(ObjectMaterial material, SimplifiedObjectTypeNode parent) {
|
|
| 98 |
- this.id = material.getTopiaId();
|
|
| 99 |
- this.standardCode = material.getStandardCode();
|
|
| 42 |
+ public SimplifiedObjectTypeNode(String id, String standardCode, SimplifiedObjectTypeNode parent) {
|
|
| 43 |
+ this.id = id;
|
|
| 44 |
+ this.standardCode = standardCode;
|
|
| 100 | 45 |
this.parent = parent;
|
| 101 | 46 |
this.level = (parent == null ? 0 : 1 + parent.getLevel());
|
| 102 | 47 |
}
|
| 1 |
-package fr.ird.observe.services.service.actions.consolidate;
|
|
| 1 |
+package fr.ird.observe.services.service.actions.consolidate.set;
|
|
| 2 | 2 |
|
| 3 | 3 |
/*
|
| 4 | 4 |
* #%L
|
| ... | ... | @@ -25,6 +25,7 @@ package fr.ird.observe.services.service.actions.consolidate; |
| 25 | 25 |
import com.google.common.collect.ImmutableSet;
|
| 26 | 26 |
import fr.ird.observe.common.constants.seine.SchoolType;
|
| 27 | 27 |
import fr.ird.observe.services.dto.ObserveDto;
|
| 28 |
+import fr.ird.observe.services.service.actions.consolidate.dcp.FloatingObjectModification;
|
|
| 28 | 29 |
import java.io.Serializable;
|
| 29 | 30 |
|
| 30 | 31 |
/**
|
| ... | ... | @@ -77,7 +78,7 @@ public class ConsolidateActivitySeineDataResult implements Serializable, Observe |
| 77 | 78 |
/**
|
| 78 | 79 |
* L'ensemble des modifications sur les objets flottants.
|
| 79 | 80 |
*/
|
| 80 |
- private ImmutableSet<DcpModification> dcpModifications;
|
|
| 81 |
+ private ImmutableSet<FloatingObjectModification> floatingObjectModifications;
|
|
| 81 | 82 |
private SchoolType oldSchoolType;
|
| 82 | 83 |
private SchoolType newSchoolType;
|
| 83 | 84 |
|
| ... | ... | @@ -101,8 +102,8 @@ public class ConsolidateActivitySeineDataResult implements Serializable, Observe |
| 101 | 102 |
return nonTargetCatchModifications;
|
| 102 | 103 |
}
|
| 103 | 104 |
|
| 104 |
- public ImmutableSet<DcpModification> getDcpModifications() {
|
|
| 105 |
- return dcpModifications;
|
|
| 105 |
+ public ImmutableSet<FloatingObjectModification> getFloatingObjectModifications() {
|
|
| 106 |
+ return floatingObjectModifications;
|
|
| 106 | 107 |
}
|
| 107 | 108 |
|
| 108 | 109 |
public SchoolType getOldSchoolType() {
|
| ... | ... | @@ -113,186 +114,6 @@ public class ConsolidateActivitySeineDataResult implements Serializable, Observe |
| 113 | 114 |
return newSchoolType;
|
| 114 | 115 |
}
|
| 115 | 116 |
|
| 116 |
- public static class TargetLengthModification implements Serializable {
|
|
| 117 |
- |
|
| 118 |
- private static final long serialVersionUID = 1L;
|
|
| 119 |
- |
|
| 120 |
- String targetLengthId;
|
|
| 121 |
- |
|
| 122 |
- protected String speciesLabel;
|
|
| 123 |
- |
|
| 124 |
- protected String propertyName;
|
|
| 125 |
- |
|
| 126 |
- protected Float newValue;
|
|
| 127 |
- |
|
| 128 |
- public String getTargetLengthId() {
|
|
| 129 |
- return targetLengthId;
|
|
| 130 |
- }
|
|
| 131 |
- |
|
| 132 |
- public String getSpeciesLabel() {
|
|
| 133 |
- return speciesLabel;
|
|
| 134 |
- }
|
|
| 135 |
- |
|
| 136 |
- public String getPropertyName() {
|
|
| 137 |
- return propertyName;
|
|
| 138 |
- }
|
|
| 139 |
- |
|
| 140 |
- public Float getNewValue() {
|
|
| 141 |
- return newValue;
|
|
| 142 |
- }
|
|
| 143 |
- |
|
| 144 |
- public void setTargetLengthId(String targetLengthId) {
|
|
| 145 |
- this.targetLengthId = targetLengthId;
|
|
| 146 |
- }
|
|
| 147 |
- |
|
| 148 |
- public void setSpeciesLabel(String speciesLabel) {
|
|
| 149 |
- this.speciesLabel = speciesLabel;
|
|
| 150 |
- }
|
|
| 151 |
- |
|
| 152 |
- public void setPropertyName(String propertyName) {
|
|
| 153 |
- this.propertyName = propertyName;
|
|
| 154 |
- }
|
|
| 155 |
- |
|
| 156 |
- public void setNewValue(Float newValue) {
|
|
| 157 |
- this.newValue = newValue;
|
|
| 158 |
- }
|
|
| 159 |
- }
|
|
| 160 |
- |
|
| 161 |
- public static class NonTargetLengthModification implements Serializable {
|
|
| 162 |
- |
|
| 163 |
- private static final long serialVersionUID = 1L;
|
|
| 164 |
- |
|
| 165 |
- String nonTargetLengthId;
|
|
| 166 |
- |
|
| 167 |
- protected String speciesLabel;
|
|
| 168 |
- |
|
| 169 |
- protected String propertyName;
|
|
| 170 |
- |
|
| 171 |
- protected Float newValue;
|
|
| 172 |
- |
|
| 173 |
- public String getNonTargetLengthId() {
|
|
| 174 |
- return nonTargetLengthId;
|
|
| 175 |
- }
|
|
| 176 |
- |
|
| 177 |
- public String getSpeciesLabel() {
|
|
| 178 |
- return speciesLabel;
|
|
| 179 |
- }
|
|
| 180 |
- |
|
| 181 |
- public String getPropertyName() {
|
|
| 182 |
- return propertyName;
|
|
| 183 |
- }
|
|
| 184 |
- |
|
| 185 |
- public Float getNewValue() {
|
|
| 186 |
- return newValue;
|
|
| 187 |
- }
|
|
| 188 |
- |
|
| 189 |
- public void setNonTargetLengthId(String nonTargetLengthId) {
|
|
| 190 |
- this.nonTargetLengthId = nonTargetLengthId;
|
|
| 191 |
- }
|
|
| 192 |
- |
|
| 193 |
- public void setSpeciesLabel(String speciesLabel) {
|
|
| 194 |
- this.speciesLabel = speciesLabel;
|
|
| 195 |
- }
|
|
| 196 |
- |
|
| 197 |
- public void setPropertyName(String propertyName) {
|
|
| 198 |
- this.propertyName = propertyName;
|
|
| 199 |
- }
|
|
| 200 |
- |
|
| 201 |
- public void setNewValue(Float newValue) {
|
|
| 202 |
- this.newValue = newValue;
|
|
| 203 |
- }
|
|
| 204 |
- }
|
|
| 205 |
- |
|
| 206 |
- public static class NonTargetCatchModification implements Serializable {
|
|
| 207 |
- |
|
| 208 |
- private static final long serialVersionUID = 1L;
|
|
| 209 |
- |
|
| 210 |
- String nonTargetCatchId;
|
|
| 211 |
- |
|
| 212 |
- protected String speciesLabel;
|
|
| 213 |
- |
|
| 214 |
- protected String propertyName;
|
|
| 215 |
- |
|
| 216 |
- protected Number newValue;
|
|
| 217 |
- |
|
| 218 |
- public String getNonTargetCatchId() {
|
|
| 219 |
- return nonTargetCatchId;
|
|
| 220 |
- }
|
|
| 221 |
- |
|
| 222 |
- public String getSpeciesLabel() {
|
|
| 223 |
- return speciesLabel;
|
|
| 224 |
- }
|
|
| 225 |
- |
|
| 226 |
- public String getPropertyName() {
|
|
| 227 |
- return propertyName;
|
|
| 228 |
- }
|
|
| 229 |
- |
|
| 230 |
- public Number getNewValue() {
|
|
| 231 |
- return newValue;
|
|
| 232 |
- }
|
|
| 233 |
- |
|
| 234 |
- public void setNonTargetCatchId(String nonTargetCatchId) {
|
|
| 235 |
- this.nonTargetCatchId = nonTargetCatchId;
|
|
| 236 |
- }
|
|
| 237 |
- |
|
| 238 |
- public void setSpeciesLabel(String speciesLabel) {
|
|
| 239 |
- this.speciesLabel = speciesLabel;
|
|
| 240 |
- }
|
|
| 241 |
- |
|
| 242 |
- public void setPropertyName(String propertyName) {
|
|
| 243 |
- this.propertyName = propertyName;
|
|
| 244 |
- }
|
|
| 245 |
- |
|
| 246 |
- public void setNewValue(Number newValue) {
|
|
| 247 |
- this.newValue = newValue;
|
|
| 248 |
- }
|
|
| 249 |
- }
|
|
| 250 |
- |
|
| 251 |
- public static class DcpModification implements Serializable {
|
|
| 252 |
- |
|
| 253 |
- private static final long serialVersionUID = 1L;
|
|
| 254 |
- |
|
| 255 |
- String dcpId;
|
|
| 256 |
- |
|
| 257 |
- protected String dcpLabel;
|
|
| 258 |
- |
|
| 259 |
- protected String propertyName;
|
|
| 260 |
- |
|
| 261 |
- protected Serializable newValue;
|
|
| 262 |
- |
|
| 263 |
- public String getDcpId() {
|
|
| 264 |
- return dcpId;
|
|
| 265 |
- }
|
|
| 266 |
- |
|
| 267 |
- public String getDcpLabel() {
|
|
| 268 |
- return dcpLabel;
|
|
| 269 |
- }
|
|
| 270 |
- |
|
| 271 |
- public String getPropertyName() {
|
|
| 272 |
- return propertyName;
|
|
| 273 |
- }
|
|
| 274 |
- |
|
| 275 |
- public Serializable getNewValue() {
|
|
| 276 |
- return newValue;
|
|
| 277 |
- }
|
|
| 278 |
- |
|
| 279 |
- public void setDcpId(String dcpId) {
|
|
| 280 |
- this.dcpId = dcpId;
|
|
| 281 |
- }
|
|
| 282 |
- |
|
| 283 |
- public void setDcpLabel(String dcpLabel) {
|
|
| 284 |
- this.dcpLabel = dcpLabel;
|
|
| 285 |
- }
|
|
| 286 |
- |
|
| 287 |
- public void setPropertyName(String propertyName) {
|
|
| 288 |
- this.propertyName = propertyName;
|
|
| 289 |
- }
|
|
| 290 |
- |
|
| 291 |
- public void setNewValue(Serializable newValue) {
|
|
| 292 |
- this.newValue = newValue;
|
|
| 293 |
- }
|
|
| 294 |
- }
|
|
| 295 |
- |
|
| 296 | 117 |
public void setActivitySeineId(String activitySeineId) {
|
| 297 | 118 |
this.activitySeineId = activitySeineId;
|
| 298 | 119 |
}
|
| ... | ... | @@ -318,7 +139,7 @@ public class ConsolidateActivitySeineDataResult implements Serializable, Observe |
| 318 | 139 |
this.nonTargetCatchModifications = nonTargetCatchModifications;
|
| 319 | 140 |
}
|
| 320 | 141 |
|
| 321 |
- public void setDcpModifications(ImmutableSet<DcpModification> dcpModifications) {
|
|
| 322 |
- this.dcpModifications = dcpModifications;
|
|
| 142 |
+ public void setFloatingObjectModifications(ImmutableSet<FloatingObjectModification> floatingObjectModifications) {
|
|
| 143 |
+ this.floatingObjectModifications = floatingObjectModifications;
|
|
| 323 | 144 |
}
|
| 324 | 145 |
}
|
| 1 |
+package fr.ird.observe.services.service.actions.consolidate.set;
|
|
| 2 |
+ |
|
| 3 |
+import java.io.Serializable;
|
|
| 4 |
+ |
|
| 5 |
+/**
|
|
| 6 |
+ * Created by tchemit on 04/08/17.
|
|
| 7 |
+ *
|
|
| 8 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 9 |
+ */
|
|
| 10 |
+public class NonTargetCatchModification implements Serializable {
|
|
| 11 |
+ |
|
| 12 |
+ private static final long serialVersionUID = 1L;
|
|
| 13 |
+ |
|
| 14 |
+ String nonTargetCatchId;
|
|
| 15 |
+ |
|
| 16 |
+ protected String speciesLabel;
|
|
| 17 |
+ |
|
| 18 |
+ protected String propertyName;
|
|
| 19 |
+ |
|
| 20 |
+ protected Number newValue;
|
|
| 21 |
+ |
|
| 22 |
+ public String getNonTargetCatchId() {
|
|
| 23 |
+ return nonTargetCatchId;
|
|
| 24 |
+ }
|
|
| 25 |
+ |
|
| 26 |
+ public String getSpeciesLabel() {
|
|
| 27 |
+ return speciesLabel;
|
|
| 28 |
+ }
|
|
| 29 |
+ |
|
| 30 |
+ public String getPropertyName() {
|
|
| 31 |
+ return propertyName;
|
|
| 32 |
+ }
|
|
| 33 |
+ |
|
| 34 |
+ public Number getNewValue() {
|
|
| 35 |
+ return newValue;
|
|
| 36 |
+ }
|
|
| 37 |
+ |
|
| 38 |
+ public void setNonTargetCatchId(String nonTargetCatchId) {
|
|
| 39 |
+ this.nonTargetCatchId = nonTargetCatchId;
|
|
| 40 |
+ }
|
|
| 41 |
+ |
|
| 42 |
+ public void setSpeciesLabel(String speciesLabel) {
|
|
| 43 |
+ this.speciesLabel = speciesLabel;
|
|
| 44 |
+ }
|
|
| 45 |
+ |
|
| 46 |
+ public void setPropertyName(String propertyName) {
|
|
| 47 |
+ this.propertyName = propertyName;
|
|
| 48 |
+ }
|
|
| 49 |
+ |
|
| 50 |
+ public void setNewValue(Number newValue) {
|
|
| 51 |
+ this.newValue = newValue;
|
|
| 52 |
+ }
|
|
| 53 |
+}
|
| 1 |
+package fr.ird.observe.services.service.actions.consolidate.set;
|
|
| 2 |
+ |
|
| 3 |
+import java.io.Serializable;
|
|
| 4 |
+ |
|
| 5 |
+/**
|
|
| 6 |
+ * Created by tchemit on 04/08/17.
|
|
| 7 |
+ *
|
|
| 8 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 9 |
+ */
|
|
| 10 |
+public class NonTargetLengthModification implements Serializable {
|
|
| 11 |
+ |
|
| 12 |
+ private static final long serialVersionUID = 1L;
|
|
| 13 |
+ |
|
| 14 |
+ String nonTargetLengthId;
|
|
| 15 |
+ |
|
| 16 |
+ protected String speciesLabel;
|
|
| 17 |
+ |
|
| 18 |
+ protected String propertyName;
|
|
| 19 |
+ |
|
| 20 |
+ protected Float newValue;
|
|
| 21 |
+ |
|
| 22 |
+ public String getNonTargetLengthId() {
|
|
| 23 |
+ return nonTargetLengthId;
|
|
| 24 |
+ }
|
|
| 25 |
+ |
|
| 26 |
+ public String getSpeciesLabel() {
|
|
| 27 |
+ return speciesLabel;
|
|
| 28 |
+ }
|
|
| 29 |
+ |
|
| 30 |
+ public String getPropertyName() {
|
|
| 31 |
+ return propertyName;
|
|
| 32 |
+ }
|
|
| 33 |
+ |
|
| 34 |
+ public Float getNewValue() {
|
|
| 35 |
+ return newValue;
|
|
| 36 |
+ }
|
|
| 37 |
+ |
|
| 38 |
+ public void setNonTargetLengthId(String nonTargetLengthId) {
|
|
| 39 |
+ this.nonTargetLengthId = nonTargetLengthId;
|
|
| 40 |
+ }
|
|
| 41 |
+ |
|
| 42 |
+ public void setSpeciesLabel(String speciesLabel) {
|
|
| 43 |
+ this.speciesLabel = speciesLabel;
|
|
| 44 |
+ }
|
|
| 45 |
+ |
|
| 46 |
+ public void setPropertyName(String propertyName) {
|
|
| 47 |
+ this.propertyName = propertyName;
|
|
| 48 |
+ }
|
|
| 49 |
+ |
|
| 50 |
+ public void setNewValue(Float newValue) {
|
|
| 51 |
+ this.newValue = newValue;
|
|
| 52 |
+ }
|
|
| 53 |
+}
|
| 1 |
+package fr.ird.observe.services.service.actions.consolidate.set;
|
|
| 2 |
+ |
|
| 3 |
+import java.io.Serializable;
|
|
| 4 |
+ |
|
| 5 |
+/**
|
|
| 6 |
+ * Created by tchemit on 04/08/17.
|
|
| 7 |
+ *
|
|
| 8 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 9 |
+ */
|
|
| 10 |
+public class TargetLengthModification implements Serializable {
|
|
| 11 |
+ |
|
| 12 |
+ private static final long serialVersionUID = 1L;
|
|
| 13 |
+ |
|
| 14 |
+ private String targetLengthId;
|
|
| 15 |
+ |
|
| 16 |
+ protected String speciesLabel;
|
|
| 17 |
+ |
|
| 18 |
+ protected String propertyName;
|
|
| 19 |
+ |
|
| 20 |
+ protected Float newValue;
|
|
| 21 |
+ |
|
| 22 |
+ public String getTargetLengthId() {
|
|
| 23 |
+ return targetLengthId;
|
|
| 24 |
+ }
|
|
| 25 |
+ |
|
| 26 |
+ public String getSpeciesLabel() {
|
|
| 27 |
+ return speciesLabel;
|
|
| 28 |
+ }
|
|
| 29 |
+ |
|
| 30 |
+ public String getPropertyName() {
|
|
| 31 |
+ return propertyName;
|
|
| 32 |
+ }
|
|
| 33 |
+ |
|
| 34 |
+ public Float getNewValue() {
|
|
| 35 |
+ return newValue;
|
|
| 36 |
+ }
|
|
| 37 |
+ |
|
| 38 |
+ public void setTargetLengthId(String targetLengthId) {
|
|
| 39 |
+ this.targetLengthId = targetLengthId;
|
|
| 40 |
+ }
|
|
| 41 |
+ |
|
| 42 |
+ public void setSpeciesLabel(String speciesLabel) {
|
|
| 43 |
+ this.speciesLabel = speciesLabel;
|
|
| 44 |
+ }
|
|
| 45 |
+ |
|
| 46 |
+ public void setPropertyName(String propertyName) {
|
|
| 47 |
+ this.propertyName = propertyName;
|
|
| 48 |
+ }
|
|
| 49 |
+ |
|
| 50 |
+ public void setNewValue(Float newValue) {
|
|
| 51 |
+ this.newValue = newValue;
|
|
| 52 |
+ }
|
|
| 53 |
+}
|