Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 8ab949b2 by Tony Chemit at 2021-10-20T08:31:31+02:00 improve species decoration in data use at last decorator renderer defined in the concrete project (so can make any modification on them :)) - - - - - 50711231 by Tony Chemit at 2021-10-20T08:31:31+02:00 use jaxx editors decorator classifier for table references render - - - - - 2b8167b1 by Tony Chemit at 2021-10-20T08:31:31+02:00 Revue de la modélisation ps logbook Sample - See ultreiaio/ird-observe#2001 - - - - - 3b026463 by Tony Chemit at 2021-10-20T08:31:31+02:00 revue layout ps logbook activity catch - - - - - 2e5cdb3f by Tony Chemit at 2021-10-20T08:31:31+02:00 fix default logbook value on trip create (ps) - - - - - 2680d23a by Tony Chemit at 2021-10-20T08:31:31+02:00 add tooltip on tables :) - - - - - bad538ef by Tony Chemit at 2021-10-20T08:31:59+02:00 Amélioration d'un libellé - Closes #2038 - - - - - 19 changed files: - client/core/src/main/java/fr/ird/observe/client/util/table/JXTableUtil.java - client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/LonglinePositionAware.jcss - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripUIModelStates.java - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/ActivityCatchUITableModel.java - client/datasource/editor/spi/src/main/java/fr/ird/observe/client/datasource/editor/spi/content/data/table/GenerateContentTableUITableModel.java - models/definition/src/main/models/Observe/dto/attribute/notNullIf.properties - models/definition/src/main/models/Observe/dto/class/containerChildDataDtoProperties.properties - models/definition/src/main/models/Observe/dto/class/decorator.properties - models/definition/src/main/models/Observe/dto/class/i18nLabels.properties - models/definition/src/main/models/Observe/dto/class/references.properties - models/dto/i18n/src/main/i18n/getters/labels.getter - models/dto/java/src/main/i18n/getters/java.getter - + models/dto/java/src/main/java/fr/ird/observe/spi/decoration/ObserveDefaultDecoratorRenderer.java - + models/dto/java/src/main/java/fr/ird/observe/spi/decoration/ObserveDtoDecoratorRenderer.java - + models/dto/java/src/main/java/fr/ird/observe/spi/decoration/ObserveDtoReferenceDecoratorRenderer.java - + models/persistence/java/src/main/java/fr/ird/observe/spi/decoration/ObserveEntityDecoratorRenderer.java - services/i18n/src/main/i18n/translations/services_en_GB.properties - services/i18n/src/main/i18n/translations/services_es_ES.properties - services/i18n/src/main/i18n/translations/services_fr_FR.properties Changes: ===================================== client/core/src/main/java/fr/ird/observe/client/util/table/JXTableUtil.java ===================================== @@ -31,11 +31,14 @@ import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.renderer.DefaultTableRenderer; import org.jdesktop.swingx.renderer.StringValue; +import javax.swing.JComponent; import javax.swing.JScrollPane; +import javax.swing.JTable; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; +import java.awt.Component; import java.awt.Dimension; import java.util.EnumSet; import java.util.Enumeration; @@ -107,7 +110,7 @@ public class JXTableUtil { reference.registerDecorator(decorator); return reference.decorate(); }; - return new DefaultTableRenderer(sv); + return getDefaultTableRenderer(sv, true); } public static TableCellRenderer newEmptyNumberTableCellRenderer() { @@ -128,7 +131,7 @@ public class JXTableUtil { } return result; }; - return new DefaultTableRenderer(sv); + return getDefaultTableRenderer(sv, true); } public static TableCellRenderer newBooleanTableCellRenderer2() { @@ -139,10 +142,10 @@ public class JXTableUtil { Boolean reference = (Boolean) value; return reference ? t("boolean.true") : t("boolean.false"); }; - return new DefaultTableRenderer(sv); + return getDefaultTableRenderer(sv, true); } - public static TableCellRenderer newStringTableCellRenderer(int length, boolean tooltip) { + public static TableCellRenderer newStringTableCellRenderer(int length) { StringValue sv = value -> { if (value == null) { return null; @@ -150,7 +153,7 @@ public class JXTableUtil { String reference = (String) value; return reference.length() > length ? reference.substring(0, length - 3) + "..." : reference; }; - return new DefaultTableRenderer(sv); + return getDefaultTableRenderer(sv, false); } public static <E extends Enum<E>> TableCellRenderer newEnumTableCellRenderer(Class<E> enumClass) { @@ -172,7 +175,19 @@ public class JXTableUtil { } return null; }; - return new DefaultTableRenderer(sv); + return getDefaultTableRenderer(sv, true); + } + + private static DefaultTableRenderer getDefaultTableRenderer(StringValue sv, boolean useStringValue) { + return new DefaultTableRenderer(sv) { + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + JComponent tableCellRendererComponent = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + String toolTipText = useStringValue ? sv.getString(value) : value == null ? null : String.valueOf(value); + tableCellRendererComponent.setToolTipText(toolTipText); + return tableCellRendererComponent; + } + }; } } ===================================== client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/LonglinePositionAware.jcss ===================================== @@ -26,15 +26,15 @@ #section { _listNoLoad:{true}; - /*_decoratorClassifier:{SectionReference.ONLY_HAULING_IDENTIFIER};*/ + _decoratorClassifier:{SectionReference.ONLY_HAULING_IDENTIFIER}; } #basket { _listNoLoad:{true}; - /*_decoratorClassifier:{BasketReference.ONLY_HAULING_IDENTIFIER};*/ + _decoratorClassifier:{BasketReference.ONLY_HAULING_IDENTIFIER}; } #branchline { _listNoLoad:{true}; - /*_decoratorClassifier:{BranchlineReference.ONLY_HAULING_IDENTIFIER};*/ + _decoratorClassifier:{BranchlineReference.ONLY_HAULING_IDENTIFIER}; } ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripUIModelStates.java ===================================== @@ -91,20 +91,13 @@ public class TripUIModelStates extends GeneratedTripUIModelStates { referenceCache.addReferentialFilter(TripDto.PROPERTY_ADVANCED_SAMPLING_ACQUISITION_STATUS, newAcquisitionStatusList(TripDto::isAdvancedSamplingFilled, AcquisitionStatusReference::isAdvancedSampling)); } - //FIXME Check this is ok to move it to copyFormToBean -// @Override -// public void setForm(Form<TripDto> form) { -// super.setForm(form); -// // set end date to current day if necessary -// if (isUpdatingMode() && getBean().getEndDate() == null) { -// Date date = Dates.getEndOfDay(new Date()); -// getBean().setEndDate(date); -// } -// } - @Override protected void copyFormToBean(Form<TripDto> form) { super.copyFormToBean(form); + if (isCreatingMode()) { + // reset logbook default values + setDefaultLogbookValues(true); + } // set end date to current day if necessary if (isUpdatingMode() && getBean().getEndDate() == null) { Date date = Dates.getEndOfDay(new Date()); ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/ActivityCatchUITableModel.java ===================================== @@ -37,7 +37,9 @@ class ActivityCatchUITableModel extends GeneratedActivityCatchUITableModel { @Override public void initTableUISize(JTable table) { UIHelper.fixTableColumnWidth(table, 3, 55); - UIHelper.fixTableColumnWidth(table, 4, 65); + UIHelper.fixTableColumnWidth(table, 4, 55); + UIHelper.fixTableColumnWidth(table, 5, 55); + UIHelper.fixTableColumnWidth(table, 6, 55); } @Override ===================================== client/datasource/editor/spi/src/main/java/fr/ird/observe/client/datasource/editor/spi/content/data/table/GenerateContentTableUITableModel.java ===================================== @@ -26,7 +26,6 @@ import fr.ird.observe.client.datasource.editor.api.content.EditableContentUI; import fr.ird.observe.client.datasource.editor.api.content.data.table.ContentTableMeta; import fr.ird.observe.client.datasource.editor.api.content.data.table.ContentTableUITableModel; import fr.ird.observe.client.util.table.JXTableUtil; -import fr.ird.observe.dto.data.ll.observation.LonglineElementAware; import fr.ird.observe.dto.reference.DataDtoReference; import fr.ird.observe.dto.reference.ReferentialDtoReference; import fr.ird.observe.spi.TagValues; @@ -150,15 +149,12 @@ public class GenerateContentTableUITableModel extends GenerateContentTableUISupp if (Number.class.isAssignableFrom(propertyType)) { rendererBuilder.append("\n , JXTableUtil.newEmptyNumberTableCellRenderer()"); } else if (String.class.isAssignableFrom(propertyType)) { - rendererBuilder.append("\n , JXTableUtil.newStringTableCellRenderer(10, true)"); + rendererBuilder.append("\n , JXTableUtil.newStringTableCellRenderer(10)"); } else if (ReferentialDtoReference.class.isAssignableFrom(propertyType)) { - rendererBuilder.append(String.format("\n , JXTableUtil.newDecoratedRenderer(%s.class)", propertyType.getName())); + String classifier = String.format("(String) getContext().get%s().getClientProperty(fr.ird.observe.client.util.init.UIInitHelper.DECORATOR_CLASSIFIER)", StringUtils.capitalize(propertyName)); + rendererBuilder.append(String.format("\n , JXTableUtil.newDecoratedRenderer(%s.class, %s)", propertyType.getName(), classifier)); } else if (DataDtoReference.class.isAssignableFrom(propertyType)) { - //FIXME Decorator Using hardcoded name was HAULING_IDENTIFIER - String classifier = "null"; - if (LonglineElementAware.class.isAssignableFrom(propertyType)) { - classifier = propertyType.getName() + ".ONLY_HAULING_IDENTIFIER"; - } + String classifier = String.format("(String) getContext().get%s().getClientProperty(fr.ird.observe.client.util.init.UIInitHelper.DECORATOR_CLASSIFIER)", StringUtils.capitalize(propertyName)); rendererBuilder.append(String.format("\n , JXTableUtil.newDecoratedRenderer(%s.class, %s)", propertyType.getName(), classifier)); } else if (boolean.class.isAssignableFrom(propertyType)) { rendererBuilder.append("\n ,table.getDefaultRenderer(Boolean.class)"); ===================================== models/definition/src/main/models/Observe/dto/attribute/notNullIf.properties ===================================== @@ -40,7 +40,7 @@ data.ps.localmarket.Batch.attribute.count=countOrWeightValid data.ps.localmarket.Batch.attribute.weight=countOrWeightValid data.ps.logbook.Sample.attribute.bigsWeight=totalWeight != null && totalWeight > 0 data.ps.logbook.Sample.attribute.smallsWeight=totalWeight != null && totalWeight > 0 -data.ps.logbook.Sample.attribute.totalWeight=bigsWeight != null && bigsWeight > 0 && smallsWeight != null && smallsWeight > 0 +data.ps.logbook.Sample.attribute.totalWeight=bigsWeight != null && bigsWeight >= 0 && smallsWeight != null && smallsWeight >= 0 data.ps.observation.Catch.attribute.catchWeight=totalCount != null data.ps.observation.Catch.attribute.totalCount=catchWeight != null data.ps.observation.SampleMeasure.attribute.length=acquisitionMode == 1 && weight != null ===================================== models/definition/src/main/models/Observe/dto/class/containerChildDataDtoProperties.properties ===================================== @@ -39,7 +39,7 @@ data.ps.common.GearUseFeatures=gear,number,usedInTrip,comment data.ps.landing.Landing=species,weightCategory,weight,destination,fate,fateVessel data.ps.localmarket.Batch=species,packaging,count,weight data.ps.localmarket.SampleSpecies=species,sizeMeasureType,measuredCount,comment -data.ps.logbook.Catch=species,speciesFate,weightCategory,well,weight,count,comment +data.ps.logbook.Catch=species,weightCategory,speciesFate,well,weight,count,comment data.ps.logbook.SampleSpecies=subSampleNumber,species,sizeMeasureType,measuredCount,totalCount,comment data.ps.logbook.WellPlan=activity,well,species,weightCategory,weight data.ps.observation.Catch=species,speciesFate,reasonForDiscard,well,catchWeight,totalCount,meanWeight,meanLength,comment ===================================== models/definition/src/main/models/Observe/dto/class/decorator.properties ===================================== @@ -24,7 +24,7 @@ data.ll.common.GearUseFeaturesMeasurement=${gearCharacteristic::label}##${measur data.ll.common.Program=[${gearType/prefix}]##$(observe.Common.program) ${this::label} data.ll.common.Trip=${startDate::date}##${endDate::date}##${vessel::label} data.ll.landing.Landing=${startDate::date}##${harbour::label}##${vessel::label} -data.ll.landing.LandingPart=${species::scientificLabel}##${categoryMin}##${categoryMax}##${weight} +data.ll.landing.LandingPart=${species::speciesLabel}##${categoryMin}##${categoryMax}##${weight} data.ll.logbook.Activity=${startTimeStamp::timestamp}##${vesselActivity::label} data.ll.logbook.ActivitySample=${timeStamp::timestamp}##${coordinateStr} data.ll.logbook.BaitsComposition=${baitType::label}##${proportion} @@ -33,7 +33,7 @@ data.ll.logbook.Catch=${homeId} data.ll.logbook.FloatlinesComposition=${lineType::label}##${proportion} data.ll.logbook.HooksComposition=${hookType::label}##${proportion} data.ll.logbook.Sample=${timeStamp::timestamp}##${coordinateStr} -data.ll.logbook.SamplePart=${species::scientificLabel}##${length}##${weight} +data.ll.logbook.SamplePart=${species::speciesLabel}##${length}##${weight} data.ll.logbook.Set=$(observe.data.ll.logbook.Set.type) data.ll.observation.Activity=${timeStamp::timestamp}##${vesselActivity::label} data.ll.observation.BaitsComposition=${baitType::label}##${proportion} @@ -41,7 +41,7 @@ data.ll.observation.Basket=${settingIdentifier} ( $(observe.Common.settingIdenti data.ll.observation.Branchline=${settingIdentifier} ( $(observe.Common.settingIdentifier) )##${haulingIdentifier} ( $(observe.Common.haulingIdentifier) ) data.ll.observation.BranchlinesComposition=${length}##${proportion} data.ll.observation.Catch=${homeId} -data.ll.observation.Encounter=${encounterType::label}##${species::scientificLabel} +data.ll.observation.Encounter=${encounterType::label}##${species::speciesLabel} data.ll.observation.FloatlinesComposition=${lineType::label}##${proportion} data.ll.observation.HooksComposition=${hookType::label}##${proportion} data.ll.observation.Section=${settingIdentifier} ( $(observe.Common.settingIdentifier) )##${haulingIdentifier} ( $(observe.Common.haulingIdentifier) ) @@ -56,38 +56,38 @@ data.ps.common.GearUseFeatures=${gear::label}##${number} data.ps.common.GearUseFeaturesMeasurement=${gearCharacteristic::label}##${measurementValue} data.ps.common.Program=[${gearType/prefix}]##$(observe.Common.program) ${this::label} data.ps.common.Trip=${startDate::date}##${endDate::date}##${vessel::label} -data.ps.landing.Landing=${species::scientificLabel}##${weightCategory::label}##${weight} -data.ps.localmarket.Batch=${species::scientificLabel}##${packaging::label}##${count} +data.ps.landing.Landing=${species::speciesLabel}##${weightCategory::label}##${weight} +data.ps.localmarket.Batch=${species::speciesLabel}##${packaging::label}##${count} data.ps.localmarket.Sample=${date::niceDate}##${number} -data.ps.localmarket.SampleSpecies=${species::scientificLabel}##${sizeMeasureType::label} +data.ps.localmarket.SampleSpecies=${species::speciesLabel}##${sizeMeasureType::label} data.ps.localmarket.SampleSpeciesMeasure=${sizeClass}##${count} data.ps.localmarket.Survey=${number}##${date::niceDate} -data.ps.localmarket.SurveyPart=${species::scientificLabel}##${proportion} +data.ps.localmarket.SurveyPart=${species::speciesLabel}##${proportion} data.ps.localmarket.WellId=${well} data.ps.logbook.Activity=${number}##${time::niceTime}##${vesselActivity::label} data.ps.logbook.ActivityStub=${number}%s##${time::niceTime} -data.ps.logbook.Catch=${species::scientificLabel}##${speciesFate::label} +data.ps.logbook.Catch=${species::speciesLabel}##${speciesFate::label} data.ps.logbook.FloatingObject=DCP ${objectOperation::label} data.ps.logbook.FloatingObjectPart=${objectMaterial::label}##${whenArriving}##${whenLeaving} data.ps.logbook.Route=${date::niceDate} data.ps.logbook.Sample=$(observe.Common.well) ${wellLabel}##${sampleType::label} data.ps.logbook.SampleActivity=${activityLabel}##${weightedWeight} -data.ps.logbook.SampleSpecies=$(observe.Common.sample) ${subSampleNumber}##${species::scientificLabel}##${sizeMeasureType::label} +data.ps.logbook.SampleSpecies=$(observe.Common.sample) ${subSampleNumber}##${species::speciesLabel}##${sizeMeasureType::label} data.ps.logbook.SampleSpeciesMeasure=${sizeClass}##${count} data.ps.logbook.TransmittingBuoy=${transmittingBuoyType::label}##${transmittingBuoyOperation::label}##${code}##${comment} -data.ps.logbook.WellPlan=${species::scientificLabel}##$(observe.Common.well) ${wellLabel}##${weightCategory::label}##${weight} +data.ps.logbook.WellPlan=${species::speciesLabel}##$(observe.Common.well) ${wellLabel}##${weightCategory::label}##${weight} data.ps.observation.Activity=${time::niceTime}##${vesselActivity::label} data.ps.observation.ActivityStub=${time::niceTime} -data.ps.observation.Catch=${species::scientificLabel}##${speciesFate::label} +data.ps.observation.Catch=${species::speciesLabel}##${speciesFate::label} data.ps.observation.FloatingObject=DCP ${objectOperation::label} data.ps.observation.FloatingObjectPart=${objectMaterial::label}##${whenArriving}##${whenLeaving} -data.ps.observation.NonTargetCatchRelease=${species::scientificLabel}##${speciesGroupReleaseMode::label} -data.ps.observation.ObjectObservedSpecies=${species::scientificLabel}##${speciesStatus::label}##${count} -data.ps.observation.ObjectSchoolEstimate=${species::scientificLabel}##${totalWeight} +data.ps.observation.NonTargetCatchRelease=${species::speciesLabel}##${speciesGroupReleaseMode::label} +data.ps.observation.ObjectObservedSpecies=${species::speciesLabel}##${speciesStatus::label}##${count} +data.ps.observation.ObjectSchoolEstimate=${species::speciesLabel}##${totalWeight} data.ps.observation.Route=${date::niceDate} data.ps.observation.Sample=${homeId} -data.ps.observation.SampleMeasure=${species::scientificLabel}##${length}##${sex::label} -data.ps.observation.SchoolEstimate=${species::scientificLabel}##${totalWeight}##${meanWeight} +data.ps.observation.SampleMeasure=${species::speciesLabel}##${length}##${sex::label} +data.ps.observation.SchoolEstimate=${species::speciesLabel}##${totalWeight}##${meanWeight} data.ps.observation.Set=$(observe.data.ps.observation.Set.type) data.ps.observation.TransmittingBuoy=${transmittingBuoyType::label}##${transmittingBuoyOperation::label}##${code}##${comment} referential.common.FpaZone=${code}##${this::label}##${validityRangeLabel} @@ -102,7 +102,7 @@ referential.common.Vessel=${code}##${this::label}##${validityRangeLabel} referential.common.VesselSizeCategory=${code}##${gaugeLabel}##${capacityLabel} referential.common.Wind=${code}##${this::label}##${speedRange}##${swellHeight} referential.ll.observation.SensorBrand=${code}##${brandName} -referential.ps.common.AcquisitionStatus=${code}##${this::label} +referential.ps.common.AcquisitionStatus=${code}##${this::label}##${_fieldEnabler::fieldEnabler} referential.ps.common.ObjectMaterial=${code::noCode}##${this::label} -referential.ps.common.WeightCategory=${code}##${species::scientificLabel}##${this::label} +referential.ps.common.WeightCategory=${code}##${species::speciesLabel}##${this::label} referential.ps.localmarket.Packaging=${code}##${this::label}##${harbour::label}##${batchComposition::label}##${batchWeightType::label}##${validityRangeLabel} ===================================== models/definition/src/main/models/Observe/dto/class/i18nLabels.properties ===================================== @@ -115,7 +115,7 @@ referential.common.WeightMeasureType=action.reset.to.default.tip referential.common.Wind=maxSpeed,maxSwellHeight,minSpeed,minSwellHeight,speedMinMax,swellHeightMinMax referential.ll.observation.MaturityStatus=lowerValue,upperValue,lowerValueUpperValue referential.ll.observation.SensorBrand=brandName -referential.ps.common.AcquisitionStatus=advancedSampling,fieldEnabler,landing,localMarket,localMarketSurveySampling,localMarketWellsSampling,logbook,observation,targetWellsSampling +referential.ps.common.AcquisitionStatus=advancedSampling,fieldEnabler,fieldEnabled,fieldDisabled,landing,localMarket,localMarketSurveySampling,localMarketWellsSampling,logbook,observation,targetWellsSampling referential.ps.common.ObjectMaterial=biodegradable,childSelectionMandatory,childrenMultiSelectable,legacyCode,nonEntangling,objectMaterialType,parent,standardCode,validation,legacyCodeStandardCode,parentCode,validationInformation referential.ps.common.ObjectOperation=whenArriving,whenLeaving referential.ps.common.ObservedSystem=allowLogbook,allowObservation,schoolType ===================================== models/definition/src/main/models/Observe/dto/class/references.properties ===================================== @@ -24,7 +24,7 @@ data.ll.common.GearUseFeaturesMeasurement=measurementValue,gearCharacteristicLab data.ll.common.Program=code,label,uri,gearType,childrenSize,startDate,endDate,status,needComment,homeId data.ll.common.Trip=startDate,endDate,program,tripTypeId,activityObsSize,activityLogbookSize,landingSize,sampleSize,vessel,observationsAvailability,logbookAvailability,gearUseFeaturesSize data.ll.landing.Landing=startDate,harbourLabel,vesselLabel -data.ll.landing.LandingPart=speciesLabel,categoryMin,categoryMax,weight +data.ll.landing.LandingPart=species,categoryMin,categoryMax,weight data.ll.logbook.Activity=startTimeStamp,endTimeStamp,latitude,longitude,vesselActivity,set,activitySample,relatedObservedActivity data.ll.logbook.ActivitySample=timeStamp,latitude,longitude data.ll.logbook.BaitsComposition=proportion,baitTypeLabel,baitSettingStatusLabel,individualSize,individualWeight @@ -33,7 +33,7 @@ data.ll.logbook.Catch=homeId data.ll.logbook.FloatlinesComposition=proportion,lineTypeLabel,length data.ll.logbook.HooksComposition=proportion,hookTypeLabel,hookSizeLabel,hookOffset data.ll.logbook.Sample=timeStamp,latitude,longitude -data.ll.logbook.SamplePart=speciesLabel,length,weight +data.ll.logbook.SamplePart=species,length,weight data.ll.logbook.Set=homeId,catchesSize data.ll.observation.Activity=timeStamp,latitude,longitude,vesselActivity,set,encounterSize,sensorUsedSize data.ll.observation.BaitsComposition=proportion,baitTypeLabel,baitSettingStatusLabel,individualSize,individualWeight @@ -41,7 +41,7 @@ data.ll.observation.Basket=settingIdentifier,haulingIdentifier,parentId,notUsed data.ll.observation.Branchline=settingIdentifier,haulingIdentifier,parentId,notUsed data.ll.observation.BranchlinesComposition=proportion,topTypeLabel,tracelineTypeLabel,length data.ll.observation.Catch=homeId -data.ll.observation.Encounter=encounterTypeLabel,speciesLabel +data.ll.observation.Encounter=encounterTypeLabel,species data.ll.observation.FloatlinesComposition=proportion,lineTypeLabel,length data.ll.observation.HooksComposition=proportion,hookTypeLabel,hookSizeLabel,hookOffset data.ll.observation.Section=settingIdentifier,haulingIdentifier,parentId,notUsed @@ -54,35 +54,35 @@ data.ps.common.GearUseFeatures=gearLabel,number,usedInTrip data.ps.common.GearUseFeaturesMeasurement=measurementValue,gearCharacteristicLabel data.ps.common.Program=code,label,uri,gearType,childrenSize,startDate,endDate,status,needComment,homeId data.ps.common.Trip=startDate,endDate,program,gearUseFeaturesSize,routeObsSize,routeLogbookSize,landingSize,wellPlanSize,sampleSize,localmarketBatchSize,localmarketSurveySize,localmarketSampleSize,vessel,observationsAcquisitionStatus,logbookAcquisitionStatus,targetWellsSamplingAcquisitionStatus,landingAcquisitionStatus,localMarketAcquisitionStatus,localMarketWellsSamplingAcquisitionStatus,localMarketSurveySamplingAcquisitionStatus,advancedSamplingAcquisitionStatus,observationsFilled,logbookFilled,targetWellsSamplingFilled,landingFilled,localMarketFilled,localMarketWellsSamplingFilled,localMarketSurveySamplingFilled,advancedSamplingFilled -data.ps.landing.Landing=date,speciesLabel,weightCategory,fateLabel,fateVesselLabel,weight +data.ps.landing.Landing=date,species,weightCategory,fateLabel,fateVesselLabel,weight data.ps.localmarket.Batch=species,packaging,count,weight data.ps.localmarket.Sample=number,date,sampleSpeciesSize -data.ps.localmarket.SampleSpecies=speciesLabel,sizeMeasureTypeLabel,measuredCount +data.ps.localmarket.SampleSpecies=species,sizeMeasureTypeLabel,measuredCount data.ps.localmarket.SampleSpeciesMeasure=sizeClass,count data.ps.localmarket.Survey=number,date data.ps.localmarket.SurveyPart=species,proportion data.ps.logbook.Activity=number,date,time,latitude,longitude,vesselActivity,relatedObservedActivity,catchesSize -data.ps.logbook.Catch=speciesLabel,speciesFateLabel,well +data.ps.logbook.Catch=species,speciesFateLabel,well data.ps.logbook.FloatingObject=objectOperationLabel data.ps.logbook.FloatingObjectPart=objectMaterialId,objectMaterialLabel,whenArriving,whenLeaving data.ps.logbook.Route=date,comment,activitySize data.ps.logbook.Sample=well,number,superSample,sampleTypeLabel,sampleSpeciesSize,totalWeight,bigsWeight,smallsWeight data.ps.logbook.SampleActivity=activity,weightedWeight -data.ps.logbook.SampleSpecies=subSampleNumber,speciesLabel,sizeMeasureTypeLabel,measuredCount,totalCount +data.ps.logbook.SampleSpecies=subSampleNumber,species,sizeMeasureTypeLabel,measuredCount,totalCount data.ps.logbook.SampleSpeciesMeasure=sizeClass,count data.ps.logbook.TransmittingBuoy=code,comment,transmittingBuoyTypeLabel,transmittingBuoyOperationLabel data.ps.logbook.WellPlan=species,well,weight,weightCategoryLabel data.ps.observation.Activity=date,time,latitude,longitude,vesselActivity,set -data.ps.observation.Catch=speciesLabel,speciesFateLabel,catchWeight,meanWeight,meanLength,well +data.ps.observation.Catch=species,speciesFateLabel,catchWeight,meanWeight,meanLength,well data.ps.observation.FloatingObject=objectOperationLabel,objectSchoolEstimateSize,objectObservedSpeciesSize data.ps.observation.FloatingObjectPart=objectMaterialId,objectMaterialLabel,whenArriving,whenLeaving -data.ps.observation.NonTargetCatchRelease=speciesLabel,speciesGroupReleaseModeLabel,statusLabel,conformityLabel,releasingTimeLabel,length -data.ps.observation.ObjectObservedSpecies=speciesLabel,speciesStatusLabel,count -data.ps.observation.ObjectSchoolEstimate=speciesLabel,totalWeight +data.ps.observation.NonTargetCatchRelease=species,speciesGroupReleaseModeLabel,statusLabel,conformityLabel,releasingTimeLabel,length +data.ps.observation.ObjectObservedSpecies=species,speciesStatusLabel,count +data.ps.observation.ObjectSchoolEstimate=species,totalWeight data.ps.observation.Route=date,startLogValue,endLogValue,comment,activitySize data.ps.observation.Sample=homeId -data.ps.observation.SampleMeasure=speciesLabel,length,weight,count,sexLabel -data.ps.observation.SchoolEstimate=speciesLabel,meanWeight,totalWeight +data.ps.observation.SampleMeasure=species,length,weight,count,sexLabel +data.ps.observation.SchoolEstimate=species,meanWeight,totalWeight data.ps.observation.Set=comment,sampleMeasureEnabled,nonTargetCatchReleaseEnabled,catchesSize,nonTargetCatchReleaseSize,schoolEstimateSize,sampleMeasureSize data.ps.observation.TransmittingBuoy=code,comment,transmittingBuoyTypeLabel,transmittingBuoyOperationLabel referential.common.Country=code,label,uri,iso2Code,iso3Code ===================================== models/dto/i18n/src/main/i18n/getters/labels.getter ===================================== @@ -1266,6 +1266,8 @@ observe.referential.ll.observation.SensorDataFormat.type observe.referential.ll.observation.SensorType.type observe.referential.ll.observation.StomachFullness.type observe.referential.ps.common.AcquisitionStatus.advancedSampling +observe.referential.ps.common.AcquisitionStatus.fieldDisabled +observe.referential.ps.common.AcquisitionStatus.fieldEnabled observe.referential.ps.common.AcquisitionStatus.fieldEnabler observe.referential.ps.common.AcquisitionStatus.landing observe.referential.ps.common.AcquisitionStatus.localMarket ===================================== models/dto/java/src/main/i18n/getters/java.getter ===================================== @@ -22,3 +22,5 @@ observe.data.pairing.ActivityPairingResultItem.type observe.data.ps.observation.Set.type observe.referential.common.Vessel.flagCountry observe.referential.common.Vessel.fleetCountry +observe.referential.ps.common.AcquisitionStatus.fieldDisabled +observe.referential.ps.common.AcquisitionStatus.fieldEnabled ===================================== models/dto/java/src/main/java/fr/ird/observe/spi/decoration/ObserveDefaultDecoratorRenderer.java ===================================== @@ -0,0 +1,47 @@ +package fr.ird.observe.spi.decoration; + +/*- + * #%L + * ObServe Models :: Dto :: Java + * %% + * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import io.ultreia.java4all.i18n.I18n; + +import java.util.Locale; + +/** + * Created on 19/10/2021. + * + * @author Tony Chemit - dev@tchemit.fr + * @since 9.0.0 + */ +public interface ObserveDefaultDecoratorRenderer { + + default String speciesLabel(String faoCode, String scientificLabel, String label) { + if ("xx".equals(scientificLabel)) { + return String.format("%s - %s", faoCode, label); + } + return String.format("%s - %s - %s", faoCode, scientificLabel, label); + } + + default String fieldEnabler(Locale locale, boolean fieldEnabler) { + return fieldEnabler ? I18n.l(locale, "observe.referential.ps.common.AcquisitionStatus.fieldEnabled") : I18n.l(locale, "observe.referential.ps.common.AcquisitionStatus.fieldDisabled"); + } +} ===================================== models/dto/java/src/main/java/fr/ird/observe/spi/decoration/ObserveDtoDecoratorRenderer.java ===================================== @@ -0,0 +1,57 @@ +package fr.ird.observe.spi.decoration; + +/*- + * #%L + * ObServe Models :: Dto :: Java + * %% + * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ird.observe.dto.BusinessDto; +import fr.ird.observe.dto.referential.common.SpeciesReference; +import fr.ird.observe.dto.referential.ps.common.AcquisitionStatusReference; + +import java.util.Locale; + +/** + * Created on 19/10/2021. + * + * @author Tony Chemit - dev@tchemit.fr + * @since 9.0.0 + */ +public class ObserveDtoDecoratorRenderer<O extends BusinessDto> extends DtoDecoratorRenderer<O> implements ObserveDefaultDecoratorRenderer { + + public ObserveDtoDecoratorRenderer(Class<O> type) { + super(type); + } + + public String speciesLabel(Locale locale, SpeciesReference species) { + if (species == null) { + return onNullValue(locale, null); + } + String faoCode = species.getFaoCode(); + String scientificLabel = species.getScientificLabel(); + String label = label(locale, species); + return speciesLabel(faoCode, scientificLabel, label); + } + + public String fieldEnabler(Locale locale, AcquisitionStatusReference reference) { + return fieldEnabler(locale, reference.isFieldEnabler()); + } + +} ===================================== models/dto/java/src/main/java/fr/ird/observe/spi/decoration/ObserveDtoReferenceDecoratorRenderer.java ===================================== @@ -0,0 +1,56 @@ +package fr.ird.observe.spi.decoration; + +/*- + * #%L + * ObServe Models :: Dto :: Java + * %% + * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ird.observe.dto.reference.DtoReference; +import fr.ird.observe.dto.referential.common.SpeciesReference; +import fr.ird.observe.dto.referential.ps.common.AcquisitionStatusReference; + +import java.util.Locale; + +/** + * Created on 19/10/2021. + * + * @author Tony Chemit - dev@tchemit.fr + * @since 9.0.0 + */ +public class ObserveDtoReferenceDecoratorRenderer<O extends DtoReference> extends DtoReferenceDecoratorRenderer<O> implements ObserveDefaultDecoratorRenderer{ + + public ObserveDtoReferenceDecoratorRenderer(Class<O> type) { + super(type); + } + + public String speciesLabel(Locale locale, SpeciesReference species) { + if (species == null) { + return onNullValue(locale, null); + } + String faoCode = species.getFaoCode(); + String scientificLabel = species.getScientificLabel(); + String label = label(locale, species); + return speciesLabel(faoCode, scientificLabel, label); + } + + public String fieldEnabler(Locale locale, AcquisitionStatusReference reference) { + return fieldEnabler(locale, reference.isFieldEnabler()); + } +} ===================================== models/persistence/java/src/main/java/fr/ird/observe/spi/decoration/ObserveEntityDecoratorRenderer.java ===================================== @@ -0,0 +1,56 @@ +package fr.ird.observe.spi.decoration; + +/*- + * #%L + * ObServe Models :: Persistence :: Java + * %% + * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ird.observe.entities.Entity; +import fr.ird.observe.entities.referential.common.Species; +import fr.ird.observe.entities.referential.ps.common.AcquisitionStatus; + +import java.util.Locale; + +/** + * Created on 19/10/2021. + * + * @author Tony Chemit - dev@tchemit.fr + * @since 9.0.0 + */ +public class ObserveEntityDecoratorRenderer<O extends Entity> extends EntityDecoratorRenderer<O> implements ObserveDefaultDecoratorRenderer { + + public ObserveEntityDecoratorRenderer(Class<O> type) { + super(type); + } + + public String speciesLabel(Locale locale, Species species) { + if (species == null) { + return onNullValue(locale, null); + } + String faoCode = species.getFaoCode(); + String scientificLabel = species.getScientificLabel(); + String label = label(locale, species); + return speciesLabel(faoCode, scientificLabel, label); + } + + public String fieldEnabler(Locale locale, AcquisitionStatus reference) { + return fieldEnabler(locale, reference.isFieldEnabler()); + } +} ===================================== services/i18n/src/main/i18n/translations/services_en_GB.properties ===================================== @@ -1503,6 +1503,8 @@ observe.referential.ll.observation.SensorDataFormat.type=Sensor data format observe.referential.ll.observation.SensorType.type=Sensor type observe.referential.ll.observation.StomachFullness.type=Stomac fullness observe.referential.ps.common.AcquisitionStatus.advancedSampling=Advanced Sampling +observe.referential.ps.common.AcquisitionStatus.fieldDisabled=Data acquisition not allowed +observe.referential.ps.common.AcquisitionStatus.fieldEnabled=Data acquisition allowed observe.referential.ps.common.AcquisitionStatus.fieldEnabler=Can acquire data? observe.referential.ps.common.AcquisitionStatus.landing=Landing observe.referential.ps.common.AcquisitionStatus.localMarket=Local market ===================================== services/i18n/src/main/i18n/translations/services_es_ES.properties ===================================== @@ -1503,6 +1503,8 @@ observe.referential.ll.observation.SensorDataFormat.type=Formato de los datos de observe.referential.ll.observation.SensorType.type=Tipo de sensor observe.referential.ll.observation.StomachFullness.type=Nivel de llenado del estomago observe.referential.ps.common.AcquisitionStatus.advancedSampling=Advanced Sampling \#TODO +observe.referential.ps.common.AcquisitionStatus.fieldDisabled=Data acquisition not allowed +observe.referential.ps.common.AcquisitionStatus.fieldEnabled=Data acquisition allowed observe.referential.ps.common.AcquisitionStatus.fieldEnabler=Can acquire data? \#TODO observe.referential.ps.common.AcquisitionStatus.landing=Landing observe.referential.ps.common.AcquisitionStatus.localMarket=Local market ===================================== services/i18n/src/main/i18n/translations/services_fr_FR.properties ===================================== @@ -1503,6 +1503,8 @@ observe.referential.ll.observation.SensorDataFormat.type=Format de données de c observe.referential.ll.observation.SensorType.type=Type de capteur observe.referential.ll.observation.StomachFullness.type=Niveau de remplissage de l'estomac observe.referential.ps.common.AcquisitionStatus.advancedSampling=Échantillonnage avancé +observe.referential.ps.common.AcquisitionStatus.fieldDisabled=Saisie de données non autorisée +observe.referential.ps.common.AcquisitionStatus.fieldEnabled=Saisie de données autorisée observe.referential.ps.common.AcquisitionStatus.fieldEnabler=Saisie de données autorisée ? observe.referential.ps.common.AcquisitionStatus.landing=Débarquement observe.referential.ps.common.AcquisitionStatus.localMarket=Marché local View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/3735d66f66237f68a2407a978... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/3735d66f66237f68a2407a978... You're receiving this email because of your account on gitlab.com.