use of eu.europa.ec.fisheries.ers.service.dto.view.AreaDto in project UVMS-ActivityModule-APP by UnionVMS.
the class AreaDtoMapper method mapToAreaDto.
public AreaDto mapToAreaDto(FishingActivityEntity faEntity) {
if (faEntity == null) {
return null;
}
AreaDto areaDto = new AreaDto();
areaDto.setFluxLocations(BaseMapper.mapFromFluxLocation(faEntity.getFluxLocations()));
areaDto.setStartFishing(getStartFishing(faEntity));
areaDto.setTransmission(getTransmission(faEntity));
areaDto.setCrossing(extractPositionDtoFromFishingActivity(faEntity));
areaDto.setStartActivity(getStartActivity(faEntity));
return areaDto;
}
use of eu.europa.ec.fisheries.ers.service.dto.view.AreaDto in project UVMS-ActivityModule-APP by UnionVMS.
the class BaseActivityViewMapper method getSortedAreas.
public AreaDto getSortedAreas(FishingActivityEntity faEntity, Comparator<FluxLocationDto> comparator) {
AreaDto areaDto = getAreas(faEntity);
final List<FluxLocationDto> fluxLocationDtos = new ArrayList<>(areaDto.getFluxLocations());
TreeSet<FluxLocationDto> fluxLocationDtoTreeSet = new TreeSet<FluxLocationDto>(comparator);
fluxLocationDtoTreeSet.addAll(fluxLocationDtos);
areaDto.setFluxLocations(fluxLocationDtoTreeSet);
return areaDto;
}
use of eu.europa.ec.fisheries.ers.service.dto.view.AreaDto in project UVMS-ActivityModule-APP by UnionVMS.
the class BaseActivityViewMapper method getAreas.
public static AreaDto getAreas(FishingActivityEntity faEntity) {
AreaDto areaDto = new AreaDtoMapper().mapToAreaDto(faEntity);
areaDto.setFluxLocations(mapFromFluxLocation(faEntity.getFluxLocations(), FluxLocationEnum.AREA));
return areaDto;
}
use of eu.europa.ec.fisheries.ers.service.dto.view.AreaDto in project UVMS-ActivityModule-APP by UnionVMS.
the class BaseActivityViewMapperTest method testGetAreas.
@Test
public void testGetAreas() {
FishingActivityEntity entity = new FishingActivityEntity();
FluxLocationEntity fluxLocationEntity = new FluxLocationEntity();
fluxLocationEntity.setFluxLocationIdentifier("id");
fluxLocationEntity.setFluxLocationIdentifierSchemeId("schemeId");
fluxLocationEntity.setTypeCode("AREA");
entity.setFluxLocations(Collections.set(fluxLocationEntity));
AreaDto areas = BaseActivityViewMapper.getAreas(entity);
Map<String, String> stringMap = new HashMap<>();
stringMap.put("id", "id");
stringMap.put("schemeId", "schemeId");
assertEquals(stringMap, areas.getIdentifiers());
}
Aggregations