Search in sources :

Example 41 with FishingActivityEntity

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

the class FishingActivityViewMapperTest method testActivityDepartureViewMapper.

@Test
@SneakyThrows
public void testActivityDepartureViewMapper() {
    BaseActivityViewMapper mapperForView = ActivityViewMapperFactory.getMapperForView(ActivityViewEnum.DEPARTURE);
    FishingActivityEntity fishingActivityEntity = getFishingActivityEntity();
    Set<FaCatchEntity> faCatches = generateFaCatches(fishingActivityEntity.getFaCatchs().iterator().next());
    fishingActivityEntity.setFaCatchs(faCatches);
    FishingActivityViewDTO fishingActivityViewDTO = mapperForView.mapFaEntityToFaDto(fishingActivityEntity);
    assertNotNull(fishingActivityViewDTO.getActivityDetails());
    assertNotNull(fishingActivityViewDTO.getReportDetails());
    assertNull(ActivityArrivalViewMapper.INSTANCE.mapFaEntityToFaDto(null));
}
Also used : FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) BaseActivityViewMapper(eu.europa.ec.fisheries.ers.service.mapper.view.base.BaseActivityViewMapper) FishingActivityViewDTO(eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Example 42 with FishingActivityEntity

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

the class FishingActivityViewMapperTest method testActivityJointFishingOperationViewMapper.

@Test
@SneakyThrows
public void testActivityJointFishingOperationViewMapper() {
    FishingActivity fishingActivity = getFishingActivity();
    FishingActivityEntity fishingActivityEntity = FishingActivityMapper.INSTANCE.mapToFishingActivityEntity(fishingActivity, null, new FishingActivityEntity());
    fishingActivityEntity.setTypeCode("JOINT_FISHING_OPERATION");
    fishingActivityEntity.getAllRelatedFishingActivities().iterator().next().setTypeCode("RELOCATION");
    JointFishingOperationViewMapper mapper = new JointFishingOperationViewMapper();
    FishingActivityViewDTO dto = mapper.mapFaEntityToFaDto(fishingActivityEntity);
    assertNotNull(dto);
    assertNotNull(dto.getActivityDetails());
    assertNotNull(dto.getCatches());
    assertNotNull(dto.getGears());
    assertNotNull(dto.getGearProblems());
    assertNotNull(dto.getVesselDetails());
    assertNotNull(dto.getRelocations());
    assertNotNull(dto.getProcessingProducts());
    assertNotNull(dto.getLocations());
}
Also used : MapperUtil.getFishingActivity(eu.europa.ec.fisheries.ers.service.util.MapperUtil.getFishingActivity) FishingActivity(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity) FishingActivityViewDTO(eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO) JointFishingOperationViewMapper(eu.europa.ec.fisheries.ers.service.mapper.view.JointFishingOperationViewMapper) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Example 43 with FishingActivityEntity

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

the class FishingActivityViewMapperTest method testActivityLandingViewMapper.

@Test
@SneakyThrows
public void testActivityLandingViewMapper() {
    BaseActivityViewMapper mapperForView = ActivityViewMapperFactory.getMapperForView(ActivityViewEnum.LANDING);
    FishingActivityEntity fishingActivityEntity = getFishingActivityEntity();
    Set<FaCatchEntity> faCatches = generateFaCatches(fishingActivityEntity.getFaCatchs().iterator().next());
    fishingActivityEntity.setFaCatchs(faCatches);
    FishingActivityViewDTO fishingActivityViewDTO = mapperForView.mapFaEntityToFaDto(fishingActivityEntity);
    assertNotNull(fishingActivityViewDTO.getActivityDetails());
    assertNotNull(fishingActivityViewDTO.getReportDetails());
    assertNull(ActivityArrivalViewMapper.INSTANCE.mapFaEntityToFaDto(null));
// printDtoOnConsole(fishingActivityViewDTO, FishingActivityView.Landing.class);
}
Also used : FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) BaseActivityViewMapper(eu.europa.ec.fisheries.ers.service.mapper.view.base.BaseActivityViewMapper) FishingActivityViewDTO(eu.europa.ec.fisheries.ers.service.dto.view.parent.FishingActivityViewDTO) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Example 44 with FishingActivityEntity

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

the class BaseActivityViewMapperTest method testGetAreas.

@Test
public void testGetAreas() {
    FishingActivityEntity entity = new FishingActivityEntity();
    FluxLocationEntity fluxLocationEntity = new FluxLocationEntity();
    fluxLocationEntity.setFluxLocationIdentifier("id");
    fluxLocationEntity.setFluxLocationIdentifierSchemeId("schemeId");
    fluxLocationEntity.setTypeCode("AREA");
    entity.setFluxLocations(Collections.set(fluxLocationEntity));
    AreaDto areas = BaseActivityViewMapper.getAreas(entity);
    Map<String, String> stringMap = new HashMap<>();
    stringMap.put("id", "id");
    stringMap.put("schemeId", "schemeId");
    assertEquals(stringMap, areas.getIdentifiers());
}
Also used : HashMap(java.util.HashMap) AreaDto(eu.europa.ec.fisheries.ers.service.dto.view.AreaDto) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test)

Example 45 with FishingActivityEntity

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

the class FishingTripIdSearchBuilder method getFishingActivitySummary.

private FishingActivitySummary getFishingActivitySummary(Set<Integer> uniqueFishingActivityIdList, FishingTripEntity entity) {
    FishingActivitySummary fishingActivitySummary = null;
    FishingActivityEntity fishingActivityEntity = entity.getFishingActivity();
    if (fishingActivityEntity != null && uniqueFishingActivityIdList.add(fishingActivityEntity.getId())) {
        fishingActivitySummary = FishingActivityMapper.INSTANCE.mapToFishingActivitySummary(entity.getFishingActivity());
        ContactPartyEntity contactParty = getContactParty(fishingActivityEntity);
        if (contactParty != null) {
            VesselContactPartyType vesselContactParty = FishingActivityMapper.INSTANCE.mapToVesselContactParty(contactParty);
            fishingActivitySummary.setVesselContactParty(vesselContactParty);
        }
    }
    return fishingActivitySummary;
}
Also used : FishingActivitySummary(eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingActivitySummary) VesselContactPartyType(eu.europa.ec.fisheries.uvms.activity.model.schemas.VesselContactPartyType) ContactPartyEntity(eu.europa.ec.fisheries.ers.fa.entities.ContactPartyEntity) 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