Search in sources :

Example 1 with FACatch

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch in project UVMS-ActivityModule-APP by UnionVMS.

the class MapperUtil method getStandardFishingActivity.

private static FishingActivity getStandardFishingActivity() {
    List<IDType> ids = Arrays.asList(getIdType("Id_1", "fhr574fh-thrud754-kgitjf754-gjtufe89"));
    CodeType typeCode = getCodeType("FISHING_OPERATION", "FLUX_FA_TYPE");
    DateTimeType occurrenceDateTime = getDateTimeType("2016-07-01 11:15:00");
    CodeType reasonCode = getCodeType("Reason_code_1", "FA_REASON_DEPARTURE");
    CodeType vesselRelatedActivityCode = getCodeType("Vessel activity 1", "58thft-58fjd8-gt85eje-hjgute8");
    CodeType fisheryTypeCode = getCodeType("Fishing_Type_code 1", "FA_FISHERY");
    CodeType speciesTargetCode = getCodeType("Species code 1", "FAO_SPECIES");
    QuantityType operationsQuantity = getQuantityType(100);
    MeasureType fishingDurationMeasure = getMeasureType(500, "C62", "4hr2yf0-t583thf-6jgttue8-6jtie844");
    List<FLAPDocument> specifiedFLAPDocument = Arrays.asList(getFlapDocument());
    VesselStorageCharacteristic sourceVesselStorageCharacteristic = getVesselStorageCharacteristic();
    VesselStorageCharacteristic destinationVesselStorageCharacteristic = getVesselStorageCharacteristic();
    List<FACatch> specifiedFACatches = Arrays.asList(getFaCatch());
    List<FLUXLocation> relatedFLUXLocations = Arrays.asList(getFluxLocation());
    List<GearProblem> specifiedGearProblems = Arrays.asList(getGearProblem());
    List<FLUXCharacteristic> specifiedFLUXCharacteristics = Arrays.asList(getFluxCharacteristics());
    List<FishingGear> specifiedFishingGears = Arrays.asList(getFishingGear());
    List<DelimitedPeriod> specifiedDelimitedPeriods = Arrays.asList(getDelimitedPeriod());
    FishingTrip specifiedFishingTrip = getFishingTrip();
    List<VesselTransportMeans> relatedVesselTransportMeans = Arrays.asList(getVesselTransportMeans());
    FishingActivity fishingActivity = new FishingActivity(ids, typeCode, occurrenceDateTime, reasonCode, vesselRelatedActivityCode, fisheryTypeCode, speciesTargetCode, operationsQuantity, fishingDurationMeasure, specifiedFACatches, relatedFLUXLocations, specifiedGearProblems, specifiedFLUXCharacteristics, specifiedFishingGears, sourceVesselStorageCharacteristic, destinationVesselStorageCharacteristic, null, specifiedFLAPDocument, specifiedDelimitedPeriods, specifiedFishingTrip, relatedVesselTransportMeans);
    return fishingActivity;
}
Also used : DelimitedPeriod(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.DelimitedPeriod) FLAPDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLAPDocument) FishingGear(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingGear) MeasureType(un.unece.uncefact.data.standard.unqualifieddatatype._20.MeasureType) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType) GearProblem(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.GearProblem) FishingActivity(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity) VesselStorageCharacteristic(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselStorageCharacteristic) FLUXCharacteristic(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXCharacteristic) VesselTransportMeans(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans) DateTimeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType) QuantityType(un.unece.uncefact.data.standard.unqualifieddatatype._20.QuantityType) FLUXLocation(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXLocation) FishingTrip(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingTrip) CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType) FACatch(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch)

Example 2 with FACatch

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch in project UVMS-ActivityModule-APP by UnionVMS.

the class AapProductMapperTest method testMapToProcessingProduct.

@Test
public void testMapToProcessingProduct() {
    // Prepare
    FACatch faCatch = MapperUtil.getFaCatch();
    FaCatchEntity faCatchEntity = new FaCatchEntity();
    FaCatchMapper.INSTANCE.mapToFaCatchEntity(faCatch);
    AAPProcess aapProcess = MapperUtil.getAapProcess();
    AapProcessEntity aapProcessEntity = AapProcessMapper.INSTANCE.mapToAapProcessEntity(aapProcess);
    aapProcessEntity.setFaCatch(faCatchEntity);
    AAPProduct aapProduct = MapperUtil.getAapProduct();
    AapProductEntity aapProductEntity = AapProductMapper.INSTANCE.mapToAapProductEntity(aapProduct);
    aapProductEntity.setAapProcess(aapProcessEntity);
    // Create Input data
    ProcessingProductsDto processingProductsDto = AapProductMapper.INSTANCE.mapToProcessingProduct(aapProductEntity);
    assertEquals(processingProductsDto.getType(), faCatchEntity.getTypeCode());
    assertEquals(processingProductsDto.getGear(), faCatchEntity.getGearTypeCode());
    assertEquals(processingProductsDto.getSpecies(), faCatchEntity.getSpeciesCode());
    assertNull(processingProductsDto.getPreservation());
    assertNull(processingProductsDto.getPresentation());
    assertNull(processingProductsDto.getFreshness());
    assertEquals(processingProductsDto.getConversionFactor(), aapProcessEntity.getConversionFactor().doubleValue());
    assertEquals(processingProductsDto.getWeight(), aapProductEntity.getCalculatedWeightMeasure());
    assertEquals(processingProductsDto.getQuantity(), aapProductEntity.getUnitQuantity());
    assertEquals(processingProductsDto.getPackageWeight(), aapProductEntity.getPackagingUnitAvarageWeight());
    assertEquals(processingProductsDto.getPackageQuantity().doubleValue(), aapProductEntity.getPackagingUnitCount().doubleValue());
    assertEquals(processingProductsDto.getPackagingType(), aapProductEntity.getPackagingTypeCode());
}
Also used : FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) AAPProduct(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.AAPProduct) AAPProcess(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.AAPProcess) ProcessingProductsDto(eu.europa.ec.fisheries.ers.service.dto.view.ProcessingProductsDto) AapProcessEntity(eu.europa.ec.fisheries.ers.fa.entities.AapProcessEntity) FACatch(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch) AapProductEntity(eu.europa.ec.fisheries.ers.fa.entities.AapProductEntity) Test(org.junit.Test)

Example 3 with FACatch

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch 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 FACatch

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingActivityMapper method getFaCatchEntities.

protected Set<FaCatchEntity> getFaCatchEntities(List<FACatch> faCatches, FishingActivityEntity fishingActivityEntity) {
    if (faCatches == null || faCatches.isEmpty()) {
        return Collections.emptySet();
    }
    Set<FaCatchEntity> faCatchEntities = new HashSet<>();
    for (FACatch faCatch : faCatches) {
        FaCatchEntity faCatchEntity = FaCatchMapper.INSTANCE.mapToFaCatchEntity(faCatch);
        faCatchEntity.setFishingActivity(fishingActivityEntity);
        faCatchEntity.setGearTypeCode(extractFishingGearTypeCode(faCatchEntity.getFishingGears()));
        faCatchEntity.setPresentation(extractPresentation(faCatchEntity.getAapProcesses()));
        faCatchEntities.add(mapFluxLocationSchemeIds(faCatch, faCatchEntity));
    }
    return faCatchEntities;
}
Also used : FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) FACatch(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch) HashSet(java.util.HashSet)

Example 5 with FACatch

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch in project UVMS-ActivityModule-APP by UnionVMS.

the class MapperUtil method getFaCatch.

public static FACatch getFaCatch() {
    CodeType speciesCode = getCodeType("ONBOARD", "FAO_SPECIES");
    QuantityType unitQuantity = getQuantityType(100);
    MeasureType weightMeasure = getMeasureType(123, "C62", "586jhg-5htuf95-5jfit-5jtier8");
    CodeType weighingMeansCode = getCodeType("Weighing means code 1", "5854tt5-gjtdir-5j85tui-589git");
    CodeType usageCode = getCodeType("Usage code 1", "58thft-58fjd8-gt85eje-hjgute8");
    CodeType typeCode = getCodeType("Type code 1", "FA_CATCH_TYPE");
    final List<FishingTrip> relatedFishingTrips = Arrays.asList(getFishingTrip());
    SizeDistribution specifiedSizeDistribution = getSizeDistribution();
    List<AAPStock> relatedAAPStocks = Arrays.asList(getAapStock());
    List<AAPProcess> appliedAAPProcesses = Arrays.asList(getAapProcess());
    List<SalesBatch> relatedSalesBatches = null;
    List<FLUXLocation> specifiedFLUXLocations = Arrays.asList(getFluxLocation());
    List<FishingGear> usedFishingGears = Arrays.asList(getFishingGear());
    List<FLUXCharacteristic> applicableFLUXCharacteristics = Arrays.asList(getFluxCharacteristics());
    List<FLUXLocation> destinationFLUXLocations = Arrays.asList(getFluxLocation());
    FACatch faCatch = new FACatch(speciesCode, unitQuantity, weightMeasure, weighingMeansCode, usageCode, typeCode, relatedFishingTrips, specifiedSizeDistribution, relatedAAPStocks, appliedAAPProcesses, relatedSalesBatches, specifiedFLUXLocations, usedFishingGears, applicableFLUXCharacteristics, destinationFLUXLocations);
    return faCatch;
}
Also used : SizeDistribution(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.SizeDistribution) FishingGear(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingGear) MeasureType(un.unece.uncefact.data.standard.unqualifieddatatype._20.MeasureType) AAPStock(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.AAPStock) FLUXCharacteristic(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXCharacteristic) SalesBatch(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.SalesBatch) QuantityType(un.unece.uncefact.data.standard.unqualifieddatatype._20.QuantityType) FLUXLocation(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXLocation) AAPProcess(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.AAPProcess) FishingTrip(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingTrip) CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType) FACatch(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch)

Aggregations

FACatch (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch)5 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)3 AapProcessEntity (eu.europa.ec.fisheries.ers.fa.entities.AapProcessEntity)2 Test (org.junit.Test)2 AAPProcess (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.AAPProcess)2 FLUXCharacteristic (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXCharacteristic)2 FLUXLocation (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXLocation)2 FishingGear (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingGear)2 FishingTrip (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingTrip)2 CodeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType)2 MeasureType (un.unece.uncefact.data.standard.unqualifieddatatype._20.MeasureType)2 QuantityType (un.unece.uncefact.data.standard.unqualifieddatatype._20.QuantityType)2 AapProductEntity (eu.europa.ec.fisheries.ers.fa.entities.AapProductEntity)1 AapStockEntity (eu.europa.ec.fisheries.ers.fa.entities.AapStockEntity)1 FishingGearEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity)1 FishingTripEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)1 FluxCharacteristicEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity)1 FluxLocationEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)1 ProcessingProductsDto (eu.europa.ec.fisheries.ers.service.dto.view.ProcessingProductsDto)1 HashSet (java.util.HashSet)1