use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingOperationViewMapper method mapFaEntityToFaDto.
@Override
public FishingActivityViewDTO mapFaEntityToFaDto(FishingActivityEntity faEntity) {
FishingActivityViewDTO viewDTO = new FishingActivityViewDTO();
ActivityDetailsDto detailsDto = mapActivityDetails(faEntity);
detailsDto.setOccurrence(faEntity.getOccurence());
detailsDto.setVesselActivity(faEntity.getVesselActivityCode());
if (faEntity.getOperationsQuantity() != null && faEntity.getOperationsQuantity().getValue() != null) {
detailsDto.setNrOfOperation(faEntity.getOperationsQuantity().getValue().intValue());
}
detailsDto.setFisheryType(faEntity.getFisheryTypeCode());
detailsDto.setSpeciesTarget(faEntity.getSpeciesTargetCode());
Set<FishingActivityIdentifierEntity> fishingActivityIdentifiers = faEntity.getFishingActivityIdentifiers();
detailsDto.setIdentifiers(FishingActivityIdentifierMapper.INSTANCE.mapToIdentifierDTOSet(fishingActivityIdentifiers));
detailsDto.setFishingTime(this.calculateFishingTime(faEntity.getDelimitedPeriods()));
viewDTO.setActivityDetails(detailsDto);
viewDTO.setGears(this.getGearsFromEntity(faEntity.getFishingGears()));
viewDTO.setReportDetails(this.getReportDocsFromEntity(faEntity.getFaReportDocument()));
viewDTO.setCatches(this.mapCatchesToGroupDto(faEntity));
viewDTO.setProcessingProducts(this.getProcessingProductsByFaCatches(faEntity.getFaCatchs()));
viewDTO.setGearProblems(GearShotRetrievalTileMapper.INSTANCE.mapGearProblemsToGearsDto(faEntity.getGearProblems()));
viewDTO.setGearShotRetrievalList(GearShotRetrievalTileMapperImpl.INSTANCE.mapFromRelatedFishingActivities(faEntity));
Set<FluxLocationDto> fluxLocationDtos = mapFromFluxLocation(faEntity.getFluxLocations());
viewDTO.setLocations(fluxLocationDtos);
viewDTO.setVesselDetails(getVesselDetailsDTO(faEntity));
return viewDTO;
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityTranshipmentViewMapper method populateActivityDetails.
protected ActivityDetailsDto populateActivityDetails(FishingActivityEntity faEntity, ActivityDetailsDto activityDetails) {
Map<String, String> idMap = new HashMap<>();
for (FishingActivityIdentifierEntity idEntity : faEntity.getFishingActivityIdentifiers()) {
idMap.put(idEntity.getFaIdentifierId(), idEntity.getFaIdentifierSchemeId());
}
Set<IdentifierDto> identifierDtos = FishingActivityIdentifierMapper.INSTANCE.mapToIdentifierDTOSet(faEntity.getFishingActivityIdentifiers());
activityDetails.setIdentifiers(identifierDtos);
Set<DelimitedPeriodEntity> delimitedPeriodEntitySet = faEntity.getDelimitedPeriods();
if (!Collections.isEmpty(delimitedPeriodEntitySet)) {
DelimitedPeriodEntity delimitedPeriod = delimitedPeriodEntitySet.iterator().next();
DelimitedPeriodDTO delimitedPeriodDTO = DelimitedPeriodMapper.INSTANCE.mapToDelimitedPeriodDTO(delimitedPeriod);
activityDetails.setTranshipmentTime(delimitedPeriodDTO);
// Override occurrence date from delimited period
activityDetails.setOccurrence(delimitedPeriod.getStartDate());
}
return activityDetails;
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class DiscardViewMapper method mapFaEntityToFaDto.
@Override
public FishingActivityViewDTO mapFaEntityToFaDto(FishingActivityEntity faEntity) {
FishingActivityViewDTO fishingActivityViewDTO = new FishingActivityViewDTO();
ActivityDetailsDto activityDetailsDto = mapActivityDetails(faEntity);
activityDetailsDto.setReason(faEntity.getReasonCode());
Set<FishingActivityIdentifierEntity> fishingActivityIdentifiers = faEntity.getFishingActivityIdentifiers();
activityDetailsDto.setIdentifiers(FishingActivityIdentifierMapper.INSTANCE.mapToIdentifierDTOSet(fishingActivityIdentifiers));
fishingActivityViewDTO.setActivityDetails(activityDetailsDto);
fishingActivityViewDTO.setLocations(mapFromFluxLocation(faEntity.getFluxLocations()));
fishingActivityViewDTO.setReportDetails(getReportDocsFromEntity(faEntity.getFaReportDocument()));
fishingActivityViewDTO.setCatches(mapCatchesToGroupDto(faEntity));
fishingActivityViewDTO.setProcessingProducts(getProcessingProductsByFaCatches(faEntity.getFaCatchs()));
return fishingActivityViewDTO;
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityMapper method mapToFishingActivityIdentifierEntities.
protected Set<FishingActivityIdentifierEntity> mapToFishingActivityIdentifierEntities(List<IDType> idTypes, FishingActivityEntity fishingActivityEntity) {
if (idTypes == null || idTypes.isEmpty()) {
return Collections.emptySet();
}
Set<FishingActivityIdentifierEntity> identifierEntities = new HashSet<>();
for (IDType idType : idTypes) {
FishingActivityIdentifierEntity identifier = FishingActivityMapper.INSTANCE.mapToFishingActivityIdentifierEntity(idType);
identifier.setFishingActivity(fishingActivityEntity);
identifierEntities.add(identifier);
}
return identifierEntities;
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityServiceBeanTest method mockFishActEntities.
private List<FishingActivityEntity> mockFishActEntities() {
final FishingActivityEntity fishAct = new FishingActivityEntity();
FishingActivityIdentifierEntity ident = new FishingActivityIdentifierEntity();
ident.setFaIdentifierId("faId");
ident.setFaIdentifierSchemeId("faSchemeId");
Set<FishingActivityIdentifierEntity> fishIdentList = new HashSet<>();
fishIdentList.add(ident);
Set<FishingTripEntity> fishTrips = new HashSet<>();
FishingTripEntity fishTrip = new FishingTripEntity();
Set<FishingTripIdentifierEntity> fishingTripIdentifiers = new HashSet<>();
FishingTripIdentifierEntity tripident = new FishingTripIdentifierEntity();
tripident.setTripId("tripId");
tripident.setTripSchemeId("tripSchemeId");
fishingTripIdentifiers.add(tripident);
fishTrips.add(fishTrip);
fishTrip.setTypeCode("someTripCode");
fishTrip.setFishingActivity(fishAct);
fishTrip.setFishingTripIdentifiers(fishingTripIdentifiers);
fishAct.setFishingActivityIdentifiers(fishIdentList);
fishAct.setTypeCode("faTypeCode");
fishAct.setFishingTrips(fishTrips);
return new ArrayList<FishingActivityEntity>() {
{
add(fishAct);
}
};
}
Aggregations