use of eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingTripServiceBean method getTripWidgetDto.
@Override
public /**
* Returns TripWidgetDto based on the tripId and activityId
*/
TripWidgetDto getTripWidgetDto(FishingActivityEntity activityEntity, String tripId) {
if (activityEntity == null && tripId == null) {
return null;
}
TripWidgetDto tripWidgetDto = new TripWidgetDto();
try {
if (tripId != null) {
log.debug("Trip Id found for Fishing Activity. Get TripWidget information for tripID :" + tripId);
TripOverviewDto tripOverviewDto = getTripOverviewDto(activityEntity, tripId);
List<TripOverviewDto> tripOverviewDtoList = new ArrayList<>();
tripOverviewDtoList.add(tripOverviewDto);
tripWidgetDto.setTrips(tripOverviewDtoList);
if (activityEntity != null && activityEntity.getFaReportDocument() != null && CollectionUtils.isNotEmpty(activityEntity.getFaReportDocument().getVesselTransportMeans())) {
Set<VesselTransportMeansEntity> vesselTransportMeansEntities = activityEntity.getFaReportDocument().getVesselTransportMeans();
for (VesselTransportMeansEntity vesselTransportMeansEntity : vesselTransportMeansEntities) {
if (vesselTransportMeansEntity.getFishingActivity() == null) {
tripWidgetDto.setVesselDetails(getVesselDetailsDTO(vesselTransportMeansEntity, activityEntity));
break;
}
}
}
// VesselDetailsDTO detailsDTO = getVesselDetailsForFishingTrip(tripId);
// tripWidgetDto.setVesselDetails(detailsDTO);
log.debug("tripWidgetDto set for tripID :" + tripId);
} else {
log.debug("TripId is not received for the screen. Try to get TripSummary information for all the tripIds specified for FishingActivity:" + activityEntity.getId());
return createTripWidgetDtoWithFishingActivity(activityEntity);
}
} catch (ServiceException e) {
log.error("Error while creating TripWidgetDto.", e);
}
return tripWidgetDto;
}
use of eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FluxMessageServiceBean method enrichFishingActivityVesselWithGuiId.
private void enrichFishingActivityVesselWithGuiId(FishingActivityEntity fishingActivityEntity) {
Set<VesselTransportMeansEntity> vesselTransportMeansEntityList = fishingActivityEntity.getVesselTransportMeans();
if (CollectionUtils.isEmpty(vesselTransportMeansEntityList)) {
return;
}
for (VesselTransportMeansEntity entity : vesselTransportMeansEntityList) {
enrichWithGuidFromAssets(entity);
fishingActivityEntity.setVesselTransportGuid(entity.getGuid());
}
}
use of eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FaCatchMapper method mapToAssetIdentifiers.
protected List<AssetIdentifierDto> mapToAssetIdentifiers(FaCatchEntity faCatch) {
List<AssetIdentifierDto> assetIdentifierDtos = new ArrayList<>();
if (faCatch != null && faCatch.getFishingActivity() != null && CollectionUtils.isNotEmpty(faCatch.getFishingActivity().getVesselTransportMeans())) {
VesselTransportMeansEntity vesselTransportMeans = faCatch.getFishingActivity().getVesselTransportMeans().iterator().next();
Map<VesselIdentifierSchemeIdEnum, String> vesselIdentifiers = vesselTransportMeans.getVesselIdentifiersMap();
// Set IRCS always if present
if (vesselIdentifiers.get(VesselIdentifierSchemeIdEnum.IRCS) != null) {
assetIdentifierDtos.add(new AssetIdentifierDto(VesselIdentifierSchemeIdEnum.IRCS, vesselIdentifiers.get(VesselIdentifierSchemeIdEnum.IRCS)));
}
if (vesselIdentifiers.get(VesselIdentifierSchemeIdEnum.ICCAT) != null) {
assetIdentifierDtos.add(new AssetIdentifierDto(VesselIdentifierSchemeIdEnum.ICCAT, vesselIdentifiers.get(VesselIdentifierSchemeIdEnum.ICCAT)));
} else if (vesselIdentifiers.get(VesselIdentifierSchemeIdEnum.CFR) != null) {
assetIdentifierDtos.add(new AssetIdentifierDto(VesselIdentifierSchemeIdEnum.CFR, vesselIdentifiers.get(VesselIdentifierSchemeIdEnum.CFR)));
}
}
return assetIdentifierDtos;
}
use of eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FaReportDocumentMapper method getVesselTransportMeansEntity.
protected Set<VesselTransportMeansEntity> getVesselTransportMeansEntity(VesselTransportMeans vesselTransportMeans, FaReportDocumentEntity faReportDocumentEntity) {
if (vesselTransportMeans == null) {
return null;
}
Set<VesselTransportMeansEntity> entities = new HashSet<>();
VesselTransportMeansEntity vesselTransportMeansEntity = VesselTransportMeansMapper.INSTANCE.mapToVesselTransportMeansEntity(vesselTransportMeans);
vesselTransportMeansEntity.setFaReportDocument(faReportDocumentEntity);
entities.add(vesselTransportMeansEntity);
return entities;
}
use of eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingTripIdWithGeometryMapper method getFlagStateFromActivityList.
private String getFlagStateFromActivityList(List<FishingActivityEntity> fishingActivities) {
if (CollectionUtils.isEmpty(fishingActivities) || fishingActivities.get(fishingActivities.size() - 1) == null || fishingActivities.get(fishingActivities.size() - 1).getFaReportDocument() == null || fishingActivities.get(fishingActivities.size() - 1).getFaReportDocument().getVesselTransportMeans() == null) {
return null;
}
int totalFishingActivityCount = fishingActivities.size();
FishingActivityEntity fishingActivityEntity = fishingActivities.get(totalFishingActivityCount - 1);
Set<VesselTransportMeansEntity> vesselTransportMeansEntityList = fishingActivityEntity.getFaReportDocument().getVesselTransportMeans();
if (CollectionUtils.isEmpty(vesselTransportMeansEntityList)) {
return null;
}
return vesselTransportMeansEntityList.iterator().next().getCountry();
}
Aggregations