Search in sources :

Example 1 with AAPProduct

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

the class AapProductMapperTest method testAapProductMapper.

@Test
public void testAapProductMapper() {
    AAPProduct aapProduct = MapperUtil.getAapProduct();
    AapProductEntity aapProductEntity = AapProductMapper.INSTANCE.mapToAapProductEntity(aapProduct);
    assertEquals(aapProduct.getPackagingTypeCode().getValue(), aapProductEntity.getPackagingTypeCode());
    assertEquals(aapProduct.getPackagingTypeCode().getListID(), aapProductEntity.getPackagingTypeCodeListId());
    assertNull(aapProductEntity.getAapProcess());
    assertEquals(aapProduct.getPackagingUnitAverageWeightMeasure().getValue().doubleValue(), aapProductEntity.getPackagingUnitAvarageWeight());
    assertEquals(aapProduct.getPackagingUnitAverageWeightMeasure().getUnitCode(), aapProductEntity.getPackagingWeightUnitCode());
    assertEquals(aapProduct.getPackagingUnitAverageWeightMeasure().getValue().intValue(), aapProductEntity.getCalculatedPackagingWeight().intValue());
    assertEquals(aapProduct.getPackagingUnitQuantity().getValue().doubleValue(), aapProductEntity.getPackagingUnitCount());
    assertEquals(aapProduct.getPackagingUnitQuantity().getUnitCode(), aapProductEntity.getPackagingUnitCountCode());
    assertEquals(aapProduct.getSpeciesCode().getValue(), aapProductEntity.getSpeciesCode());
    assertEquals(aapProduct.getSpeciesCode().getListID(), aapProductEntity.getSpeciesCodeListId());
    assertEquals(aapProduct.getUnitQuantity().getValue().intValue(), aapProductEntity.getUnitQuantity().intValue());
    assertEquals(aapProduct.getUnitQuantity().getUnitCode(), aapProductEntity.getUnitQuantityCode());
    assertEquals(aapProduct.getWeightMeasure().getValue().intValue(), aapProductEntity.getWeightMeasure().intValue());
    assertEquals(aapProduct.getWeightMeasure().getUnitCode(), aapProductEntity.getWeightMeasureUnitCode());
    assertEquals(aapProduct.getWeightMeasure().getValue().intValue(), aapProductEntity.getCalculatedWeightMeasure().intValue());
    assertEquals(aapProduct.getWeighingMeansCode().getValue(), aapProductEntity.getWeighingMeansCode());
    assertEquals(aapProduct.getWeighingMeansCode().getListID(), aapProductEntity.getWeighingMeansCodeListId());
    assertEquals(aapProduct.getUsageCode().getValue(), aapProductEntity.getUsageCode());
    assertEquals(aapProduct.getUsageCode().getListID(), aapProductEntity.getUsageCodeListId());
}
Also used : AAPProduct(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.AAPProduct) AapProductEntity(eu.europa.ec.fisheries.ers.fa.entities.AapProductEntity) Test(org.junit.Test)

Example 2 with AAPProduct

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

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

the class AapProcessMapper method getAapProductEntities.

protected Set<AapProductEntity> getAapProductEntities(List<AAPProduct> aapProducts, AapProcessEntity aapProcessEntity) {
    if (aapProducts == null || aapProducts.isEmpty()) {
        return Collections.emptySet();
    }
    Set<AapProductEntity> aapProductEntities = new HashSet<>();
    for (AAPProduct aapProduct : aapProducts) {
        AapProductEntity aapProductEntity = AapProductMapper.INSTANCE.mapToAapProductEntity(aapProduct);
        aapProductEntity.setAapProcess(aapProcessEntity);
        aapProductEntities.add(aapProductEntity);
    }
    return aapProductEntities;
}
Also used : AAPProduct(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.AAPProduct) AapProductEntity(eu.europa.ec.fisheries.ers.fa.entities.AapProductEntity) HashSet(java.util.HashSet)

Example 4 with AAPProduct

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

the class MapperUtil method getAapProduct.

public static AAPProduct getAapProduct() {
    CodeType speciesCode = getCodeType("Species 1", "qbdcg-3fhr5-rd4kd5-er5tgd5k");
    QuantityType quantityType = getQuantityType(123);
    MeasureType measureType = getMeasureType(123, "C62", "qbdcg-3fhr5-rd4kd5-er5tgd5k");
    CodeType weighingMeansCode = getCodeType("Weighing Means 1", "qbd43cg-3fhr5t65-rd4kd5rt4-er5tgd5k");
    CodeType usageCode = getCodeType("Usage Code 1", "qbd43cg-3fhr5t65-rd4kd5rt4-er5tgd5k");
    QuantityType packagingUnitQuantity = getQuantityType(1234);
    CodeType packagingTypeCode = getCodeType("packaging type 1", "FISH_PACKAGING");
    MeasureType packagingUnitAverageWeightMeasure = getMeasureType(123, "C62", "qbdcg-3fhr5-rd4kd5-er5tgd5k");
    SalesPrice totalSalesPrice = getSalesPrice(getAmountType(123, "qbd43cg-3fhr5t65-rd4kd5rt4-er5tgd5k", "1"));
    SizeDistribution specifiedSizeDistribution = getSizeDistribution(getCodeType("catagory 1", "qbd43cg-3fhr5t65-rd4kd5rt4-er5tgd5k"), getCodeType("class code1", "qbd43cg-3fhr5t65-rd45674-er5tgd5k"));
    AAPProduct aapProduct = new AAPProduct(speciesCode, quantityType, measureType, weighingMeansCode, usageCode, packagingUnitQuantity, packagingTypeCode, packagingUnitAverageWeightMeasure, null, totalSalesPrice, specifiedSizeDistribution, null, null);
    return aapProduct;
}
Also used : SalesPrice(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.SalesPrice) QuantityType(un.unece.uncefact.data.standard.unqualifieddatatype._20.QuantityType) SizeDistribution(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.SizeDistribution) AAPProduct(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.AAPProduct) CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType) MeasureType(un.unece.uncefact.data.standard.unqualifieddatatype._20.MeasureType)

Aggregations

AAPProduct (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.AAPProduct)4 AapProductEntity (eu.europa.ec.fisheries.ers.fa.entities.AapProductEntity)3 Test (org.junit.Test)2 AapProcessEntity (eu.europa.ec.fisheries.ers.fa.entities.AapProcessEntity)1 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)1 ProcessingProductsDto (eu.europa.ec.fisheries.ers.service.dto.view.ProcessingProductsDto)1 HashSet (java.util.HashSet)1 AAPProcess (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.AAPProcess)1 FACatch (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch)1 SalesPrice (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.SalesPrice)1 SizeDistribution (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.SizeDistribution)1 CodeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType)1 MeasureType (un.unece.uncefact.data.standard.unqualifieddatatype._20.MeasureType)1 QuantityType (un.unece.uncefact.data.standard.unqualifieddatatype._20.QuantityType)1