Search in sources :

Example 6 with FishingActivityViewDTO

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

the class GearShotRetrievalTileMapper method mapFaEntityToFaDto.

public FishingActivityViewDTO mapFaEntityToFaDto(FishingActivityEntity faEntity) {
    FishingActivityViewDTO viewDTO = new FishingActivityViewDTO();
    viewDTO.setGearShotRetrievalList(mapFromRelatedFishingActivities(faEntity));
    return viewDTO;
}
Also used : FishingActivityViewDTO(eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO)

Example 7 with FishingActivityViewDTO

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

the class JointFishingOperationViewMapper method mapFaEntityToFaDto.

@Override
public FishingActivityViewDTO mapFaEntityToFaDto(FishingActivityEntity faEntity) {
    FishingActivityViewDTO viewDTO = new FishingActivityViewDTO();
    ActivityDetailsDto detailsDto = mapActivityDetails(faEntity);
    detailsDto.setVesselActivity(faEntity.getVesselActivityCode());
    detailsDto.setFisheryType(faEntity.getFisheryTypeCode());
    detailsDto.setSpeciesTarget(faEntity.getSpeciesTargetCode());
    detailsDto.setFishingTime(calculateFishingTime(faEntity.getDelimitedPeriods()));
    viewDTO.setActivityDetails(detailsDto);
    viewDTO.setLocations(mapFromFluxLocation(faEntity.getFluxLocations()));
    viewDTO.setReportDetails(getReportDocsFromEntity(faEntity.getFaReportDocument()));
    viewDTO.setGears(getGearsFromEntity(faEntity.getFishingGears()));
    viewDTO.setVesselDetails(getVesselDetailsDTO(faEntity));
    viewDTO.setCatches(mapCatchesToGroupDto(faEntity));
    viewDTO.setProcessingProducts(getProcessingProductsByFaCatches(faEntity.getFaCatchs()));
    viewDTO.setGearProblems(GearShotRetrievalTileMapper.INSTANCE.mapGearProblemsToGearsDto(faEntity.getGearProblems()));
    viewDTO.setRelocations(getRelocations(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)

Example 8 with FishingActivityViewDTO

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

the class ActivityRelocationViewMapper method mapFaEntityToFaDto.

@Override
public FishingActivityViewDTO mapFaEntityToFaDto(FishingActivityEntity faEntity) {
    FishingActivityViewDTO viewDTO = new FishingActivityViewDTO();
    if (faEntity != null) {
        viewDTO.setActivityDetails(mapActivityDetails(faEntity));
        viewDTO.setLocations(mapFromFluxLocation(faEntity.getFluxLocations()));
        viewDTO.setReportDetails(getReportDocsFromEntity(faEntity.getFaReportDocument()));
        viewDTO.setCatches(mapCatchesToGroupDto(faEntity));
        viewDTO.setProcessingProducts(getProcessingProductsByFaCatches(faEntity.getFaCatchs()));
        viewDTO.setVesselDetails(VesselTransportMeansMapper.INSTANCE.map(faEntity.getVesselTransportMeans()));
        if (CollectionUtils.isNotEmpty(viewDTO.getVesselDetails())) {
            for (VesselDetailsDTO detailsDTO : viewDTO.getVesselDetails()) {
                detailsDTO.setStorageDto(VesselStorageCharacteristicsMapper.INSTANCE.mapToStorageDto(faEntity.getDestVesselCharId()));
            }
        }
    }
    return viewDTO;
}
Also used : VesselDetailsDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.details.VesselDetailsDTO) FishingActivityViewDTO(eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO)

Example 9 with FishingActivityViewDTO

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

the class ActivityServiceBean method getFishingActivityForView.

/**
 * Gets a FishingActivityEntity with a certain activityId and maps it to a FishingActivityViewDTO representation layer POJO.
 *
 * @param activityId
 * @param datasets
 * @return
 * @throws ServiceException
 */
@Override
public FishingActivityViewDTO getFishingActivityForView(Integer activityId, String tripId, List<Dataset> datasets, ActivityViewEnum view) throws ServiceException {
    Geometry geom = getRestrictedAreaGeometry(datasets);
    FishingActivityEntity activityEntity = fishingActivityDao.getFishingActivityById(activityId, geom);
    if (activityEntity == null)
        throw new ServiceException("Could not find FishingActivityEntity for the given id:" + activityId);
    log.debug("FishingActivityEntity fetched from database with id:" + activityEntity.getId());
    FishingActivityViewDTO fishingActivityViewDTO = ActivityViewMapperFactory.getMapperForView(view).mapFaEntityToFaDto(activityEntity);
    fishingActivityViewDTO.setTripDetails(fishingTripServiceBean.getTripWidgetDto(activityEntity, tripId));
    log.debug("fishingActivityView generated after mapping is :" + fishingActivityViewDTO);
    addPortDescriptions(fishingActivityViewDTO, "LOCATION");
    fishingActivityViewDTO.setTripDetails(fishingTripServiceBean.getTripWidgetDto(activityEntity, tripId));
    fishingActivityViewDTO.setHistory(getActivityHistoryDto(activityEntity));
    log.debug("fishingActivityView generated after mapping is :" + fishingActivityViewDTO);
    return fishingActivityViewDTO;
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) ServiceException(eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException) FishingActivityViewDTO(eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)

Example 10 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 testActivityDepartureViewMapper.

@Test
@SneakyThrows
public void testActivityDepartureViewMapper() {
    BaseActivityViewMapper mapperForView = ActivityViewMapperFactory.getMapperForView(ActivityViewEnum.DEPARTURE);
    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)

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