Search in sources :

Example 1 with FishingActivityViewDTO

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

the class FishingActivityViewMapperTest method testActivityRelocationViewMapper.

@Test
@SneakyThrows
public void testActivityRelocationViewMapper() {
    BaseActivityViewMapper mapperForView = ActivityViewMapperFactory.getMapperForView(ActivityViewEnum.RELOCATION);
    FishingActivityEntity fishingActivityEntity = getFishingActivityEntity();
    Set<FaCatchEntity> faCatches = generateFaCatches(fishingActivityEntity.getFaCatchs().iterator().next());
    fishingActivityEntity.setFaCatchs(faCatches);
    FishingActivityViewDTO fishingActivityViewDTO = mapperForView.mapFaEntityToFaDto(fishingActivityEntity);
    assertNotNull(fishingActivityViewDTO.getActivityDetails());
    assertNotNull(fishingActivityViewDTO.getReportDetails());
    assertNull(ActivityArrivalViewMapper.INSTANCE.mapFaEntityToFaDto(null));
}
Also used : FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) BaseActivityViewMapper(eu.europa.ec.fisheries.ers.service.mapper.view.base.BaseActivityViewMapper) FishingActivityViewDTO(eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Example 2 with FishingActivityViewDTO

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

the class FishingActivityViewMapperTest method testActivityArrivalViewMapper.

@Test
@SneakyThrows
public void testActivityArrivalViewMapper() {
    BaseActivityViewMapper mapperForView = ActivityViewMapperFactory.getMapperForView(ActivityViewEnum.ARRIVAL);
    FishingActivityViewDTO fishingActivityViewDTO = mapperForView.mapFaEntityToFaDto(getFishingActivityEntity());
    assertNotNull(fishingActivityViewDTO.getActivityDetails());
    assertNotNull(fishingActivityViewDTO.getGears());
    assertNotNull(fishingActivityViewDTO.getReportDetails());
    assertTrue(fishingActivityViewDTO.getGears().size() == 1);
    assertNull(mapperForView.mapFaEntityToFaDto(null));
// printDtoOnConsole(fishingActivityViewDTO, FishingActivityView.Arrival.class);
}
Also used : BaseActivityViewMapper(eu.europa.ec.fisheries.ers.service.mapper.view.base.BaseActivityViewMapper) FishingActivityViewDTO(eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Example 3 with FishingActivityViewDTO

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

the class FishingOperationViewMapper method mapFaEntityToFaDto.

@Override
public FishingActivityViewDTO mapFaEntityToFaDto(FishingActivityEntity faEntity) {
    FishingActivityViewDTO viewDTO = new FishingActivityViewDTO();
    ActivityDetailsDto detailsDto = mapActivityDetails(faEntity);
    detailsDto.setOccurrence(faEntity.getOccurence());
    detailsDto.setVesselActivity(faEntity.getVesselActivityCode());
    if (faEntity.getOperationQuantity() != null) {
        detailsDto.setNrOfOperation(faEntity.getOperationQuantity().intValue());
    }
    detailsDto.setFisheryType(faEntity.getFisheryTypeCode());
    detailsDto.setSpeciesTarget(faEntity.getSpeciesTargetCode());
    Set<FishingActivityIdentifierEntity> fishingActivityIdentifiers = faEntity.getFishingActivityIdentifiers();
    detailsDto.setIdentifiers(FishingActivityIdentifierMapper.INSTANCE.mapToIdentifierDTOSet(fishingActivityIdentifiers));
    detailsDto.setFishingTime(this.calculateFishingTime(faEntity.getDelimitedPeriods()));
    viewDTO.setActivityDetails(detailsDto);
    viewDTO.setGears(this.getGearsFromEntity(faEntity.getFishingGears()));
    viewDTO.setReportDetails(this.getReportDocsFromEntity(faEntity.getFaReportDocument()));
    viewDTO.setCatches(this.mapCatchesToGroupDto(faEntity));
    viewDTO.setProcessingProducts(this.getProcessingProductsByFaCatches(faEntity.getFaCatchs()));
    viewDTO.setGearProblems(GearShotRetrievalTileMapper.INSTANCE.mapGearProblemsToGearsDto(faEntity.getGearProblems()));
    viewDTO.setGearShotRetrievalList(GearShotRetrievalTileMapperImpl.INSTANCE.mapFromRelatedFishingActivities(faEntity));
    Set<FluxLocationDto> fluxLocationDtos = mapFromFluxLocation(faEntity.getFluxLocations());
    viewDTO.setLocations(fluxLocationDtos);
    viewDTO.setVesselDetails(getVesselDetailsDTO(faEntity));
    return viewDTO;
}
Also used : ActivityDetailsDto(eu.europa.ec.fisheries.ers.service.dto.view.ActivityDetailsDto) FishingActivityViewDTO(eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO) FishingActivityIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity) FluxLocationDto(eu.europa.ec.fisheries.ers.service.dto.view.FluxLocationDto)

Example 4 with FishingActivityViewDTO

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

the class DiscardViewMapper method mapFaEntityToFaDto.

@Override
public FishingActivityViewDTO mapFaEntityToFaDto(FishingActivityEntity faEntity) {
    FishingActivityViewDTO fishingActivityViewDTO = new FishingActivityViewDTO();
    ActivityDetailsDto activityDetailsDto = mapActivityDetails(faEntity);
    activityDetailsDto.setReason(faEntity.getReasonCode());
    Set<FishingActivityIdentifierEntity> fishingActivityIdentifiers = faEntity.getFishingActivityIdentifiers();
    activityDetailsDto.setIdentifiers(FishingActivityIdentifierMapper.INSTANCE.mapToIdentifierDTOSet(fishingActivityIdentifiers));
    fishingActivityViewDTO.setActivityDetails(activityDetailsDto);
    fishingActivityViewDTO.setLocations(mapFromFluxLocation(faEntity.getFluxLocations()));
    fishingActivityViewDTO.setReportDetails(getReportDocsFromEntity(faEntity.getFaReportDocument()));
    fishingActivityViewDTO.setCatches(mapCatchesToGroupDto(faEntity));
    fishingActivityViewDTO.setProcessingProducts(getProcessingProductsByFaCatches(faEntity.getFaCatchs()));
    return fishingActivityViewDTO;
}
Also used : ActivityDetailsDto(eu.europa.ec.fisheries.ers.service.dto.view.ActivityDetailsDto) FishingActivityViewDTO(eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO) FishingActivityIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity)

Example 5 with FishingActivityViewDTO

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

the class ActivityNotificationOfArrivalViewMapper method mapFaEntityToFaDto.

@Override
public FishingActivityViewDTO mapFaEntityToFaDto(FishingActivityEntity faEntity) {
    FishingActivityViewDTO fishingActivityViewDTO = new FishingActivityViewDTO();
    if (faEntity != null) {
        // Fishing Activity Tile
        ActivityDetailsDto activityDetailsDto = mapActivityDetails(faEntity);
        activityDetailsDto.setReason(faEntity.getReasonCode());
        fishingActivityViewDTO.setActivityDetails(activityDetailsDto);
        // Intented ports of Landing Tile
        fishingActivityViewDTO.setLocations(mapFromFluxLocation(faEntity.getFluxLocations()));
        // Activity Report document tile
        fishingActivityViewDTO.setReportDetails(getReportDocsFromEntity(faEntity.getFaReportDocument()));
        // Catch tile
        fishingActivityViewDTO.setCatches(mapCatchesToGroupDto(faEntity));
        // Applied AAP process Tile
        fishingActivityViewDTO.setProcessingProducts(getProcessingProductsByFaCatches(faEntity.getFaCatchs()));
    }
    return fishingActivityViewDTO;
}
Also used : ActivityDetailsDto(eu.europa.ec.fisheries.ers.service.dto.view.ActivityDetailsDto) FishingActivityViewDTO(eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO)

Aggregations

FishingActivityViewDTO (eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO)12 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)5 SneakyThrows (lombok.SneakyThrows)5 Test (org.junit.Test)5 ActivityDetailsDto (eu.europa.ec.fisheries.ers.service.dto.view.ActivityDetailsDto)4 BaseActivityViewMapper (eu.europa.ec.fisheries.ers.service.mapper.view.base.BaseActivityViewMapper)4 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)3 FishingActivityIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity)2 Geometry (com.vividsolutions.jts.geom.Geometry)1 VesselDetailsDTO (eu.europa.ec.fisheries.ers.service.dto.fareport.details.VesselDetailsDTO)1 FluxLocationDto (eu.europa.ec.fisheries.ers.service.dto.view.FluxLocationDto)1 JointFishingOperationViewMapper (eu.europa.ec.fisheries.ers.service.mapper.view.JointFishingOperationViewMapper)1 MapperUtil.getFishingActivity (eu.europa.ec.fisheries.ers.service.util.MapperUtil.getFishingActivity)1 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)1 FishingActivity (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity)1