Search in sources :

Example 1 with FishingTripEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityDataUtil method getFishingTripEntity.

public static FishingTripEntity getFishingTripEntity(String typeCode, String typeCodeListId, FaCatchEntity faCatchEntity, FishingActivityEntity fishingActivityEntity) {
    FishingTripEntity fishingTripEntity = new FishingTripEntity();
    fishingTripEntity.setTypeCode(typeCode);
    fishingTripEntity.setTypeCodeListId(typeCodeListId);
    fishingTripEntity.setFaCatch(faCatchEntity);
    fishingTripEntity.setFishingActivity(fishingActivityEntity);
    return fishingTripEntity;
}
Also used : FishingTripEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)

Example 2 with FishingTripEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class MapperUtil method getFishingTripEntity.

public static FishingTripEntity getFishingTripEntity() {
    FishingTripEntity entity = new FishingTripEntity();
    FluxReportDocumentEntity fluxReportDocumentEntity1 = ActivityDataUtil.getFluxReportDocumentEntity("FLUX_REPORT_DOCUMENT1", null, DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "PURPOSE", "PURPOSE_CODE_LIST", null, "OWNER_FLUX_ID1", "flux1");
    FluxReportDocumentEntity fluxReportDocumentEntity2 = ActivityDataUtil.getFluxReportDocumentEntity("FLUX_REPORT_DOCUMENT2", null, DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "PURPOSE", "PURPOSE_CODE_LIST", null, "OWNER_FLUX_ID2", "flux2");
    FluxReportDocumentEntity fluxReportDocumentEntity3 = ActivityDataUtil.getFluxReportDocumentEntity("FLUX_REPORT_DOCUMENT3", null, DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "PURPOSE", "PURPOSE_CODE_LIST", null, "OWNER_FLUX_ID3", "flux3");
    FluxReportDocumentEntity fluxReportDocumentEntity4 = ActivityDataUtil.getFluxReportDocumentEntity("FLUX_REPORT_DOCUMENT4", null, DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "PURPOSE", "PURPOSE_CODE_LIST", null, "OWNER_FLUX_ID4", "flux4");
    VesselTransportMeansEntity vesselTransportMeansEntity1 = ActivityDataUtil.getVesselTransportMeansEntity("PAIR_FISHING_PARTNER", "FA_VESSEL_ROLE", "vesselGroup1", null);
    VesselTransportMeansEntity vesselTransportMeansEntity2 = ActivityDataUtil.getVesselTransportMeansEntity("PAIR_FISHING_PARTNER", "FA_VESSEL_ROLE", "vesselGroup2", null);
    VesselTransportMeansEntity vesselTransportMeansEntity3 = ActivityDataUtil.getVesselTransportMeansEntity("PAIR_FISHING_PARTNER", "FA_VESSEL_ROLE", "vesselGroup3", null);
    vesselTransportMeansEntity1.setVesselIdentifiers(ActivityDataUtil.getVesselIdentifiers(vesselTransportMeansEntity1, "IDENT_1", "CFR"));
    FaReportDocumentEntity faReportDocumentEntity1 = ActivityDataUtil.getFaReportDocumentEntity("Declaration", "FLUX_FA_REPORT_TYPE", DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), fluxReportDocumentEntity1, vesselTransportMeansEntity1, "new");
    FaReportDocumentEntity faReportDocumentEntity2 = ActivityDataUtil.getFaReportDocumentEntity("Declaration", "FLUX_FA_REPORT_TYPE", DateUtils.parseToUTCDate("2015-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), fluxReportDocumentEntity2, vesselTransportMeansEntity2, "new");
    FaReportDocumentEntity faReportDocumentEntity3 = ActivityDataUtil.getFaReportDocumentEntity("Declaration", "FLUX_FA_REPORT_TYPE", DateUtils.parseToUTCDate("2015-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), fluxReportDocumentEntity3, vesselTransportMeansEntity3, "new");
    FishingActivityEntity fishingActivityEntity1 = ActivityDataUtil.getFishingActivityEntity("DEPARTURE", "FLUX_FA_TYPE", DateUtils.parseToUTCDate("2014-05-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "FISHING", "FIS", faReportDocumentEntity1, null);
    FishingActivityEntity fishingActivityEntity2 = ActivityDataUtil.getFishingActivityEntity("ARRIVAL", "FLUX_FA_TYPE", DateUtils.parseToUTCDate("2014-05-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "FISHING", "FIS", faReportDocumentEntity2, null);
    FishingActivityEntity fishingActivityEntity3 = ActivityDataUtil.getFishingActivityEntity("LANDING", "FLUX_FA_TYPE", DateUtils.parseToUTCDate("2014-05-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "FISHING", "FIS", faReportDocumentEntity3, null);
    SizeDistributionEntity sizeDistributionEntity = ActivityDataUtil.getSizeDistributionEntity("LSC", "FISH_SIZE_CLASS", "BFT", "FA_BFT_SIZE_CATEGORY");
    FaCatchEntity faCatchEntity = ActivityDataUtil.getFaCatchEntity(fishingActivityEntity1, "DEPARTURE", "FA_CATCH_TYPE", "beagle2", "FAO_SPECIES", 11112D, 11112.0D, "FLUX_UNIT", "BFT", "WEIGHT_MEANS", sizeDistributionEntity);
    entity = ActivityDataUtil.getFishingTripEntity("JFO", "EU_TRIP_ID", faCatchEntity, fishingActivityEntity1);
    Set<FishingTripIdentifierEntity> fishingTripIdentifiers = new HashSet<>();
    fishingTripIdentifiers.add(ActivityDataUtil.getFishingTripIdentifierEntity(entity, "NOR-TRP-20160517234053706", "EU_TRIP_ID"));
    fishingTripIdentifiers.add(ActivityDataUtil.getFishingTripIdentifierEntity(entity, "NOR-TRP-20160517234053706", "EU_TRIP_ID"));
    entity.setFishingTripIdentifiers(fishingTripIdentifiers);
    return entity;
}
Also used : FishingTripEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity) FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) VesselTransportMeansEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity) FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) FluxReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity) SizeDistributionEntity(eu.europa.ec.fisheries.ers.fa.entities.SizeDistributionEntity) FishingTripIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) HashSet(java.util.HashSet)

Example 3 with FishingTripEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class FaCatchMapperTest method testFaCatchMapper.

@Test
public void testFaCatchMapper() {
    FACatch faCatch = MapperUtil.getFaCatch();
    FaCatchEntity faCatchEntity = FaCatchMapper.INSTANCE.mapToFaCatchEntity(faCatch);
    assertFaCatchFields(faCatch, faCatchEntity);
    assertNull(faCatchEntity.getFishingActivity());
    assertNotNull(faCatchEntity.getAapProcesses());
    AapProcessEntity aapProcessEntity = faCatchEntity.getAapProcesses().iterator().next();
    assertNotNull(aapProcessEntity);
    assertFaCatchFields(faCatch, aapProcessEntity.getFaCatch());
    assertNotNull(faCatchEntity.getAapStocks());
    AapStockEntity aapStockEntity = faCatchEntity.getAapStocks().iterator().next();
    assertNotNull(aapStockEntity);
    assertFaCatchFields(faCatch, aapStockEntity.getFaCatch());
    assertNotNull(faCatchEntity.getSizeDistribution());
    assertFaCatchFields(faCatch, faCatchEntity.getSizeDistribution().getFaCatch());
    assertNotNull(faCatchEntity.getFishingGears());
    FishingGearEntity fishingGearEntity = faCatchEntity.getFishingGears().iterator().next();
    assertNotNull(fishingGearEntity);
    assertFaCatchFields(faCatch, fishingGearEntity.getFaCatch());
    assertNotNull(faCatchEntity.getFishingTrips());
    FishingTripEntity fishingTripEntity = faCatchEntity.getFishingTrips().iterator().next();
    assertNotNull(fishingTripEntity);
    assertFaCatchFields(faCatch, fishingTripEntity.getFaCatch());
    assertNotNull(faCatchEntity.getFluxCharacteristics());
    FluxCharacteristicEntity fluxCharacteristicEntity = faCatchEntity.getFluxCharacteristics().iterator().next();
    assertNotNull(fluxCharacteristicEntity);
    assertFaCatchFields(faCatch, fluxCharacteristicEntity.getFaCatch());
    assertNotNull(faCatchEntity.getFluxLocations());
    FluxLocationEntity fluxLocationEntity = faCatchEntity.getFluxLocations().iterator().next();
    assertNotNull(fluxLocationEntity);
    assertFaCatchFields(faCatch, fluxLocationEntity.getFaCatch());
}
Also used : FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) AapStockEntity(eu.europa.ec.fisheries.ers.fa.entities.AapStockEntity) FishingTripEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity) AapProcessEntity(eu.europa.ec.fisheries.ers.fa.entities.AapProcessEntity) FACatch(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch) FishingGearEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity) FluxCharacteristicEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) Test(org.junit.Test)

Example 4 with FishingTripEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingTripMapperTest method getFishingTripWithFACatch.

@Test
public void getFishingTripWithFACatch() {
    FishingTrip fishingTrip = MapperUtil.getFishingTrip();
    FishingTripEntity fishingTripEntity = FishingTripMapper.INSTANCE.mapToFishingTripEntity(fishingTrip);
    assertEquals(fishingTrip.getTypeCode().getValue(), fishingTripEntity.getTypeCode());
    assertEquals(fishingTrip.getTypeCode().getListID(), fishingTripEntity.getTypeCodeListId());
    assertNull(fishingTripEntity.getFaCatch());
    assertNotNull(fishingTripEntity.getDelimitedPeriods());
    assertNotNull(fishingTripEntity.getFishingTripIdentifiers());
}
Also used : FishingTripEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity) FishingTrip(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingTrip) Test(org.junit.Test)

Example 5 with FishingTripEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class BaseMapper method mapToFishingTripEntity.

private static FishingTripEntity mapToFishingTripEntity(FishingTrip fishingTrip) {
    FishingTripEntity fishingTripEntity = FishingTripMapper.INSTANCE.mapToFishingTripEntity(fishingTrip);
    List<IDType> ids = fishingTrip.getIDS();
    if (CollectionUtils.isNotEmpty(ids)) {
        for (IDType idType : ids) {
            fishingTripEntity.addFishingTripIdentifiers(FishingTripIdentifierMapper.INSTANCE.mapToFishingTripIdentifier(idType));
        }
    }
    List<DelimitedPeriod> specifiedDelimitedPeriods = fishingTrip.getSpecifiedDelimitedPeriods();
    if (CollectionUtils.isNotEmpty(specifiedDelimitedPeriods)) {
        for (DelimitedPeriod delimitedPeriod : specifiedDelimitedPeriods) {
            fishingTripEntity.addDelimitedPeriods(DelimitedPeriodMapper.INSTANCE.mapToDelimitedPeriodEntity(delimitedPeriod));
        }
    }
    return fishingTripEntity;
}
Also used : FishingTripEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity) DelimitedPeriod(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.DelimitedPeriod) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)

Aggregations

FishingTripEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)15 HashSet (java.util.HashSet)6 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)4 FishingTripIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity)4 VesselTransportMeansEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity)4 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)3 FishingTrip (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingTrip)3 Sets.newHashSet (com.google.common.collect.Sets.newHashSet)2 FaReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)2 FishingActivityIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity)2 FishingGearEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity)2 FluxCharacteristicEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity)2 FluxLocationEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)2 FluxReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity)2 TripOverviewDto (eu.europa.ec.fisheries.ers.service.dto.view.TripOverviewDto)2 AapProcessEntity (eu.europa.ec.fisheries.ers.fa.entities.AapProcessEntity)1 AapStockEntity (eu.europa.ec.fisheries.ers.fa.entities.AapStockEntity)1 ContactPartyEntity (eu.europa.ec.fisheries.ers.fa.entities.ContactPartyEntity)1