Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 7ac51b1a by Tony CHEMIT at 2017-08-04T00:01:05+02:00 Caractéristiques calculées des objets FOB (See #820) - - - - - 14 changed files: - client/src/main/java/fr/ird/observe/client/ui/content/impl/seine/FloatingObjectUI.jaxx - client/src/main/java/fr/ird/observe/client/ui/content/impl/seine/FloatingObjectUI.jcss - client/src/main/java/fr/ird/observe/client/ui/content/impl/seine/FloatingObjectUIModel.java - persistence/src/main/models/Observe.model - persistence/src/main/resources/db/migration/6.901/08_add_floating_object_fields-common.sql - services-topia/src/main/java/fr/ird/observe/services/binder/data/seine/FloatingObjectBinder.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/src/main/models/Observe.model - test/src/main/resources/db/6.902/dataForTestLongline.sql.gz - test/src/main/resources/db/6.902/dataForTestSeine.sql.gz - test/src/main/resources/db/6.902/empty_h2.sql.gz - test/src/main/resources/db/6.902/empty_pg.sql.gz - test/src/main/resources/db/6.902/referentiel.sql.gz Changes: ===================================== client/src/main/java/fr/ird/observe/client/ui/content/impl/seine/FloatingObjectUI.jaxx ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/content/impl/seine/FloatingObjectUI.jaxx +++ b/client/src/main/java/fr/ird/observe/client/ui/content/impl/seine/FloatingObjectUI.jaxx @@ -112,26 +112,46 @@ <Table id="computedPanel" fill="both" weightx="1"> <row> <cell anchor="west"> + <JLabel/> + </cell> + <cell weightx="0.5" fill="both"> + <JLabel text="observe.common.whenArriving"/> + </cell> + <cell weightx="0.5" fill="both"> + <JLabel text="observe.common.whenLeaving"/> + </cell> + </row> + <row> + <cell anchor="west"> <JLabel id='computedBiodegradableLabel'/> </cell> - <cell anchor='east' weightx="1" fill="both"> - <JLabel id='computedBiodegradable'/> + <cell weightx="0.5" fill="both"> + <JLabel id='computedWhenArrivingBiodegradable'/> + </cell> + <cell weightx="0.5" fill="both"> + <JLabel id='computedWhenLeavingBiodegradable'/> </cell> </row> <row> <cell anchor="west"> <JLabel id='computedNonEntanglingLabel'/> </cell> - <cell anchor='east' weightx="1" fill="both"> - <JLabel id='computedNonEntangling'/> + <cell weightx="0.5" fill="both"> + <JLabel id='computedWhenArrivingNonEntangling'/> + </cell> + <cell weightx="0.5" fill="both"> + <JLabel id='computedWhenLeavingNonEntangling'/> </cell> </row> <row> <cell anchor="west"> <JLabel id='computedSimplifiedObjectTypeLabel'/> </cell> - <cell anchor='east' weightx="1" fill="both"> - <JLabel id='computedSimplifiedObjectType'/> + <cell weightx="0.5" fill="both"> + <JLabel id='computedWhenArrivingSimplifiedObjectType'/> + </cell> + <cell weightx="0.5" fill="both"> + <JLabel id='computedWhenLeavingSimplifiedObjectType'/> </cell> </row> </Table> ===================================== client/src/main/java/fr/ird/observe/client/ui/content/impl/seine/FloatingObjectUI.jcss ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/content/impl/seine/FloatingObjectUI.jcss +++ b/client/src/main/java/fr/ird/observe/client/ui/content/impl/seine/FloatingObjectUI.jcss @@ -75,31 +75,43 @@ BeanComboBox { } #computedBiodegradableLabel { text:"observe.common.computedBiodegradable"; - labelFor:{computedBiodegradable}; } -#computedBiodegradable { - text:{model.getComputedBiodegradableValue()}; +#computedNonEntanglingLabel { + text:"observe.common.computedNonEntangling"; +} + +#computedSimplifiedObjectTypeLabel { + text:"observe.common.computedSimplifiedObjectType"; +} + +#computedWhenArrivingBiodegradable { + text:{model.getComputedWhenArrivingBiodegradableValue()}; font-weight:bold; } -#computedNonEntanglingLabel { - text:"observe.common.computedNonEntangling"; - labelFor:{computedNonEntangling}; +#computedWhenArrivingNonEntangling { + text:{model.getComputedWhenArrivingNonEntanglingValue()}; + font-weight:bold; } -#computedNonEntangling { - text:{model.getComputedNonEntanglingValue()}; +#computedWhenArrivingSimplifiedObjectType { + text:{model.getComputedWhenArrivingSimplifiedObjectTypeValue()}; font-weight:bold; } -#computedSimplifiedObjectTypeLabel { - text:"observe.common.computedSimplifiedObjectType"; - labelFor:{computedSimplifiedObjectType}; +#computedWhenLeavingBiodegradable { + text:{model.getComputedWhenLeavingBiodegradableValue()}; + font-weight:bold; +} + +#computedWhenLeavingNonEntangling { + text:{model.getComputedWhenLeavingNonEntanglingValue()}; + font-weight:bold; } -#computedSimplifiedObjectType { - text:{model.getComputedSimplifiedObjectTypeValue()}; +#computedWhenLeavingSimplifiedObjectType { + text:{model.getComputedWhenLeavingSimplifiedObjectTypeValue()}; font-weight:bold; } ===================================== client/src/main/java/fr/ird/observe/client/ui/content/impl/seine/FloatingObjectUIModel.java ===================================== --- a/client/src/main/java/fr/ird/observe/client/ui/content/impl/seine/FloatingObjectUIModel.java +++ b/client/src/main/java/fr/ird/observe/client/ui/content/impl/seine/FloatingObjectUIModel.java @@ -116,7 +116,6 @@ public class FloatingObjectUIModel extends ContentUIModel<FloatingObjectDto> { firePropertyChange(PROPERTY_GENERAL_TAB_VALID, oldValue, generalTabValid); } - ImmutableSet<FloatingObjectPartDto> toParts() { ImmutableSet.Builder<FloatingObjectPartDto> result = ImmutableSet.builder(); for (ObjectMaterialDto o : getAll()) { @@ -136,9 +135,12 @@ public class FloatingObjectUIModel extends ContentUIModel<FloatingObjectDto> { public void reset() { whenArriving.clear(); whenLeaving.clear(); - firePropertyChange("computedBiodegradableValue", getComputedBiodegradableValue()); - firePropertyChange("computedNonEntanglingValue", getComputedNonEntanglingValue()); - firePropertyChange("computedSimplifiedObjectTypeValue", getComputedSimplifiedObjectTypeValue()); + firePropertyChange("computedWhenArrivingBiodegradableValue", getComputedWhenArrivingBiodegradableValue()); + firePropertyChange("computedWhenArrivingNonEntanglingValue", getComputedWhenArrivingNonEntanglingValue()); + firePropertyChange("computedWhenArrivingSimplifiedObjectTypeValue", getComputedWhenArrivingSimplifiedObjectTypeValue()); + firePropertyChange("computedWhenLeavingBiodegradableValue", getComputedWhenLeavingBiodegradableValue()); + firePropertyChange("computedWhenLeavingNonEntanglingValue", getComputedWhenLeavingNonEntanglingValue()); + firePropertyChange("computedWhenLeavingSimplifiedObjectTypeValue", getComputedWhenLeavingSimplifiedObjectTypeValue()); } public Map<ObjectMaterialDto, String> getWhenArriving() { @@ -192,23 +194,40 @@ public class FloatingObjectUIModel extends ContentUIModel<FloatingObjectDto> { firePropertyChange(PROPERTY_REFERENCE, null, reference); } - public String getComputedBiodegradableValue() { - return booleanValue(bean.getComputedBiodegradable()); + public String getComputedWhenArrivingBiodegradableValue() { + return booleanValue(bean.getComputedWhenArrivingBiodegradable()); + } + + public String getComputedWhenArrivingNonEntanglingValue() { + return booleanValue(bean.getComputedWhenArrivingNonEntangling()); + } + + public String getComputedWhenArrivingSimplifiedObjectTypeValue() { + String computedSimplifiedObjectType = bean.getComputedWhenArrivingSimplifiedObjectType(); + return stringValue(computedSimplifiedObjectType); } - public String getComputedNonEntanglingValue() { - return booleanValue(bean.getComputedNonEntangling()); + public String getComputedWhenLeavingBiodegradableValue() { + return booleanValue(bean.getComputedWhenLeavingBiodegradable()); } - public String getComputedSimplifiedObjectTypeValue() { - String computedSimplifiedObjectType = bean.getComputedSimplifiedObjectType(); - return computedSimplifiedObjectType == null ? t("observe.common.notComputed") : computedSimplifiedObjectType; + public String getComputedWhenLeavingNonEntanglingValue() { + return booleanValue(bean.getComputedWhenLeavingNonEntangling()); + } + + public String getComputedWhenLeavingSimplifiedObjectTypeValue() { + String computedSimplifiedObjectType = bean.getComputedWhenLeavingSimplifiedObjectType(); + return stringValue(computedSimplifiedObjectType); } private String booleanValue(DcpComputedValue value) { return value == null ? t("observe.common.notComputed") : I18nEnumHelper.getLabel(value); } + private String stringValue(String value) { + return value == null ? t("observe.common.notComputed") : value; + } + public boolean isArriving() { return arriving; } ===================================== persistence/src/main/models/Observe.model ===================================== --- a/persistence/src/main/models/Observe.model +++ b/persistence/src/main/models/Observe.model @@ -732,9 +732,12 @@ objectOperation {*:1} referentiel.seine.ObjectOperation supportVesselName + {*:1} String transmittingBuoy + {*} seine.TransmittingBuoy | unique floatingObjectPart + {*} seine.FloatingObjectPart | unique -computedBiodegradable + {*:1} !fr.ird.observe.common.constants.seine.DcpComputedValue | useEnumerationName -computedNonEntangling + {*:1} !fr.ird.observe.common.constants.seine.DcpComputedValue | useEnumerationName -computedSimplifiedObjectType + {*:1} String +computedWhenArrivingBiodegradable + {*:1} !fr.ird.observe.common.constants.seine.DcpComputedValue | useEnumerationName +computedWhenArrivingNonEntangling + {*:1} !fr.ird.observe.common.constants.seine.DcpComputedValue | useEnumerationName +computedWhenArrivingSimplifiedObjectType + {*:1} String +computedWhenLeavingBiodegradable + {*:1} !fr.ird.observe.common.constants.seine.DcpComputedValue | useEnumerationName +computedWhenLeavingNonEntangling + {*:1} !fr.ird.observe.common.constants.seine.DcpComputedValue | useEnumerationName +computedWhenLeavingSimplifiedObjectType + {*:1} String getTypeTransmittingBuoyOperation() !fr.ird.observe.common.constants.seine.TypeTransmittingBuoyOperation seine.FloatingObjectPart > ObserveDataEntity | entity ===================================== persistence/src/main/resources/db/migration/6.901/08_add_floating_object_fields-common.sql ===================================== --- a/persistence/src/main/resources/db/migration/6.901/08_add_floating_object_fields-common.sql +++ b/persistence/src/main/resources/db/migration/6.901/08_add_floating_object_fields-common.sql @@ -19,6 +19,9 @@ -- <http://www.gnu.org/licenses/gpl-3.0.html>. -- #L% --- -ALTER TABLE observe_seine.FloatingObject ADD COLUMN computedBiodegradable VARCHAR(255); -ALTER TABLE observe_seine.FloatingObject ADD COLUMN computedNonEntangling VARCHAR(255); -ALTER TABLE observe_seine.FloatingObject ADD COLUMN computedSimplifiedObjectType VARCHAR(255); +ALTER TABLE observe_seine.FloatingObject ADD COLUMN computedWhenArrivingBiodegradable VARCHAR(255); +ALTER TABLE observe_seine.FloatingObject ADD COLUMN computedWhenArrivingNonEntangling VARCHAR(255); +ALTER TABLE observe_seine.FloatingObject ADD COLUMN computedWhenArrivingSimplifiedObjectType VARCHAR(255); +ALTER TABLE observe_seine.FloatingObject ADD COLUMN computedWhenLeavingBiodegradable VARCHAR(255); +ALTER TABLE observe_seine.FloatingObject ADD COLUMN computedWhenLeavingNonEntangling VARCHAR(255); +ALTER TABLE observe_seine.FloatingObject ADD COLUMN computedWhenLeavingSimplifiedObjectType VARCHAR(255); ===================================== services-topia/src/main/java/fr/ird/observe/services/binder/data/seine/FloatingObjectBinder.java ===================================== --- a/services-topia/src/main/java/fr/ird/observe/services/binder/data/seine/FloatingObjectBinder.java +++ b/services-topia/src/main/java/fr/ird/observe/services/binder/data/seine/FloatingObjectBinder.java @@ -48,9 +48,12 @@ public class FloatingObjectBinder extends DataBinderSupport<FloatingObject, Floa entity.setObjectOperation(toEntity(dto.getObjectOperation(), ObjectOperation.class)); entity.setSupportVesselName(dto.getSupportVesselName()); - entity.setComputedBiodegradable(dto.getComputedBiodegradable()); - entity.setComputedNonEntangling(dto.getComputedNonEntangling()); - entity.setComputedSimplifiedObjectType(dto.getComputedSimplifiedObjectType()); + entity.setComputedWhenArrivingBiodegradable(dto.getComputedWhenArrivingBiodegradable()); + entity.setComputedWhenArrivingNonEntangling(dto.getComputedWhenArrivingNonEntangling()); + entity.setComputedWhenArrivingSimplifiedObjectType(dto.getComputedWhenArrivingSimplifiedObjectType()); + entity.setComputedWhenLeavingBiodegradable(dto.getComputedWhenLeavingBiodegradable()); + entity.setComputedWhenLeavingNonEntangling(dto.getComputedWhenLeavingNonEntangling()); + entity.setComputedWhenLeavingSimplifiedObjectType(dto.getComputedWhenLeavingSimplifiedObjectType()); } @@ -61,9 +64,12 @@ public class FloatingObjectBinder extends DataBinderSupport<FloatingObject, Floa dto.setObjectOperation(toReferentialReference(referentialLocale, entity.getObjectOperation(), ObjectOperationDto.class)); dto.setSupportVesselName(entity.getSupportVesselName()); - dto.setComputedBiodegradable(entity.getComputedBiodegradable()); - dto.setComputedNonEntangling(entity.getComputedNonEntangling()); - dto.setComputedSimplifiedObjectType(entity.getComputedSimplifiedObjectType()); + dto.setComputedWhenArrivingBiodegradable(entity.getComputedWhenArrivingBiodegradable()); + dto.setComputedWhenArrivingNonEntangling(entity.getComputedWhenArrivingNonEntangling()); + dto.setComputedWhenArrivingSimplifiedObjectType(entity.getComputedWhenArrivingSimplifiedObjectType()); + dto.setComputedWhenLeavingBiodegradable(entity.getComputedWhenLeavingBiodegradable()); + dto.setComputedWhenLeavingNonEntangling(entity.getComputedWhenLeavingNonEntangling()); + dto.setComputedWhenLeavingSimplifiedObjectType(entity.getComputedWhenLeavingSimplifiedObjectType()); } ===================================== services-topia/src/main/java/fr/ird/observe/services/topia/service/actions/consolidate/ConsolidateActivitySeineDataResultBuilder.java ===================================== --- a/services-topia/src/main/java/fr/ird/observe/services/topia/service/actions/consolidate/ConsolidateActivitySeineDataResultBuilder.java +++ b/services-topia/src/main/java/fr/ird/observe/services/topia/service/actions/consolidate/ConsolidateActivitySeineDataResultBuilder.java @@ -87,35 +87,67 @@ public class ConsolidateActivitySeineDataResultBuilder { String dcpLabel = activitySeine.getVesselActivitySeine().getLabel2() + "[" + activitySeine.getTime() + "]" + " - " + (dcp.getObjectOperation() == null ? "" : dcp.getObjectOperation().getLabel2()); for (String modifiedProperty : propertyNamesModified) { switch (modifiedProperty) { - case FloatingObject.PROPERTY_COMPUTED_BIODEGRADABLE: { + case FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_BIODEGRADABLE: { DcpModification element = new DcpModification(); element.setDcpId(dcp.getTopiaId()); element.setDcpLabel(dcpLabel); - element.setPropertyName(FloatingObject.PROPERTY_COMPUTED_BIODEGRADABLE); - element.setNewValue(dcp.getComputedBiodegradable()); + element.setPropertyName(FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_BIODEGRADABLE); + element.setNewValue(dcp.getComputedWhenArrivingBiodegradable()); dcpModificationBuilder.add(element); break; } - case FloatingObject.PROPERTY_COMPUTED_NON_ENTANGLING: { + case FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_NON_ENTANGLING: { DcpModification element = new DcpModification(); element.setDcpId(dcp.getTopiaId()); element.setDcpLabel(dcpLabel); - element.setPropertyName(FloatingObject.PROPERTY_COMPUTED_NON_ENTANGLING); - element.setNewValue(dcp.getComputedNonEntangling()); + element.setPropertyName(FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_NON_ENTANGLING); + element.setNewValue(dcp.getComputedWhenArrivingNonEntangling()); dcpModificationBuilder.add(element); break; } - case FloatingObject.PROPERTY_COMPUTED_SIMPLIFIED_OBJECT_TYPE: { + case FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_SIMPLIFIED_OBJECT_TYPE: { DcpModification element = new DcpModification(); element.setDcpId(dcp.getTopiaId()); element.setDcpLabel(dcpLabel); - element.setPropertyName(FloatingObject.PROPERTY_COMPUTED_SIMPLIFIED_OBJECT_TYPE); - element.setNewValue(dcp.getComputedSimplifiedObjectType()); + element.setPropertyName(FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_SIMPLIFIED_OBJECT_TYPE); + element.setNewValue(dcp.getComputedWhenArrivingSimplifiedObjectType()); + dcpModificationBuilder.add(element); + break; + } + case FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_BIODEGRADABLE: { + + DcpModification element = new DcpModification(); + element.setDcpId(dcp.getTopiaId()); + element.setDcpLabel(dcpLabel); + element.setPropertyName(FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_BIODEGRADABLE); + element.setNewValue(dcp.getComputedWhenLeavingBiodegradable()); + dcpModificationBuilder.add(element); + + break; + } + case FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_NON_ENTANGLING: { + + DcpModification element = new DcpModification(); + element.setDcpId(dcp.getTopiaId()); + element.setDcpLabel(dcpLabel); + element.setPropertyName(FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_NON_ENTANGLING); + element.setNewValue(dcp.getComputedWhenLeavingNonEntangling()); + dcpModificationBuilder.add(element); + + break; + } + case FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_SIMPLIFIED_OBJECT_TYPE: { + + DcpModification element = new DcpModification(); + element.setDcpId(dcp.getTopiaId()); + element.setDcpLabel(dcpLabel); + element.setPropertyName(FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_SIMPLIFIED_OBJECT_TYPE); + element.setNewValue(dcp.getComputedWhenLeavingSimplifiedObjectType()); dcpModificationBuilder.add(element); break; } ===================================== services-topia/src/main/java/fr/ird/observe/services/topia/service/actions/consolidate/ConsolidateDataServiceTopia.java ===================================== --- a/services-topia/src/main/java/fr/ird/observe/services/topia/service/actions/consolidate/ConsolidateDataServiceTopia.java +++ b/services-topia/src/main/java/fr/ird/observe/services/topia/service/actions/consolidate/ConsolidateDataServiceTopia.java @@ -113,9 +113,12 @@ public class ConsolidateDataServiceTopia extends ObserveServiceTopia implements ); BeanMonitor dcpMonitor = new BeanMonitor( - FloatingObject.PROPERTY_COMPUTED_BIODEGRADABLE, - FloatingObject.PROPERTY_COMPUTED_NON_ENTANGLING, - FloatingObject.PROPERTY_COMPUTED_SIMPLIFIED_OBJECT_TYPE + FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_BIODEGRADABLE, + FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_NON_ENTANGLING, + FloatingObject.PROPERTY_COMPUTED_WHEN_ARRIVING_SIMPLIFIED_OBJECT_TYPE, + FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_BIODEGRADABLE, + FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_NON_ENTANGLING, + FloatingObject.PROPERTY_COMPUTED_WHEN_LEAVING_SIMPLIFIED_OBJECT_TYPE ); Locale applicationLocale = serviceContext.getApplicationLocale(); @@ -284,46 +287,71 @@ public class ConsolidateDataServiceTopia extends ObserveServiceTopia implements private void updateDcp(FloatingObject dcp, ConsolidationActivitySeineDataContext activityContext) { activityContext.watchDcp(dcp); - computeDcpBiodegradable(dcp); - computeDcpNonEntangling(dcp); - computeDcpSimplifiedObjectType(dcp, activityContext.simplifiedObjectTypeManager); + Set<FloatingObjectPart> whenArriving = dcp.getFloatingObjectPart().stream().filter(p -> p.getWhenArriving() != null).collect(Collectors.toSet()); + Set<FloatingObjectPart> whenLeaving = dcp.getFloatingObjectPart().stream().filter(p -> p.getWhenLeaving() != null).collect(Collectors.toSet()); + computeDcpBiodegradable(dcp, whenArriving, whenLeaving); + computeDcpNonEntangling(dcp, whenArriving, whenLeaving); + computeDcpSimplifiedObjectType(dcp, whenArriving, whenLeaving, activityContext.simplifiedObjectTypeManager); activityContext.flushDcp(); } - private void computeDcpSimplifiedObjectType(FloatingObject dcp, SimplifiedObjectTypeManager simplifiedObjectTypeManager) { - Set<String> objectMaterialIds = dcp.getFloatingObjectPart().stream().map(p -> p.getObjectMaterial().getTopiaId()).collect(Collectors.toSet()); - String value = simplifiedObjectTypeManager.getStandardCode(objectMaterialIds); - dcp.setComputedSimplifiedObjectType(value); + private void computeDcpSimplifiedObjectType(FloatingObject dcp, Set<FloatingObjectPart> whenArriving, Set<FloatingObjectPart> whenLeaving, SimplifiedObjectTypeManager simplifiedObjectTypeManager) { + String whenArrivingValue = computeDcpSimplifiedObjectType0(whenArriving, simplifiedObjectTypeManager); + dcp.setComputedWhenArrivingSimplifiedObjectType(whenArrivingValue); + + String whenLeavingValue = computeDcpSimplifiedObjectType0(whenLeaving, simplifiedObjectTypeManager); + dcp.setComputedWhenLeavingSimplifiedObjectType(whenLeavingValue); } - private void computeDcpNonEntangling(FloatingObject dcp) { - DcpComputedValue value = DcpComputedValue.UNKNOWN; - if (dcp.isFloatingObjectPartNotEmpty()) { - value = DcpComputedValue.TRUE; - for (FloatingObjectPart floatingObjectPart : dcp.getFloatingObjectPart()) { - if (!floatingObjectPart.getObjectMaterial().isNonEntangling()) { - value = DcpComputedValue.FALSE; + private void computeDcpNonEntangling(FloatingObject dcp, Set<FloatingObjectPart> whenArriving, Set<FloatingObjectPart> whenLeaving) { + DcpComputedValue whenArrivingValue = computeDcpNonEntangling0(whenArriving); + dcp.setComputedWhenArrivingNonEntangling(whenArrivingValue); + + DcpComputedValue whenLeavingValue = computeDcpNonEntangling0(whenLeaving); + dcp.setComputedWhenLeavingNonEntangling(whenLeavingValue); + } + + private void computeDcpBiodegradable(FloatingObject dcp, Set<FloatingObjectPart> whenArriving, Set<FloatingObjectPart> whenLeaving) { + DcpComputedValue whenArrivingValue = computeDcpBiodegradable0(whenArriving); + dcp.setComputedWhenArrivingBiodegradable(whenArrivingValue); + + DcpComputedValue whenLeavingValue = computeDcpBiodegradable0(whenLeaving); + dcp.setComputedWhenLeavingBiodegradable(whenLeavingValue); + } + + private DcpComputedValue computeDcpBiodegradable0(Set<FloatingObjectPart> floatingObjectParts) { + DcpComputedValue result = DcpComputedValue.UNKNOWN; + if (!floatingObjectParts.isEmpty()) { + result = DcpComputedValue.TRUE; + for (FloatingObjectPart floatingObjectPart : floatingObjectParts) { + if (!floatingObjectPart.getObjectMaterial().isBiodegradable()) { + result = DcpComputedValue.FALSE; break; } } } - dcp.setComputedNonEntangling(value); + return result; } - private void computeDcpBiodegradable(FloatingObject dcp) { - DcpComputedValue value = DcpComputedValue.UNKNOWN; - if (dcp.isFloatingObjectPartNotEmpty()) { - value = DcpComputedValue.TRUE; - for (FloatingObjectPart floatingObjectPart : dcp.getFloatingObjectPart()) { - if (!floatingObjectPart.getObjectMaterial().isBiodegradable()) { - value = DcpComputedValue.FALSE; + private String computeDcpSimplifiedObjectType0(Set<FloatingObjectPart> floatingObjectParts, SimplifiedObjectTypeManager simplifiedObjectTypeManager) { + Set<String> objectMaterialIds = floatingObjectParts.stream().map(p -> p.getObjectMaterial().getTopiaId()).collect(Collectors.toSet()); + return simplifiedObjectTypeManager.getStandardCode(objectMaterialIds); + } + + private DcpComputedValue computeDcpNonEntangling0(Set<FloatingObjectPart> floatingObjectParts) { + DcpComputedValue result = DcpComputedValue.UNKNOWN; + if (!floatingObjectParts.isEmpty()) { + result = DcpComputedValue.TRUE; + for (FloatingObjectPart floatingObjectPart : floatingObjectParts) { + if (!floatingObjectPart.getObjectMaterial().isNonEntangling()) { + result = DcpComputedValue.FALSE; break; } } } - dcp.setComputedBiodegradable(value); + return result; } private void updateNonTargetCatch(ConsolidationActivitySeineDataContext activityContext, NonTargetCatch nonTargetCatch) { ===================================== services/src/main/models/Observe.model ===================================== --- a/services/src/main/models/Observe.model +++ b/services/src/main/models/Observe.model @@ -622,12 +622,12 @@ activityFinDeVeille + {*:1} boolean seine.FloatingObject > Commentable objectOperation {*:1} reference.ReferentialReference | attributeGeneric=fr.ird.observe.services.dto.referential.seine.ObjectOperationDto supportVesselName + {*:1} String -computedBiodegradable + {*:1} !fr.ird.observe.common.constants.seine.DcpComputedValue -computedNonEntangling + {*:1} !fr.ird.observe.common.constants.seine.DcpComputedValue -computedSimplifiedObjectType + {*:1} String -getComputedBiodegradableValue() String -getComputedNonEntanglingValue() String -getComputedSimplifiedObjectTypeValue() String +computedWhenArrivingBiodegradable + {*:1} !fr.ird.observe.common.constants.seine.DcpComputedValue +computedWhenArrivingNonEntangling + {*:1} !fr.ird.observe.common.constants.seine.DcpComputedValue +computedWhenArrivingSimplifiedObjectType + {*:1} String +computedWhenLeavingBiodegradable + {*:1} !fr.ird.observe.common.constants.seine.DcpComputedValue +computedWhenLeavingNonEntangling + {*:1} !fr.ird.observe.common.constants.seine.DcpComputedValue +computedWhenLeavingSimplifiedObjectType + {*:1} String seine.FloatingObjectObservedSpecies > Commentable objectObservedSpecies {*} seine.ObjectObservedSpecies ===================================== test/src/main/resources/db/6.902/dataForTestLongline.sql.gz ===================================== Binary files a/test/src/main/resources/db/6.902/dataForTestLongline.sql.gz and b/test/src/main/resources/db/6.902/dataForTestLongline.sql.gz differ ===================================== test/src/main/resources/db/6.902/dataForTestSeine.sql.gz ===================================== Binary files a/test/src/main/resources/db/6.902/dataForTestSeine.sql.gz and b/test/src/main/resources/db/6.902/dataForTestSeine.sql.gz differ ===================================== test/src/main/resources/db/6.902/empty_h2.sql.gz ===================================== Binary files a/test/src/main/resources/db/6.902/empty_h2.sql.gz and b/test/src/main/resources/db/6.902/empty_h2.sql.gz differ ===================================== test/src/main/resources/db/6.902/empty_pg.sql.gz ===================================== Binary files a/test/src/main/resources/db/6.902/empty_pg.sql.gz and b/test/src/main/resources/db/6.902/empty_pg.sql.gz differ ===================================== test/src/main/resources/db/6.902/referentiel.sql.gz ===================================== Binary files a/test/src/main/resources/db/6.902/referentiel.sql.gz and b/test/src/main/resources/db/6.902/referentiel.sql.gz differ View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/7ac51b1a937016364086ea8de0d2... --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/7ac51b1a937016364086ea8de0d2... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT