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