Search in sources :

Example 1 with AapProcessCodeEntity

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

the class AapProcessMapper method getAapProcessCodes.

protected Set<AapProcessCodeEntity> getAapProcessCodes(List<CodeType> codeTypes, AapProcessEntity aapProcessEntity) {
    if (codeTypes == null || codeTypes.isEmpty()) {
        return Collections.emptySet();
    }
    Set<AapProcessCodeEntity> aapProcessCodeEntities = new HashSet<>();
    for (CodeType codeType : codeTypes) {
        AapProcessCodeEntity entity = AapProcessMapper.INSTANCE.mapToAapProcessCodeEntity(codeType);
        entity.setAapProcess(aapProcessEntity);
        aapProcessCodeEntities.add(entity);
    }
    return aapProcessCodeEntities;
}
Also used : AapProcessCodeEntity(eu.europa.ec.fisheries.ers.fa.entities.AapProcessCodeEntity) CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType) HashSet(java.util.HashSet)

Example 2 with AapProcessCodeEntity

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

the class AapProcessMapperTest method testAapProcessMapper.

@Test
public void testAapProcessMapper() {
    AAPProcess aapProcess = MapperUtil.getAapProcess();
    AapProcessEntity aapProcessEntity = AapProcessMapper.INSTANCE.mapToAapProcessEntity(aapProcess);
    AapProcessCodeEntity entity = aapProcessEntity.getAapProcessCode().iterator().next();
    assertEquals(aapProcess.getTypeCodes().get(0).getValue(), entity.getTypeCode());
    assertEquals(aapProcess.getTypeCodes().get(0).getListID(), entity.getTypeCodeListId());
    assertEquals(aapProcess.getConversionFactorNumeric().getValue().intValue(), aapProcessEntity.getConversionFactor().intValue());
    assertNull(aapProcessEntity.getFaCatch());
    assertNotNull(aapProcessEntity.getAapProducts());
    AapProductEntity aapProductEntity = aapProcessEntity.getAapProducts().iterator().next();
    assertNotNull(aapProductEntity);
    aapProductEntity.getAapProcess().getAapProcessCode().iterator().next();
    assertEquals(aapProcess.getTypeCodes().get(0).getValue(), entity.getTypeCode());
}
Also used : AAPProcess(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.AAPProcess) AapProcessCodeEntity(eu.europa.ec.fisheries.ers.fa.entities.AapProcessCodeEntity) AapProcessEntity(eu.europa.ec.fisheries.ers.fa.entities.AapProcessEntity) AapProductEntity(eu.europa.ec.fisheries.ers.fa.entities.AapProductEntity) Test(org.junit.Test)

Aggregations

AapProcessCodeEntity (eu.europa.ec.fisheries.ers.fa.entities.AapProcessCodeEntity)2 AapProcessEntity (eu.europa.ec.fisheries.ers.fa.entities.AapProcessEntity)1 AapProductEntity (eu.europa.ec.fisheries.ers.fa.entities.AapProductEntity)1 HashSet (java.util.HashSet)1 Test (org.junit.Test)1 AAPProcess (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.AAPProcess)1 CodeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType)1