Search in sources :

Example 21 with VesselTransportMeansEntity

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

the class VesselTransportMeansMapperTest method testVesselTransportMeansMapper.

@Test
public void testVesselTransportMeansMapper() {
    VesselTransportMeans vesselTransportMeans = MapperUtil.getVesselTransportMeans();
    VesselTransportMeansEntity vesselTransportMeansEntity = VesselTransportMeansMapper.INSTANCE.mapToVesselTransportMeansEntity(vesselTransportMeans);
    assertEquals(vesselTransportMeans.getGrantedFLAPDocuments().get(0).getID().getValue(), vesselTransportMeansEntity.getFlapDocuments().iterator().next().getFlapDocumentId());
    assertEquals(vesselTransportMeans.getGrantedFLAPDocuments().get(0).getID().getSchemeID(), vesselTransportMeansEntity.getFlapDocuments().iterator().next().getFlapDocumentSchemeId());
    assertTrue(vesselTransportMeansEntity.getName().startsWith(vesselTransportMeans.getNames().get(0).getValue()));
    assertEquals(vesselTransportMeans.getRoleCode().getValue(), vesselTransportMeansEntity.getRoleCode());
    assertEquals(vesselTransportMeans.getRoleCode().getListID(), vesselTransportMeansEntity.getRoleCodeListId());
    assertEquals(vesselTransportMeans.getRegistrationVesselCountry().getID().getSchemeID(), vesselTransportMeansEntity.getCountrySchemeId());
    assertEquals(vesselTransportMeans.getRegistrationVesselCountry().getID().getValue(), vesselTransportMeansEntity.getCountry());
    assertNotNull(vesselTransportMeansEntity.getVesselIdentifiers());
    VesselIdentifierEntity vesselIdentifierEntity = vesselTransportMeansEntity.getVesselIdentifiers().iterator().next();
    assertEquals(vesselTransportMeans.getIDS().get(0).getValue(), vesselIdentifierEntity.getVesselIdentifierId());
    assertEquals(vesselTransportMeans.getIDS().get(0).getSchemeID(), vesselIdentifierEntity.getVesselIdentifierSchemeId());
    assertNotNull(vesselTransportMeansEntity.getContactParty());
    vesselTransportMeansEntity = vesselTransportMeansEntity.getContactParty().iterator().next().getVesselTransportMeans();
    assertEquals(vesselTransportMeans.getGrantedFLAPDocuments().get(0).getID().getValue(), vesselTransportMeansEntity.getFlapDocuments().iterator().next().getFlapDocumentId());
    assertEquals(vesselTransportMeans.getGrantedFLAPDocuments().get(0).getID().getSchemeID(), vesselTransportMeansEntity.getFlapDocuments().iterator().next().getFlapDocumentSchemeId());
    assertTrue(vesselTransportMeansEntity.getName().startsWith(vesselTransportMeans.getNames().get(0).getValue()));
    assertEquals(vesselTransportMeans.getRoleCode().getValue(), vesselTransportMeansEntity.getRoleCode());
    assertEquals(vesselTransportMeans.getRoleCode().getListID(), vesselTransportMeansEntity.getRoleCodeListId());
    assertNotNull(vesselTransportMeansEntity.getRegistrationEvent());
    vesselTransportMeansEntity = vesselTransportMeansEntity.getRegistrationEvent().getVesselTransportMeanses();
    assertEquals(vesselTransportMeans.getGrantedFLAPDocuments().get(0).getID().getValue(), vesselTransportMeansEntity.getFlapDocuments().iterator().next().getFlapDocumentId());
    assertEquals(vesselTransportMeans.getGrantedFLAPDocuments().get(0).getID().getSchemeID(), vesselTransportMeansEntity.getFlapDocuments().iterator().next().getFlapDocumentSchemeId());
    assertTrue(vesselTransportMeansEntity.getName().startsWith(vesselTransportMeans.getNames().get(0).getValue()));
    assertEquals(vesselTransportMeans.getRoleCode().getValue(), vesselTransportMeansEntity.getRoleCode());
    assertEquals(vesselTransportMeans.getRoleCode().getListID(), vesselTransportMeansEntity.getRoleCodeListId());
}
Also used : VesselTransportMeansEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity) VesselIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity) VesselTransportMeans(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans) Test(org.junit.Test)

Example 22 with VesselTransportMeansEntity

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

the class ActivityDataUtil method getVesselTransportMeansEntity.

public static VesselTransportMeansEntity getVesselTransportMeansEntity(String roleCode, String roleCodeListId, String name, RegistrationEventEntity registrationEventEntity) {
    VesselTransportMeansEntity vesselTransportMeansEntity = new VesselTransportMeansEntity();
    vesselTransportMeansEntity.setRoleCode(roleCode);
    vesselTransportMeansEntity.setRoleCodeListId(roleCodeListId);
    vesselTransportMeansEntity.setName(name);
    vesselTransportMeansEntity.setRegistrationEvent(registrationEventEntity);
    return vesselTransportMeansEntity;
}
Also used : VesselTransportMeansEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity)

Example 23 with VesselTransportMeansEntity

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

the class MapperUtil method getFishingActivityEntityList.

public static List<FishingActivityEntity> getFishingActivityEntityList() {
    FishingTripEntity entity = new FishingTripEntity();
    FluxReportDocumentEntity fluxReportDocumentEntity1 = ActivityDataUtil.getFluxReportDocumentEntity("FLUX_REPORT_DOCUMENT1", null, DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "PURPOSE", "PURPOSE_CODE_LIST", null, "OWNER_FLUX_ID1", "flux1");
    FluxReportDocumentEntity fluxReportDocumentEntity2 = ActivityDataUtil.getFluxReportDocumentEntity("FLUX_REPORT_DOCUMENT2", null, DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "PURPOSE", "PURPOSE_CODE_LIST", null, "OWNER_FLUX_ID2", "flux2");
    FluxReportDocumentEntity fluxReportDocumentEntity3 = ActivityDataUtil.getFluxReportDocumentEntity("FLUX_REPORT_DOCUMENT3", null, DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "PURPOSE", "PURPOSE_CODE_LIST", null, "OWNER_FLUX_ID3", "flux3");
    VesselTransportMeansEntity vesselTransportMeansEntity1 = ActivityDataUtil.getVesselTransportMeansEntity("PAIR_FISHING_PARTNER", "FA_VESSEL_ROLE", "vesselGroup1", null);
    VesselTransportMeansEntity vesselTransportMeansEntity2 = ActivityDataUtil.getVesselTransportMeansEntity("PAIR_FISHING_PARTNER", "FA_VESSEL_ROLE", "vesselGroup2", null);
    VesselTransportMeansEntity vesselTransportMeansEntity3 = ActivityDataUtil.getVesselTransportMeansEntity("PAIR_FISHING_PARTNER", "FA_VESSEL_ROLE", "vesselGroup3", null);
    FaReportDocumentEntity faReportDocumentEntity1 = ActivityDataUtil.getFaReportDocumentEntity("Declaration", "FLUX_FA_REPORT_TYPE", DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), fluxReportDocumentEntity1, vesselTransportMeansEntity1, "new");
    FaReportDocumentEntity faReportDocumentEntity2 = ActivityDataUtil.getFaReportDocumentEntity("Declaration", "FLUX_FA_REPORT_TYPE", DateUtils.parseToUTCDate("2015-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), fluxReportDocumentEntity2, vesselTransportMeansEntity2, "new");
    FaReportDocumentEntity faReportDocumentEntity3 = ActivityDataUtil.getFaReportDocumentEntity("Declaration", "FLUX_FA_REPORT_TYPE", DateUtils.parseToUTCDate("2015-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), fluxReportDocumentEntity3, vesselTransportMeansEntity3, "new");
    FishingActivityEntity fishingActivityEntity1 = ActivityDataUtil.getFishingActivityEntity("DEPARTURE", "FLUX_FA_TYPE", DateUtils.parseToUTCDate("2014-05-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "FISHING", "FIS", faReportDocumentEntity1, null);
    FishingActivityEntity fishingActivityEntity2 = ActivityDataUtil.getFishingActivityEntity("ARRIVAL", "FLUX_FA_TYPE", DateUtils.parseToUTCDate("2014-05-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "FISHING", "FIS", faReportDocumentEntity2, null);
    FishingActivityEntity fishingActivityEntity3 = ActivityDataUtil.getFishingActivityEntity("LANDING", "FLUX_FA_TYPE", DateUtils.parseToUTCDate("2014-05-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "FISHING", "FIS", faReportDocumentEntity3, null);
    List<FishingActivityEntity> fishingActivityEntityList = new ArrayList<>();
    fishingActivityEntityList.add(fishingActivityEntity1);
    fishingActivityEntityList.add(fishingActivityEntity2);
    fishingActivityEntityList.add(fishingActivityEntity3);
    return fishingActivityEntityList;
}
Also used : FishingTripEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity) VesselTransportMeansEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity) FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) FluxReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity) ArrayList(java.util.ArrayList) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)

Example 24 with VesselTransportMeansEntity

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

the class MapperUtil method getFishingTripEntityWithContactParties.

public static FishingTripEntity getFishingTripEntityWithContactParties() {
    FishingTripEntity fishingTripEntity = getFishingTripEntity();
    Set<VesselTransportMeansEntity> vesselTransportEntityList = fishingTripEntity.getFishingActivity().getFaReportDocument().getVesselTransportMeans();
    Set<ContactPartyEntity> contactParties = new HashSet<>();
    ContactPartyEntity contPartEntity_1 = ActivityDataUtil.getContactPartyEntity("title1", "givenName1", "middleName1", "familyName1", "familyNamePrefix1", "nameSuffix1", "gender1", "alias1");
    ContactPartyEntity contPartEntity_2 = ActivityDataUtil.getContactPartyEntity("title2", "givenName2", "middleName2", "familyName2", "familyNamePrefix2", "nameSuffix2", "gender2", "alias2");
    Set<ContactPartyRoleEntity> roleList_1 = ActivityDataUtil.getContactPartyRole("SOMEROLE", "ROLE_CODE1", contPartEntity_1);
    Set<ContactPartyRoleEntity> roleList_2 = ActivityDataUtil.getContactPartyRole("MASTER", "ROLE_CODE2", contPartEntity_2);
    contPartEntity_1.setContactPartyRole(roleList_1);
    contPartEntity_2.setContactPartyRole(roleList_2);
    contactParties.addAll(Arrays.asList(contPartEntity_1, contPartEntity_2));
    for (VesselTransportMeansEntity vesselTransportMeansEntity : vesselTransportEntityList) {
        vesselTransportMeansEntity.setContactParty(contactParties);
    }
    return fishingTripEntity;
}
Also used : FishingTripEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity) VesselTransportMeansEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity) ContactPartyRoleEntity(eu.europa.ec.fisheries.ers.fa.entities.ContactPartyRoleEntity) ContactPartyEntity(eu.europa.ec.fisheries.ers.fa.entities.ContactPartyEntity) HashSet(java.util.HashSet)

Example 25 with VesselTransportMeansEntity

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

the class FishingActivityServiceBeanTest method testEnrichVesselDetailsAndContactPartiesForFishingTrip.

@Test
@SneakyThrows
public void testEnrichVesselDetailsAndContactPartiesForFishingTrip() {
    Map<String, List<String>> returnMap = new HashMap<>();
    returnMap.put("code", new ArrayList<String>());
    when(vesselTransportMeansDao.findLatestVesselByTripId(Mockito.anyString())).thenReturn(new VesselTransportMeansEntity());
    when(mdrModuleServiceBean.getAcronymFromMdr("FLUX_VESSEL_ID_TYPE", "*", new ArrayList<String>(), 9999999, "code")).thenReturn(returnMap);
    List<Asset> listAssetResponse = new ArrayList<>();
    Asset asset = new Asset();
    asset.setCfr("UPDATED_CFR");
    asset.setIrcs("UPDATED_IRCS");
    asset.setImo("UPDATED_IMO");
    asset.setName("name");
    listAssetResponse.add(asset);
    when(assetModule.getAssetListResponse(Mockito.any(AssetListQuery.class))).thenReturn(listAssetResponse);
    VesselDetailsDTO vesselDetailsDTO = fishingTripService.getVesselDetailsForFishingTrip("NOR-TRP-20160517234053706");
    assertNotNull(vesselDetailsDTO);
}
Also used : VesselTransportMeansEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AssetListQuery(eu.europa.ec.fisheries.wsdl.asset.types.AssetListQuery) VesselDetailsDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.details.VesselDetailsDTO) Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test) SneakyThrows(lombok.SneakyThrows)

Aggregations

VesselTransportMeansEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity)25 ArrayList (java.util.ArrayList)12 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)8 VesselDetailsDTO (eu.europa.ec.fisheries.ers.service.dto.fareport.details.VesselDetailsDTO)7 Test (org.junit.Test)6 HashSet (java.util.HashSet)5 FaReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)4 FishingTripEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)4 FluxReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity)3 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)3 HashMap (java.util.HashMap)3 List (java.util.List)3 SneakyThrows (lombok.SneakyThrows)3 VesselTransportMeans (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans)3 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)2 FishingTripIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity)2 SizeDistributionEntity (eu.europa.ec.fisheries.ers.fa.entities.SizeDistributionEntity)2 VesselIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity)2 TripOverviewDto (eu.europa.ec.fisheries.ers.service.dto.view.TripOverviewDto)2 TripWidgetDto (eu.europa.ec.fisheries.ers.service.dto.view.TripWidgetDto)2