use of eu.europa.ec.fisheries.uvms.activity.model.schemas.VesselIdentifierType in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingTripIdWithGeometryMapper method getVesselIdListsForFishingActivity.
private List<VesselIdentifierType> getVesselIdListsForFishingActivity(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 Collections.emptyList();
}
int totalFishingActivityCount = fishingActivities.size();
FishingActivityEntity fishingActivityEntity = fishingActivities.get(totalFishingActivityCount - 1);
Set<VesselTransportMeansEntity> vesselTransportMeansEntityList = fishingActivityEntity.getFaReportDocument().getVesselTransportMeans();
if (CollectionUtils.isEmpty(vesselTransportMeansEntityList) || CollectionUtils.isEmpty(vesselTransportMeansEntityList.iterator().next().getVesselIdentifiers())) {
return Collections.emptyList();
}
Set<VesselIdentifierEntity> vesselIdentifierEntities = vesselTransportMeansEntityList.iterator().next().getVesselIdentifiers();
List<VesselIdentifierType> vesselIdentifierTypes = new ArrayList<>();
if (CollectionUtils.isNotEmpty(vesselIdentifierEntities)) {
for (VesselIdentifierEntity vesselIdentifierEntity : vesselIdentifierEntities) {
VesselIdentifierType vesselIdentifierType = new VesselIdentifierType();
vesselIdentifierType.setKey(VesselIdentifierSchemeIdEnum.valueOf(vesselIdentifierEntity.getVesselIdentifierSchemeId()));
vesselIdentifierType.setValue(vesselIdentifierEntity.getVesselIdentifierId());
vesselIdentifierTypes.add(vesselIdentifierType);
}
}
return vesselIdentifierTypes;
}
use of eu.europa.ec.fisheries.uvms.activity.model.schemas.VesselIdentifierType in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityMapper method getVesselIdentifierTypeList.
protected List<VesselIdentifierType> getVesselIdentifierTypeList(FishingActivityEntity entity) {
if (entity == null || entity.getFaReportDocument() == null || entity.getFaReportDocument().getVesselTransportMeans() == null || CollectionUtils.isEmpty(entity.getFaReportDocument().getVesselTransportMeans()) || CollectionUtils.isEmpty(entity.getFaReportDocument().getVesselTransportMeans().iterator().next().getVesselIdentifiers())) {
return Collections.emptyList();
}
List<VesselIdentifierType> identifiers = new ArrayList<>();
Set<VesselIdentifierEntity> identifierList = entity.getFaReportDocument().getVesselTransportMeans().iterator().next().getVesselIdentifiers();
for (VesselIdentifierEntity identity : identifierList) {
identifiers.add(new VesselIdentifierType(VesselIdentifierSchemeIdEnum.valueOf(identity.getVesselIdentifierSchemeId()), identity.getVesselIdentifierId()));
}
return identifiers;
}
Aggregations