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());
}
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());
}
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;
}
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;
}
Aggregations