Search in sources :

Example 1 with FishingActivityEntity

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

the class FaReportDocumentMapperTest method testFaReportDocumentMapperNullReturns.

@Test
public void testFaReportDocumentMapperNullReturns() {
    Set<FishingActivityEntity> fishingActivityEntities = FaReportDocumentMapper.INSTANCE.getFishingActivityEntities(null, new FaReportDocumentEntity());
    assertTrue(fishingActivityEntities.size() == 0);
    Set<VesselTransportMeansEntity> vesselTransportMeansEntityList = FaReportDocumentMapper.INSTANCE.getVesselTransportMeansEntity(null, new FaReportDocumentEntity());
    assertNull(vesselTransportMeansEntityList);
    Set<FishingActivityEntity> fishingActivityEntities1 = FaReportDocumentMapper.INSTANCE.getFishingActivityEntities(null, new FaReportDocumentEntity());
    assertTrue(fishingActivityEntities1.size() == 0);
    Set<FaReportIdentifierEntity> faReportIdentifierEntities = FaReportDocumentMapper.INSTANCE.mapToFAReportIdentifierEntities(null, new FaReportDocumentEntity());
    assertTrue(faReportIdentifierEntities.size() == 0);
}
Also used : FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) VesselTransportMeansEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity) FaReportIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportIdentifierEntity) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test)

Example 2 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 3 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)

Example 4 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 5 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)

Aggregations

FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)44 Test (org.junit.Test)18 ArrayList (java.util.ArrayList)13 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)11 FaReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)8 VesselTransportMeansEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity)7 FluxLocationEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)5 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 FishingTripEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)4 HashMap (java.util.HashMap)4 FishingActivity (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity)4 Geometry (com.vividsolutions.jts.geom.Geometry)3 FishingTripIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity)3 FluxReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity)3 BaseActivityViewMapper (eu.europa.ec.fisheries.ers.service.mapper.view.base.BaseActivityViewMapper)3 ContactPartyEntity (eu.europa.ec.fisheries.ers.fa.entities.ContactPartyEntity)2 FishingActivityIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity)2 FluxCharacteristicEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity)2