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