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