Search in sources :

Example 11 with VesselTransportMeansEntity

use of eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity 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 12 with VesselTransportMeansEntity

use of eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingOperationViewMapper 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;
}
Also used : VesselTransportMeansEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity) VesselDetailsDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.details.VesselDetailsDTO) ArrayList(java.util.ArrayList)

Example 13 with VesselTransportMeansEntity

use of eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class VesselTransportMeansDaoTest method testFindLatestVesselByTripId.

@Test
public void testFindLatestVesselByTripId() throws Exception {
    VesselTransportMeansEntity latestVesselByTripId = dao.findLatestVesselByTripId("1");
    assertNotNull(latestVesselByTripId);
}
Also used : VesselTransportMeansEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity) BaseErsFaDaoTest(eu.europa.ec.fisheries.ers.fa.entities.BaseErsFaDaoTest) Test(org.junit.Test)

Example 14 with VesselTransportMeansEntity

use of eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityEntityToModelMapper method mapSpecifiedVesselTransportMeans.

private void mapSpecifiedVesselTransportMeans(FAReportDocument target, Set<VesselTransportMeansEntity> entities) {
    if (CollectionUtils.isNotEmpty(entities) && target != null) {
        VesselTransportMeans vesselTransportMeans = new VesselTransportMeans();
        VesselTransportMeansEntity source = entities.iterator().next();
        setRoleCode(vesselTransportMeans, source.getRoleCodeListId(), source.getRoleCode());
        mapNames(vesselTransportMeans, source.getName());
        mapRegistrationVesselCountry(vesselTransportMeans, source.getCountry(), source.getCountrySchemeId());
        mapRegistrationEvent(vesselTransportMeans, source.getRegistrationEvent());
        mapIDs(vesselTransportMeans, source.getVesselIdentifiers());
        mapSpecifiedContactParties(vesselTransportMeans, source.getContactParty());
        vesselTransportMeans.setGrantedFLAPDocuments(FlapDocumentMapper.INSTANCE.mapToFlapDocumentList(source.getFlapDocuments()));
        target.setSpecifiedVesselTransportMeans(vesselTransportMeans);
    }
}
Also used : VesselTransportMeansEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity) VesselTransportMeans(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans)

Example 15 with VesselTransportMeansEntity

use of eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingActivityMapper method getVesselTransportMeansEntity.

protected Set<VesselTransportMeansEntity> getVesselTransportMeansEntity(FishingActivity fishingActivity, FaReportDocumentEntity faReportDocumentEntity, FishingActivityEntity fishingActivityEntity) {
    List<VesselTransportMeans> vesselList = fishingActivity.getRelatedVesselTransportMeans();
    if (vesselList == null || vesselList.isEmpty()) {
        return null;
    }
    Set<VesselTransportMeansEntity> vesselTransportMeansEntities = new HashSet<>();
    for (VesselTransportMeans vesselTransportMeans : vesselList) {
        VesselTransportMeansEntity vesselTransportMeansEntity = VesselTransportMeansMapper.INSTANCE.mapToVesselTransportMeansEntity(vesselTransportMeans);
        vesselTransportMeansEntity.setFaReportDocument(faReportDocumentEntity);
        vesselTransportMeansEntity.setFishingActivity(fishingActivityEntity);
        vesselTransportMeansEntities.add(vesselTransportMeansEntity);
    }
    return vesselTransportMeansEntities;
}
Also used : VesselTransportMeansEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity) VesselTransportMeans(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans) HashSet(java.util.HashSet)

Aggregations

VesselTransportMeansEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity)25 ArrayList (java.util.ArrayList)12 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)8 VesselDetailsDTO (eu.europa.ec.fisheries.ers.service.dto.fareport.details.VesselDetailsDTO)7 Test (org.junit.Test)6 HashSet (java.util.HashSet)5 FaReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)4 FishingTripEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)4 FluxReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity)3 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)3 HashMap (java.util.HashMap)3 List (java.util.List)3 SneakyThrows (lombok.SneakyThrows)3 VesselTransportMeans (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans)3 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)2 FishingTripIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity)2 SizeDistributionEntity (eu.europa.ec.fisheries.ers.fa.entities.SizeDistributionEntity)2 VesselIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity)2 TripOverviewDto (eu.europa.ec.fisheries.ers.service.dto.view.TripOverviewDto)2 TripWidgetDto (eu.europa.ec.fisheries.ers.service.dto.view.TripWidgetDto)2