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;
}
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;
}
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);
}
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);
}
}
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;
}
Aggregations