use of eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEntityToModelMapper method mapIDs.
private void mapIDs(VesselTransportMeans vesselTransportMeans, Set<VesselIdentifierEntity> vesselIdentifiers) {
if (CollectionUtils.isNotEmpty(vesselIdentifiers)) {
List<IDType> idTypeList = new ArrayList<>();
for (VesselIdentifierEntity vesselIdentifierEntity : vesselIdentifiers) {
IDType idType = new IDType();
idType.setValue(vesselIdentifierEntity.getVesselIdentifierId());
idType.setSchemeID(vesselIdentifierEntity.getVesselIdentifierSchemeId());
idTypeList.add(idType);
}
vesselTransportMeans.setIDS(idTypeList);
}
}
use of eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityMapper method getVesselIdType.
protected Map<String, String> getVesselIdType(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.emptyMap();
}
Map<String, String> vesselTransportIdList = new HashMap<>();
/*
We can assume that FaReportDocument will always have only one VesselTransportMeans.One to many relation is artificially created
*/
Set<VesselIdentifierEntity> identifierList = entity.getFaReportDocument().getVesselTransportMeans().iterator().next().getVesselIdentifiers();
for (VesselIdentifierEntity identity : identifierList) {
vesselTransportIdList.put(identity.getVesselIdentifierSchemeId(), identity.getVesselIdentifierId());
}
return vesselTransportIdList;
}
use of eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity 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;
}
use of eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class VesselTransportMeansMapper method mapToVesselIdentifierEntities.
protected Set<VesselIdentifierEntity> mapToVesselIdentifierEntities(List<IDType> idTypes, VesselTransportMeansEntity vesselTransportMeansEntity) {
if (idTypes == null || idTypes.isEmpty()) {
return Collections.emptySet();
}
Set<VesselIdentifierEntity> vesselIdentifierEntities = new HashSet<>();
for (IDType idType : idTypes) {
VesselIdentifierEntity vesselIdentifierEntity = VesselTransportMeansMapper.INSTANCE.mapToVesselIdentifierEntity(idType);
vesselIdentifierEntity.setVesselTransportMeans(vesselTransportMeansEntity);
vesselIdentifierEntities.add(vesselIdentifierEntity);
}
return vesselIdentifierEntities;
}
use of eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingTripServiceBean method getNextTrips.
private Set<String> getNextTrips(String tripId, Integer limit, List<VesselIdentifierEntity> vesselIdentifiers) {
Set<String> tripIds = new LinkedHashSet<>();
if (vesselIdentifiers != null && !vesselIdentifiers.isEmpty()) {
for (VesselIdentifierEntity vesselIdentifier : vesselIdentifiers) {
// FIXME
List<FishingTripIdentifierEntity> identifierEntities = fishingTripIdentifierDao.getNextTrips(vesselIdentifier.getVesselIdentifierId(), vesselIdentifier.getVesselIdentifierSchemeId(), tripId, limit);
for (FishingTripIdentifierEntity identifiers : identifierEntities) {
tripIds.add(identifiers.getTripId());
}
}
}
log.debug("Next Trips : " + tripIds);
return tripIds;
}
Aggregations