use of eu.europa.ec.fisheries.ers.service.dto.fareport.details.VesselDetailsDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class JointFishingOperationViewMapper method getVesselDetailsDTO.
/**
* Addded this method as we want to set storage information explicitely in VesselDetailsDTO.Storage informaation we can only get from activities
* @param faEntity
* @return VesselDetailsDTO
*/
protected List<VesselDetailsDTO> getVesselDetailsDTO(FishingActivityEntity faEntity) {
if (faEntity == null)
return null;
List<VesselDetailsDTO> vesselDetailsDTOs = new ArrayList<>();
Set<VesselTransportMeansEntity> entities = faEntity.getVesselTransportMeans();
if (CollectionUtils.isEmpty(entities)) {
entities = new HashSet<>();
}
if (CollectionUtils.isNotEmpty(faEntity.getAllRelatedFishingActivities())) {
for (FishingActivityEntity fishingActivityEntity : faEntity.getAllRelatedFishingActivities()) {
entities.addAll(fishingActivityEntity.getVesselTransportMeans());
}
}
for (VesselTransportMeansEntity vesselTransportMeansEntity : entities) {
VesselDetailsDTO vesselDetails = VesselTransportMeansMapper.INSTANCE.map(vesselTransportMeansEntity);
if (vesselDetails != null && faEntity.getDestVesselCharId() != null) {
vesselDetails.setStorageDto(VesselStorageCharacteristicsMapper.INSTANCE.mapToStorageDto(faEntity.getDestVesselCharId()));
}
vesselDetailsDTOs.add(vesselDetails);
}
return vesselDetailsDTOs;
}
use of eu.europa.ec.fisheries.ers.service.dto.fareport.details.VesselDetailsDTO 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.fareport.details.VesselDetailsDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityTranshipmentViewMapper method getVesselDetailsDTO.
/**
* Addded this method as we want to set storage information explicitely in VesselDetailsDTO.Storage informaation we can only get from activities
* @param faEntity
* @return VesselDetailsDTO
*/
protected List<VesselDetailsDTO> getVesselDetailsDTO(FishingActivityEntity faEntity) {
if (faEntity == null || CollectionUtils.isEmpty(faEntity.getVesselTransportMeans()))
return null;
List<VesselDetailsDTO> vesselDetailsDTOs = new ArrayList<>();
Set<VesselTransportMeansEntity> entities = faEntity.getVesselTransportMeans();
for (VesselTransportMeansEntity vesselTransportMeansEntity : entities) {
VesselDetailsDTO vesselDetails = VesselTransportMeansMapper.INSTANCE.map(vesselTransportMeansEntity);
if (vesselDetails != null && faEntity.getDestVesselCharId() != null) {
vesselDetails.setStorageDto(VesselStorageCharacteristicsMapper.INSTANCE.mapToStorageDto(faEntity.getDestVesselCharId()));
}
vesselDetailsDTOs.add(vesselDetails);
}
return vesselDetailsDTOs;
}
use of eu.europa.ec.fisheries.ers.service.dto.fareport.details.VesselDetailsDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingTripServiceBean method getVesselDetailsForFishingTrip.
@Override
public VesselDetailsDTO getVesselDetailsForFishingTrip(final String fishingTripId) throws ServiceException {
if (fishingTripId == null) {
throw new IllegalArgumentException("PARAMETER CANNOT BE NULL");
}
VesselDetailsDTO detailsDTO = null;
try {
VesselTransportMeansEntity latestVesselByTripId = vesselTransportMeansDao.findLatestVesselByTripId(fishingTripId);
if (latestVesselByTripId != null) {
FishingActivityEntity parent = latestVesselByTripId.getFishingActivity();
detailsDTO = getVesselDetailsDTO(latestVesselByTripId, parent);
}
} catch (ServiceException e) {
throw new ServiceException(e.getMessage(), e);
}
return detailsDTO;
}
use of eu.europa.ec.fisheries.ers.service.dto.fareport.details.VesselDetailsDTO in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityServiceBeanTest method testEnrichVesselDetailsAndContactPartiesForFishingTrip.
@Test
@SneakyThrows
public void testEnrichVesselDetailsAndContactPartiesForFishingTrip() {
Map<String, List<String>> returnMap = new HashMap<>();
returnMap.put("code", new ArrayList<String>());
when(vesselTransportMeansDao.findLatestVesselByTripId(Mockito.anyString())).thenReturn(new VesselTransportMeansEntity());
when(mdrModuleServiceBean.getAcronymFromMdr("FLUX_VESSEL_ID_TYPE", "*", new ArrayList<String>(), 9999999, "code")).thenReturn(returnMap);
List<Asset> listAssetResponse = new ArrayList<>();
Asset asset = new Asset();
asset.setCfr("UPDATED_CFR");
asset.setIrcs("UPDATED_IRCS");
asset.setImo("UPDATED_IMO");
asset.setName("name");
listAssetResponse.add(asset);
when(assetModule.getAssetListResponse(Mockito.any(AssetListQuery.class))).thenReturn(listAssetResponse);
VesselDetailsDTO vesselDetailsDTO = fishingTripService.getVesselDetailsForFishingTrip("NOR-TRP-20160517234053706");
assertNotNull(vesselDetailsDTO);
}
Aggregations