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