Search in sources :

Example 11 with FishingActivityEntity

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

the class FishingTripServiceBean method retrieveCatchEvolutionForFishingTrip.

@Override
public CatchEvolutionDTO retrieveCatchEvolutionForFishingTrip(String fishingTripId) throws ServiceException {
    CatchEvolutionDTO catchEvolution = new CatchEvolutionDTO();
    List<FishingActivityEntity> fishingActivities = fishingActivityDao.getFishingActivityListForFishingTrip(fishingTripId, null);
    List<Object[]> faCatches = faCatchDao.findFaCatchesByFishingTrip(fishingTripId);
    catchEvolution.setTripDetails(getTripWidgetDto(fishingActivities.get(0), fishingTripId));
    catchEvolution.setCatchEvolutionProgress(prepareCatchEvolutionProgress(fishingActivities));
    return catchEvolution;
}
Also used : CatchEvolutionDTO(eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionDTO) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)

Example 12 with FishingActivityEntity

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

the class FluxMessageServiceBean method populateGeometriesForFishingActivities.

private List<Geometry> populateGeometriesForFishingActivities(List<MovementType> movements, Set<FishingActivityEntity> fishingActivityEntities) throws ServiceException {
    List<Geometry> multiPointForFaReport = new ArrayList<>();
    if (CollectionUtils.isNotEmpty(fishingActivityEntities)) {
        for (FishingActivityEntity fishingActivity : fishingActivityEntities) {
            List<Geometry> multiPointForFa = new ArrayList<>();
            Date activityDate = fishingActivity.getOccurence() != null ? fishingActivity.getOccurence() : getFirstDateFromDelimitedPeriods(fishingActivity.getDelimitedPeriods());
            Geometry interpolatedPoint = interpolatePointFromMovements(movements, activityDate);
            for (FluxLocationEntity fluxLocation : fishingActivity.getFluxLocations()) {
                Geometry point = null;
                String fluxLocationStr = fluxLocation.getTypeCode();
                if (fluxLocationStr.equalsIgnoreCase(FluxLocationEnum.AREA.name())) {
                    point = interpolatedPoint;
                    fluxLocation.setGeom(point);
                } else if (fluxLocationStr.equalsIgnoreCase(FluxLocationEnum.LOCATION.name())) {
                    point = getGeometryForLocation(fluxLocation);
                    log.debug("Geometry calculated for location is:" + point);
                    fluxLocation.setGeom(point);
                } else if (fluxLocationStr.equalsIgnoreCase(FluxLocationEnum.POSITION.name())) {
                    point = GeometryUtils.createPoint(fluxLocation.getLongitude(), fluxLocation.getLatitude());
                    fluxLocation.setGeom(point);
                }
                if (point != null) {
                    multiPointForFa.add(point);
                    multiPointForFaReport.add(point);
                }
            }
            fishingActivity.setGeom(GeometryUtils.createMultipoint(multiPointForFa));
        }
    }
    return multiPointForFaReport;
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) ArrayList(java.util.ArrayList) Date(java.util.Date) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)

Example 13 with FishingActivityEntity

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

the class ActivityServiceBean method getFaAndTripIdsFromTripIds.

@Override
public GetFishingActivitiesForTripResponse getFaAndTripIdsFromTripIds(List<FishingActivityForTripIds> faAndTripIds) throws ServiceException {
    GetFishingActivitiesForTripResponse response = new GetFishingActivitiesForTripResponse();
    List<FaIdsListWithTripIdMap> responseList = new ArrayList<>();
    response.setFaWithIdentifiers(responseList);
    for (FishingActivityForTripIds faTripId : faAndTripIds) {
        List<FishingActivityEntity> fishingActivies = fishingActivityDao.getFishingActivityForTrip(faTripId.getTripId(), faTripId.getTripSchemeId(), faTripId.getFishActTypeCode(), faTripId.getFluxRepDocPurposeCodes());
        for (FishingActivityEntity faEntity : fishingActivies) {
            addToIdsList(responseList, faEntity);
        }
    }
    return response;
}
Also used : FaIdsListWithTripIdMap(eu.europa.ec.fisheries.uvms.activity.model.schemas.FaIdsListWithTripIdMap) FishingActivityForTripIds(eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingActivityForTripIds) ArrayList(java.util.ArrayList) GetFishingActivitiesForTripResponse(eu.europa.ec.fisheries.uvms.activity.model.schemas.GetFishingActivitiesForTripResponse) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)

Example 14 with FishingActivityEntity

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

the class ActivityServiceBean method getPreviousFishingActivity.

public int getPreviousFishingActivity(int fishingActivityId) {
    log.info(" Retrieve fishing activity from db:" + fishingActivityId);
    FishingActivityEntity activityEntity = fishingActivityDao.getFishingActivityById(fishingActivityId, null);
    log.info(" activityEntity received from db Id:" + activityEntity.getId() + " typeCode: " + activityEntity.getTypeCode() + " Date:" + DateUtils.parseUTCDateToString(activityEntity.getCalculatedStartTime()));
    return fishingActivityDao.getPreviousFishingActivityId(activityEntity.getId(), activityEntity.getTypeCode(), activityEntity.getCalculatedStartTime());
}
Also used : FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)

Example 15 with FishingActivityEntity

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

the class ActivityServiceBean method getNextFishingActivity.

public int getNextFishingActivity(int fishingActivityId) {
    log.info(" Retrieve fishing activity from db:" + fishingActivityId);
    FishingActivityEntity activityEntity = fishingActivityDao.getFishingActivityById(fishingActivityId, null);
    log.info(" activityEntity received from db Id:" + activityEntity.getId() + " typeCode: " + activityEntity.getTypeCode() + " Date:" + DateUtils.parseUTCDateToString(activityEntity.getCalculatedStartTime()));
    return fishingActivityDao.getNextFishingActivityId(activityEntity.getId(), activityEntity.getTypeCode(), activityEntity.getCalculatedStartTime());
}
Also used : FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)

Aggregations

FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)45 Test (org.junit.Test)17 ArrayList (java.util.ArrayList)14 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)11 FaReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)9 VesselTransportMeansEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity)8 CatchEvolutionProgressDTO (eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionProgressDTO)5 FishingActivityViewDTO (eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO)5 SneakyThrows (lombok.SneakyThrows)5 FishingActivity (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity)5 FishingTripEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)4 HashMap (java.util.HashMap)4 Geometry (com.vividsolutions.jts.geom.Geometry)3 FishingTripIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity)3 FluxLocationEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)3 FluxReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity)3 BaseActivityViewMapper (eu.europa.ec.fisheries.ers.service.mapper.view.base.BaseActivityViewMapper)3 FishingActivityQuery (eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery)3 FishingActivitySummary (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingActivitySummary)3 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)3