Search in sources :

Example 1 with FishingActivityIdentifierEntity

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;
}
Also used : ActivityDetailsDto(eu.europa.ec.fisheries.ers.service.dto.view.ActivityDetailsDto) FishingActivityViewDTO(eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO) FishingActivityIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity) FluxLocationDto(eu.europa.ec.fisheries.ers.service.dto.view.FluxLocationDto)

Example 2 with FishingActivityIdentifierEntity

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;
}
Also used : DelimitedPeriodEntity(eu.europa.ec.fisheries.ers.fa.entities.DelimitedPeriodEntity) IdentifierDto(eu.europa.ec.fisheries.ers.service.dto.view.IdentifierDto) HashMap(java.util.HashMap) FishingActivityIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity) DelimitedPeriodDTO(eu.europa.ec.fisheries.ers.service.dto.DelimitedPeriodDTO)

Example 3 with FishingActivityIdentifierEntity

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;
}
Also used : ActivityDetailsDto(eu.europa.ec.fisheries.ers.service.dto.view.ActivityDetailsDto) FishingActivityViewDTO(eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO) FishingActivityIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity)

Example 4 with FishingActivityIdentifierEntity

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;
}
Also used : FishingActivityIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType) HashSet(java.util.HashSet)

Example 5 with FishingActivityIdentifierEntity

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);
        }
    };
}
Also used : FishingTripEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity) ArrayList(java.util.ArrayList) FishingActivityIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity) FishingTripIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) HashSet(java.util.HashSet)

Aggregations

FishingActivityIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity)6 DelimitedPeriodEntity (eu.europa.ec.fisheries.ers.fa.entities.DelimitedPeriodEntity)2 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)2 FishingTripEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)2 ActivityDetailsDto (eu.europa.ec.fisheries.ers.service.dto.view.ActivityDetailsDto)2 FishingActivityViewDTO (eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO)2 HashSet (java.util.HashSet)2 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)1 FishingGearEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity)1 FishingTripIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity)1 FluxCharacteristicEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity)1 FluxLocationEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)1 DelimitedPeriodDTO (eu.europa.ec.fisheries.ers.service.dto.DelimitedPeriodDTO)1 FluxLocationDto (eu.europa.ec.fisheries.ers.service.dto.view.FluxLocationDto)1 IdentifierDto (eu.europa.ec.fisheries.ers.service.dto.view.IdentifierDto)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 FishingActivity (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity)1 IDType (un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)1