Search in sources :

Example 1 with AreaDto

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;
}
Also used : AreaDto(eu.europa.ec.fisheries.ers.service.dto.view.AreaDto)

Example 2 with 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;
}
Also used : TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) AreaDto(eu.europa.ec.fisheries.ers.service.dto.view.AreaDto) FluxLocationDto(eu.europa.ec.fisheries.ers.service.dto.view.FluxLocationDto)

Example 3 with 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;
}
Also used : AreaDto(eu.europa.ec.fisheries.ers.service.dto.view.AreaDto) AreaDtoMapper(eu.europa.ec.fisheries.ers.service.mapper.AreaDtoMapper)

Example 4 with 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());
}
Also used : HashMap(java.util.HashMap) AreaDto(eu.europa.ec.fisheries.ers.service.dto.view.AreaDto) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test)

Aggregations

AreaDto (eu.europa.ec.fisheries.ers.service.dto.view.AreaDto)4 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)1 FluxLocationEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)1 FluxLocationDto (eu.europa.ec.fisheries.ers.service.dto.view.FluxLocationDto)1 AreaDtoMapper (eu.europa.ec.fisheries.ers.service.mapper.AreaDtoMapper)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 TreeSet (java.util.TreeSet)1 Test (org.junit.Test)1