Search in sources :

Example 1 with GearDto

use of eu.europa.ec.fisheries.ers.service.dto.view.GearDto in project UVMS-ActivityModule-APP by UnionVMS.

the class BaseActivityViewMapper method mapSingleGearToDto.

private GearDto mapSingleGearToDto(FishingGearEntity gearEntity) {
    GearDto gearDto = new GearDto();
    gearDto.setType(gearEntity.getTypeCode());
    fillRoleAndCharacteristics(gearDto, gearEntity);
    return gearDto;
}
Also used : GearDto(eu.europa.ec.fisheries.ers.service.dto.view.GearDto)

Example 2 with GearDto

use of eu.europa.ec.fisheries.ers.service.dto.view.GearDto in project UVMS-ActivityModule-APP by UnionVMS.

the class GearCharacteristicsMapper method mapGearDtoToFishingGearEntity.

public GearDto mapGearDtoToFishingGearEntity(FishingGearEntity fishingGearEntity) {
    GearDto gearDto = null;
    List<GearDto> gearDtos = mapFishingGearEntitiesToGearDtos(newSet(fishingGearEntity));
    if (!CollectionUtils.isEmpty(gearDtos)) {
        gearDto = gearDtos.get(0);
    }
    return gearDto;
}
Also used : GearDto(eu.europa.ec.fisheries.ers.service.dto.view.GearDto)

Example 3 with GearDto

use of eu.europa.ec.fisheries.ers.service.dto.view.GearDto in project UVMS-ActivityModule-APP by UnionVMS.

the class GearCharacteristicsMapper method mapFishingGearEntitiesToGearDtos.

public List<GearDto> mapFishingGearEntitiesToGearDtos(Set<FishingGearEntity> fishingGearEntities) {
    if (CollectionUtils.isEmpty(fishingGearEntities)) {
        return Collections.emptyList();
    }
    List<GearDto> gearDtoList = new ArrayList<>();
    for (FishingGearEntity gearEntity : fishingGearEntities) {
        GearDto gearDto = new GearDto();
        gearDto.setType(gearEntity.getTypeCode());
        fillRoleAndCharacteristics(gearDto, gearEntity);
        gearDtoList.add(gearDto);
    }
    return gearDtoList;
}
Also used : ArrayList(java.util.ArrayList) FishingGearEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity) GearDto(eu.europa.ec.fisheries.ers.service.dto.view.GearDto)

Example 4 with GearDto

use of eu.europa.ec.fisheries.ers.service.dto.view.GearDto in project UVMS-ActivityModule-APP by UnionVMS.

the class GearCharacteristicsMapperTest method testMapGearDtoToFishingGearEntityWithTypeCodeDG.

@Test
@Parameters(method = "methodName")
public void testMapGearDtoToFishingGearEntityWithTypeCodeDG(GearCharacteristicEntity entity, String typeCode, GearDto expectedDto) {
    entity.setTypeCode(typeCode);
    FishingGearEntity build = FishingGearEntity.builder().gearCharacteristics(newSet(entity)).build();
    GearDto mappedDto = GearCharacteristicsMapper.INSTANCE.mapGearDtoToFishingGearEntity(build);
    assertTrue(expectedDto.equals(mappedDto));
}
Also used : FishingGearEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity) GearDto(eu.europa.ec.fisheries.ers.service.dto.view.GearDto) Parameters(junitparams.Parameters) Test(org.junit.Test)

Aggregations

GearDto (eu.europa.ec.fisheries.ers.service.dto.view.GearDto)4 FishingGearEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity)2 ArrayList (java.util.ArrayList)1 Parameters (junitparams.Parameters)1 Test (org.junit.Test)1