Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: cfc5fee9 by tchemit at 2018-12-11T20:34:02Z [V8][DATA MODEL] Retours sur le modèle V8 alpha - Close #1166 - Now entityEnum use schema name (next step is to move entities to specific packages - - - - - 8 changed files: - persistence/src/main/java/fr/ird/observe/entities/referentiel/SpeciesTopiaDao.java - persistence/src/main/java/fr/ird/observe/persistence/Entities.java - persistence/src/main/java/fr/ird/observe/persistence/ObserveTopiaApplicationContext.java - pom.xml - services-local/src/main/java/fr/ird/observe/services/local/service/actions/synchro/referential/diff/ReferentialSynchronizeDiffServiceLocal.java - services-local/src/main/java/fr/ird/observe/services/local/service/sql/SqlScriptProducerServiceLocal.java - services-local/src/test/java/fr/ird/observe/services/local/service/actions/synchro/UnidirectionalSynchronizeReferentialTest.java - test/src/main/resources/fixtures/count-referential-longline.properties Changes: ===================================== persistence/src/main/java/fr/ird/observe/entities/referentiel/SpeciesTopiaDao.java ===================================== @@ -45,7 +45,7 @@ public class SpeciesTopiaDao extends AbstractSpeciesTopiaDao<Species> { " WHERE main.topiaId=secondary.catch AND secondary.predator='" + entity.getTopiaId() + "'"; List<CatchLonglineObs> list = hibernateSession .createSQLQuery(sql) - .addEntity("main", ObserveEntityEnum.CatchLonglineObs.getImplementation()) + .addEntity("main", ObserveEntityEnum.ll_observation_CatchLonglineObs.getImplementation()) .list(); for (CatchLonglineObs item : list) { ===================================== persistence/src/main/java/fr/ird/observe/persistence/Entities.java ===================================== @@ -46,139 +46,139 @@ public class Entities { public static final ObserveEntityEnum[] REFERENCE_ENTITIES = new ObserveEntityEnum[]{ - ObserveEntityEnum.VesselSizeCategory, - ObserveEntityEnum.Country, - ObserveEntityEnum.Compagnies, - ObserveEntityEnum.LengthMeasureMethod, - ObserveEntityEnum.WeightMeasureMethod, - ObserveEntityEnum.DataQuality, - ObserveEntityEnum.ShipOwner, - ObserveEntityEnum.Harbour, - ObserveEntityEnum.VesselType, - ObserveEntityEnum.Vessel, - ObserveEntityEnum.NonTargetCatchReleaseConformity, - ObserveEntityEnum.NonTargetCatchReleaseStatus, - ObserveEntityEnum.NonTargetCatchReleasingTime, - ObserveEntityEnum.SpeciesGroupReleaseMode, - ObserveEntityEnum.SpeciesGroup, - ObserveEntityEnum.Ocean, - ObserveEntityEnum.SizeMeasureType, - ObserveEntityEnum.WeightMeasureType, - ObserveEntityEnum.Wind, - ObserveEntityEnum.Species, - ObserveEntityEnum.Sex, - ObserveEntityEnum.FpaZone, - ObserveEntityEnum.SpeciesList, - ObserveEntityEnum.Person, - ObserveEntityEnum.Organism, - ObserveEntityEnum.LengthLengthParameter, - ObserveEntityEnum.LengthWeightParameter, - ObserveEntityEnum.Program, - ObserveEntityEnum.GearCaracteristicType, - ObserveEntityEnum.GearCaracteristic, - ObserveEntityEnum.Gear, - ObserveEntityEnum.LastUpdateDate, + ObserveEntityEnum.common_VesselSizeCategory, + ObserveEntityEnum.common_Country, + ObserveEntityEnum.common_Compagnies, + ObserveEntityEnum.common_LengthMeasureMethod, + ObserveEntityEnum.common_WeightMeasureMethod, + ObserveEntityEnum.common_DataQuality, + ObserveEntityEnum.common_ShipOwner, + ObserveEntityEnum.common_Harbour, + ObserveEntityEnum.common_VesselType, + ObserveEntityEnum.common_Vessel, + ObserveEntityEnum.ps_observation_NonTargetCatchReleaseConformity, + ObserveEntityEnum.ps_observation_NonTargetCatchReleaseStatus, + ObserveEntityEnum.ps_observation_NonTargetCatchReleasingTime, + ObserveEntityEnum.common_SpeciesGroupReleaseMode, + ObserveEntityEnum.common_SpeciesGroup, + ObserveEntityEnum.common_Ocean, + ObserveEntityEnum.common_SizeMeasureType, + ObserveEntityEnum.common_WeightMeasureType, + ObserveEntityEnum.common_Wind, + ObserveEntityEnum.common_Species, + ObserveEntityEnum.common_Sex, + ObserveEntityEnum.common_FpaZone, + ObserveEntityEnum.common_SpeciesList, + ObserveEntityEnum.common_Person, + ObserveEntityEnum.common_Organism, + ObserveEntityEnum.common_LengthLengthParameter, + ObserveEntityEnum.common_LengthWeightParameter, + ObserveEntityEnum.common_Program, + ObserveEntityEnum.common_GearCaracteristicType, + ObserveEntityEnum.common_GearCaracteristic, + ObserveEntityEnum.common_Gear, + ObserveEntityEnum.common_LastUpdateDate, - ObserveEntityEnum.VesselActivitySeine, - ObserveEntityEnum.SurroundingActivity, - ObserveEntityEnum.ReasonForNullSet, - ObserveEntityEnum.ReasonForNoFishing, - ObserveEntityEnum.SpeciesFate, - ObserveEntityEnum.WeightCategorySeine, - ObserveEntityEnum.DetectionMode, - ObserveEntityEnum.TransmittingBuoyOperation, - ObserveEntityEnum.ObjectOperation, - ObserveEntityEnum.ObjectMaterialType, - ObserveEntityEnum.ObjectMaterial, - ObserveEntityEnum.ReasonForDiscard, - ObserveEntityEnum.SpeciesStatus, - ObserveEntityEnum.ObservedSystem, - ObserveEntityEnum.TransmittingBuoyType, + ObserveEntityEnum.ps_observation_VesselActivitySeine, + ObserveEntityEnum.ps_observation_SurroundingActivity, + ObserveEntityEnum.ps_observation_ReasonForNullSet, + ObserveEntityEnum.ps_observation_ReasonForNoFishing, + ObserveEntityEnum.ps_common_SpeciesFate, + ObserveEntityEnum.ps_observation_WeightCategorySeine, + ObserveEntityEnum.ps_observation_DetectionMode, + ObserveEntityEnum.ps_common_TransmittingBuoyOperation, + ObserveEntityEnum.ps_observation_ObjectOperation, + ObserveEntityEnum.ps_observation_ObjectMaterialType, + ObserveEntityEnum.ps_observation_ObjectMaterial, + ObserveEntityEnum.ps_observation_ReasonForDiscard, + ObserveEntityEnum.ps_observation_SpeciesStatus, + ObserveEntityEnum.ps_observation_ObservedSystem, + ObserveEntityEnum.ps_common_TransmittingBuoyType, - ObserveEntityEnum.BaitHaulingStatus, - ObserveEntityEnum.BaitSettingStatus, - ObserveEntityEnum.BaitType, - ObserveEntityEnum.CatchFateLongline, - ObserveEntityEnum.EncounterType, - ObserveEntityEnum.Healthness, - ObserveEntityEnum.HookPosition, - ObserveEntityEnum.HookSize, - ObserveEntityEnum.HookType, - ObserveEntityEnum.ItemVerticalPosition, - ObserveEntityEnum.ItemHorizontalPosition, - ObserveEntityEnum.LightsticksColor, - ObserveEntityEnum.LightsticksType, - ObserveEntityEnum.LineType, - ObserveEntityEnum.MaturityStatus, - ObserveEntityEnum.MitigationType, - ObserveEntityEnum.ObservationMethod, - ObserveEntityEnum.SensorBrand, - ObserveEntityEnum.SensorDataFormat, - ObserveEntityEnum.SensorType, - ObserveEntityEnum.SettingShape, - ObserveEntityEnum.StomacFullness, - ObserveEntityEnum.WeightCategoryLongline, - ObserveEntityEnum.WeightDeterminationMethod, - ObserveEntityEnum.VesselActivityLongline, - ObserveEntityEnum.Conservation, - ObserveEntityEnum.OnBoardProcessing, - ObserveEntityEnum.DataSource, - ObserveEntityEnum.TripType + ObserveEntityEnum.ll_observation_BaitHaulingStatus, + ObserveEntityEnum.ll_common_BaitSettingStatus, + ObserveEntityEnum.ll_common_BaitType, + ObserveEntityEnum.ll_common_CatchFateLongline, + ObserveEntityEnum.ll_observation_EncounterType, + ObserveEntityEnum.ll_common_Healthness, + ObserveEntityEnum.ll_observation_HookPosition, + ObserveEntityEnum.ll_common_HookSize, + ObserveEntityEnum.ll_common_HookType, + ObserveEntityEnum.ll_observation_ItemVerticalPosition, + ObserveEntityEnum.ll_observation_ItemHorizontalPosition, + ObserveEntityEnum.ll_common_LightsticksColor, + ObserveEntityEnum.ll_common_LightsticksType, + ObserveEntityEnum.ll_common_LineType, + ObserveEntityEnum.ll_observation_MaturityStatus, + ObserveEntityEnum.ll_common_MitigationType, + ObserveEntityEnum.ll_common_ObservationMethod, + ObserveEntityEnum.ll_observation_SensorBrand, + ObserveEntityEnum.ll_observation_SensorDataFormat, + ObserveEntityEnum.ll_observation_SensorType, + ObserveEntityEnum.ll_common_SettingShape, + ObserveEntityEnum.ll_observation_StomacFullness, + ObserveEntityEnum.ll_common_WeightCategoryLongline, + ObserveEntityEnum.ll_common_WeightDeterminationMethod, + ObserveEntityEnum.ll_common_VesselActivityLongline, + ObserveEntityEnum.ll_landing_Conservation, + ObserveEntityEnum.ll_common_OnBoardProcessing, + ObserveEntityEnum.ll_landing_DataSource, + ObserveEntityEnum.ll_common_TripType }; public static final List<ObserveEntityEnum> REFERENCE_ENTITIES_LIST = Collections.unmodifiableList(Arrays.asList(REFERENCE_ENTITIES)); public static final ObserveEntityEnum[] DATA_ENTITIES = new ObserveEntityEnum[]{ - ObserveEntityEnum.TargetSample, - ObserveEntityEnum.TargetLength, - ObserveEntityEnum.NonTargetSample, - ObserveEntityEnum.NonTargetLength, - ObserveEntityEnum.NonTargetCatchRelease, - ObserveEntityEnum.NonTargetCatch, - ObserveEntityEnum.SetSeine, - ObserveEntityEnum.TargetCatch, - ObserveEntityEnum.TransmittingBuoy, - ObserveEntityEnum.ObjectObservedSpecies, - ObserveEntityEnum.SchoolEstimate, - ObserveEntityEnum.ObjectSchoolEstimate, - ObserveEntityEnum.FloatingObjectPart, - ObserveEntityEnum.FloatingObject, - ObserveEntityEnum.ActivitySeine, - ObserveEntityEnum.Route, - ObserveEntityEnum.GearUseFeaturesMeasurementSeine, - ObserveEntityEnum.GearUseFeaturesSeine, - ObserveEntityEnum.TripSeine, + ObserveEntityEnum.ps_observation_TargetSample, + ObserveEntityEnum.ps_observation_TargetLength, + ObserveEntityEnum.ps_observation_NonTargetSample, + ObserveEntityEnum.ps_observation_NonTargetLength, + ObserveEntityEnum.ps_observation_NonTargetCatchRelease, + ObserveEntityEnum.ps_observation_NonTargetCatch, + ObserveEntityEnum.ps_observation_SetSeine, + ObserveEntityEnum.ps_observation_TargetCatch, + ObserveEntityEnum.ps_observation_TransmittingBuoy, + ObserveEntityEnum.ps_observation_ObjectObservedSpecies, + ObserveEntityEnum.ps_observation_SchoolEstimate, + ObserveEntityEnum.ps_observation_ObjectSchoolEstimate, + ObserveEntityEnum.ps_observation_FloatingObjectPart, + ObserveEntityEnum.ps_observation_FloatingObject, + ObserveEntityEnum.ps_observation_ActivitySeine, + ObserveEntityEnum.ps_observation_Route, + ObserveEntityEnum.ps_common_GearUseFeaturesMeasurementSeine, + ObserveEntityEnum.ps_common_GearUseFeaturesSeine, + ObserveEntityEnum.ps_common_TripSeine, - ObserveEntityEnum.HooksCompositionObs, - ObserveEntityEnum.BranchlinesCompositionObs, - ObserveEntityEnum.BaitsCompositionObs, - ObserveEntityEnum.FloatlinesCompositionObs, - ObserveEntityEnum.HooksCompositionLogbook, - ObserveEntityEnum.BranchlinesCompositionLogbook, - ObserveEntityEnum.BaitsCompositionLogbook, - ObserveEntityEnum.FloatlinesCompositionLogbook, - ObserveEntityEnum.SizeMeasureObs, - ObserveEntityEnum.WeightMeasureObs, - ObserveEntityEnum.SetLonglineObs, - ObserveEntityEnum.SamplePartLogbook, - ObserveEntityEnum.SampleLogbook, - ObserveEntityEnum.SetLonglineLogbook, - ObserveEntityEnum.BranchlineObs, - ObserveEntityEnum.BasketObs, - ObserveEntityEnum.SectionObs, - ObserveEntityEnum.CatchLonglineObs, - ObserveEntityEnum.CatchLonglineLogbook, - ObserveEntityEnum.TdrObs, - ObserveEntityEnum.EncounterObs, - ObserveEntityEnum.SensorUsedObs, - ObserveEntityEnum.LandingPartLongline, - ObserveEntityEnum.LandingLongline, - ObserveEntityEnum.ActivityLonglineObs, - ObserveEntityEnum.ActivityLonglineLogbook, - ObserveEntityEnum.TdrRecordObs, - ObserveEntityEnum.GearUseFeaturesMeasurementLongline, - ObserveEntityEnum.GearUseFeaturesLongline, - ObserveEntityEnum.TripLongline + ObserveEntityEnum.ll_observation_HooksCompositionObs, + ObserveEntityEnum.ll_observation_BranchlinesCompositionObs, + ObserveEntityEnum.ll_observation_BaitsCompositionObs, + ObserveEntityEnum.ll_observation_FloatlinesCompositionObs, + ObserveEntityEnum.ll_logbook_HooksCompositionLogbook, + ObserveEntityEnum.ll_logbook_BranchlinesCompositionLogbook, + ObserveEntityEnum.ll_logbook_BaitsCompositionLogbook, + ObserveEntityEnum.ll_logbook_FloatlinesCompositionLogbook, + ObserveEntityEnum.ll_observation_SizeMeasureObs, + ObserveEntityEnum.ll_observation_WeightMeasureObs, + ObserveEntityEnum.ll_observation_SetLonglineObs, + ObserveEntityEnum.ll_logbook_SamplePartLogbook, + ObserveEntityEnum.ll_logbook_SampleLogbook, + ObserveEntityEnum.ll_logbook_SetLonglineLogbook, + ObserveEntityEnum.ll_observation_BranchlineObs, + ObserveEntityEnum.ll_observation_BasketObs, + ObserveEntityEnum.ll_observation_SectionObs, + ObserveEntityEnum.ll_observation_CatchLonglineObs, + ObserveEntityEnum.ll_logbook_CatchLonglineLogbook, + ObserveEntityEnum.ll_observation_TdrObs, + ObserveEntityEnum.ll_observation_EncounterObs, + ObserveEntityEnum.ll_observation_SensorUsedObs, + ObserveEntityEnum.ll_landing_LandingPartLongline, + ObserveEntityEnum.ll_landing_LandingLongline, + ObserveEntityEnum.ll_observation_ActivityLonglineObs, + ObserveEntityEnum.ll_logbook_ActivityLonglineLogbook, + ObserveEntityEnum.ll_observation_TdrRecordObs, + ObserveEntityEnum.ll_common_GearUseFeaturesMeasurementLongline, + ObserveEntityEnum.ll_common_GearUseFeaturesLongline, + ObserveEntityEnum.ll_common_TripLongline }; /** * FIXME : cela n'est pas vrai !!! (voir l'algortihme de replication qui ===================================== persistence/src/main/java/fr/ird/observe/persistence/ObserveTopiaApplicationContext.java ===================================== @@ -272,7 +272,7 @@ public class ObserveTopiaApplicationContext extends AbstractObserveTopiaApplicat if (tripSeineTables == null) { log.debug("Loading tripSeineTables."); - tripSeineTables = topiaSqlTablesFactory.newReplicateEntityTables(new TripReplicateTablesPredicate(), ObserveEntityEnum.TripSeine); + tripSeineTables = topiaSqlTablesFactory.newReplicateEntityTables(new TripReplicateTablesPredicate(), ObserveEntityEnum.ps_common_TripSeine); log.info(String.format("For TripSeine, found %d tables to use.", tripSeineTables.size())); } return tripSeineTables; @@ -282,7 +282,7 @@ public class ObserveTopiaApplicationContext extends AbstractObserveTopiaApplicat if (tripLonglineTables == null) { log.debug("Loading tripLonglineTables."); - tripLonglineTables = topiaSqlTablesFactory.newReplicateEntityTables(new TripReplicateTablesPredicate(), ObserveEntityEnum.TripLongline); + tripLonglineTables = topiaSqlTablesFactory.newReplicateEntityTables(new TripReplicateTablesPredicate(), ObserveEntityEnum.ll_common_TripLongline); log.info(String.format("For TripLongline, found %d tables to use.", tripLonglineTables.size())); TopiaSqlTable basketTable = tripLonglineTables.getTable("ll_observation.basket"); @@ -341,12 +341,12 @@ public class ObserveTopiaApplicationContext extends AbstractObserveTopiaApplicat private final Set<TopiaMetadataEntity> dones = new LinkedHashSet<>(); private final Set<String> sections = ImmutableSet.of( - ObserveEntityEnum.BranchlineObs.name(), - ObserveEntityEnum.BasketObs.name(), - ObserveEntityEnum.SectionObs.name()); + ObserveEntityEnum.ll_observation_BranchlineObs.name(), + ObserveEntityEnum.ll_observation_BasketObs.name(), + ObserveEntityEnum.ll_observation_SectionObs.name()); private final Set<String> sectionsHolders = ImmutableSet.of( - ObserveEntityEnum.CatchLonglineObs.name(), - ObserveEntityEnum.TdrObs.name()); + ObserveEntityEnum.ll_observation_CatchLonglineObs.name(), + ObserveEntityEnum.ll_observation_TdrObs.name()); @Override public boolean acceptEntity(TopiaMetadataEntity metadataEntity) { @@ -360,7 +360,7 @@ public class ObserveTopiaApplicationContext extends AbstractObserveTopiaApplicat @Override public boolean acceptReversedAssociation(TopiaMetadataEntity metadataEntity, String propertyName, TopiaMetadataEntity propertyType) { - return !(ObserveEntityEnum.ActivityLonglineObs.name().equals(propertyType.getType()) && ObserveEntityEnum.ActivityLonglineLogbook.name().equals(metadataEntity.getType())); + return !(ObserveEntityEnum.ll_observation_ActivityLonglineObs.name().equals(propertyType.getType()) && ObserveEntityEnum.ll_logbook_ActivityLonglineLogbook.name().equals(metadataEntity.getType())); } ===================================== pom.xml ===================================== @@ -156,7 +156,7 @@ <buildDate>${maven.build.timestamp}</buildDate> <observeToolkitVersion>4.9</observeToolkitVersion> - <!--<lib.version.java4all.topia>1.1.9</lib.version.java4all.topia>--> + <lib.version.java4all.topia>1.2-SNAPSHOT</lib.version.java4all.topia> <!--<lib.version.java4all.eugene>3.0-alpha-22</lib.version.java4all.eugene>--> <!--<lib.version.java4all.jaxx>3.0-alpha-45-SNAPSHOT</lib.version.java4all.jaxx>--> <!--<lib.version.java4all.i18n>4.0-beta-3-SNAPSHOT</lib.version.java4all.i18n>--> ===================================== services-local/src/main/java/fr/ird/observe/services/local/service/actions/synchro/referential/diff/ReferentialSynchronizeDiffServiceLocal.java ===================================== @@ -109,7 +109,7 @@ public class ReferentialSynchronizeDiffServiceLocal extends ObserveServiceLocal ReferentialDataSourceStates referentialStates = new ReferentialDataSourceStates(); for (ObserveEntityEnum referenceEntity : Entities.REFERENCE_ENTITIES) { - if (ObserveEntityEnum.LastUpdateDate.equals(referenceEntity)) { + if (ObserveEntityEnum.common_LastUpdateDate.equals(referenceEntity)) { continue; } //noinspection unchecked ===================================== services-local/src/main/java/fr/ird/observe/services/local/service/sql/SqlScriptProducerServiceLocal.java ===================================== @@ -117,7 +117,7 @@ public class SqlScriptProducerServiceLocal extends ObserveServiceLocal implement ListMultimap<Class<? extends ReferentialDtoReference>, String> referentialIds = request.getReferentialIds(); for (ObserveEntityEnum entityEnum : REFERENCE_ENTITIES_LIST) { - if (ObserveEntityEnum.LastUpdateDate.equals(entityEnum)) { + if (ObserveEntityEnum.common_LastUpdateDate.equals(entityEnum)) { continue; } Class entityType = entityEnum.getContract(); ===================================== services-local/src/test/java/fr/ird/observe/services/local/service/actions/synchro/UnidirectionalSynchronizeReferentialTest.java ===================================== @@ -99,21 +99,21 @@ public class UnidirectionalSynchronizeReferentialTest extends ServiceLocalTestSu Assert.assertFalse(referentialNames.isEmpty()); for (ObserveEntityEnum referenceEntity : Entities.REFERENCE_ENTITIES) { - if (ObserveEntityEnum.LastUpdateDate.equals(referenceEntity)) { + if (ObserveEntityEnum.common_LastUpdateDate.equals(referenceEntity)) { continue; } - if (ObserveEntityEnum.LengthLengthParameter.equals(referenceEntity)) { + if (ObserveEntityEnum.common_LengthLengthParameter.equals(referenceEntity)) { //empty continue; } - if (ObserveEntityEnum.WeightDeterminationMethod.equals(referenceEntity)) { + if (ObserveEntityEnum.ll_common_WeightDeterminationMethod.equals(referenceEntity)) { //empty continue; - }if (ObserveEntityEnum.WeightCategoryLongline.equals(referenceEntity)) { + }if (ObserveEntityEnum.ll_common_WeightCategoryLongline.equals(referenceEntity)) { //empty continue; } - if (ObserveEntityEnum.Compagnies.equals(referenceEntity)) { + if (ObserveEntityEnum.common_Compagnies.equals(referenceEntity)) { //empty continue; } @@ -145,7 +145,7 @@ public class UnidirectionalSynchronizeReferentialTest extends ServiceLocalTestSu Assert.assertTrue(referentialNames.isEmpty()); for (ObserveEntityEnum referenceEntity : Entities.REFERENCE_ENTITIES) { - if (ObserveEntityEnum.LastUpdateDate.equals(referenceEntity)) { + if (ObserveEntityEnum.common_LastUpdateDate.equals(referenceEntity)) { continue; } Class<? extends ReferentialDto> dtoType = DbModelHelper.fromReferentialEntity(referenceEntity).toDtoType(); ===================================== test/src/main/resources/fixtures/count-referential-longline.properties ===================================== @@ -35,13 +35,13 @@ ll_common.lightstickstype=2 ll_common.linetype=9 ll_observation.maturitystatus=12 ll_common.mitigationtype=15 -ll_common.observationMethod=2 +ll_common.observationmethod=2 ll_observation.sensorbrand=4 ll_observation.sensordataformat=2 ll_observation.sensortype=4 ll_common.settingshape=6 ll_observation.stomacfullness=7 -ll_common.vesselActivity=12 +ll_common.vesselactivity=12 ll_common.weightcategory=0 ll_landing.datasource=20 ll_common.triptype=2 View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/cfc5fee9b8cfdd4a738446138cb6... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/cfc5fee9b8cfdd4a738446138cb6... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT