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