Search in sources :

Example 1 with VesselIdentifierType

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;
}
Also used : VesselTransportMeansEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity) VesselIdentifierType(eu.europa.ec.fisheries.uvms.activity.model.schemas.VesselIdentifierType) VesselIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity) ArrayList(java.util.ArrayList) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)

Example 2 with VesselIdentifierType

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;
}
Also used : VesselIdentifierType(eu.europa.ec.fisheries.uvms.activity.model.schemas.VesselIdentifierType) VesselIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity) ArrayList(java.util.ArrayList)

Aggregations

VesselIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity)2 VesselIdentifierType (eu.europa.ec.fisheries.uvms.activity.model.schemas.VesselIdentifierType)2 ArrayList (java.util.ArrayList)2 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)1 VesselTransportMeansEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity)1