Search in sources :

Example 11 with VesselIdentifierEntity

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

the class FishingTripServiceBean method getCurrentTrip.

private String getCurrentTrip(List<VesselIdentifierEntity> vesselIdentifiers) {
    String currentTrip = null;
    if (vesselIdentifiers != null && !vesselIdentifiers.isEmpty()) {
        for (VesselIdentifierEntity vesselIdentifier : vesselIdentifiers) {
            FishingTripIdentifierEntity identifierEntity = fishingTripIdentifierDao.getCurrentTrip(vesselIdentifier.getVesselIdentifierId(), vesselIdentifier.getVesselIdentifierSchemeId());
            currentTrip = identifierEntity != null ? identifierEntity.getTripId() : null;
            break;
        }
    }
    log.info("Current Trip : " + currentTrip);
    return currentTrip;
}
Also used : VesselIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity) FishingTripIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity)

Example 12 with VesselIdentifierEntity

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

the class VesselIdentifierMapperTest method testMapToIndentifierDtoSetWithUndefinedEnum.

@Test(expected = IllegalArgumentException.class)
public void testMapToIndentifierDtoSetWithUndefinedEnum() {
    VesselIdentifierEntity entity = builder().vesselIdentifierSchemeId("UNDEFINED").build();
    INSTANCE.mapToIdentifierDotSet(asSet(entity));
}
Also used : VesselIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity) BaseUnitilsTest(eu.europa.ec.fisheries.uvms.BaseUnitilsTest) Test(org.junit.Test)

Example 13 with VesselIdentifierEntity

use of eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity 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 14 with VesselIdentifierEntity

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

the class ActivityDataUtil method getVesselIdentifiers.

public static Set<VesselIdentifierEntity> getVesselIdentifiers(VesselTransportMeansEntity vesselTransportMeansEntity1, String ident_, String scheme_) {
    Set<VesselIdentifierEntity> identifiers = new HashSet<>();
    VesselIdentifierEntity identifier = new VesselIdentifierEntity();
    identifier.setVesselTransportMeans(vesselTransportMeansEntity1);
    identifier.setVesselIdentifierId(ident_);
    identifier.setVesselIdentifierSchemeId(scheme_);
    identifiers.add(identifier);
    return identifiers;
}
Also used : VesselIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity) HashSet(java.util.HashSet)

Example 15 with VesselIdentifierEntity

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

the class FishingTripServiceBeanTest method getVesselIdentifiers.

private List<VesselIdentifierEntity> getVesselIdentifiers() {
    VesselIdentifierEntity vesselIdentifierEntity1 = new VesselIdentifierEntity();
    vesselIdentifierEntity1.setVesselIdentifierId("Vessel Id 1");
    vesselIdentifierEntity1.setVesselIdentifierSchemeId("Vessel Scheme Id 1");
    VesselIdentifierEntity vesselIdentifierEntity2 = new VesselIdentifierEntity();
    vesselIdentifierEntity2.setVesselIdentifierId("Vessel Id 2");
    List<VesselIdentifierEntity> identifierEntities = new ArrayList<>();
    identifierEntities.add(vesselIdentifierEntity1);
    identifierEntities.add(vesselIdentifierEntity2);
    return identifierEntities;
}
Also used : VesselIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity) ArrayList(java.util.ArrayList)

Aggregations

VesselIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity)15 ArrayList (java.util.ArrayList)5 FishingTripIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity)3 Test (org.junit.Test)3 VesselTransportMeansEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity)2 BaseUnitilsTest (eu.europa.ec.fisheries.uvms.BaseUnitilsTest)2 VesselIdentifierType (eu.europa.ec.fisheries.uvms.activity.model.schemas.VesselIdentifierType)2 HashSet (java.util.HashSet)2 LinkedHashSet (java.util.LinkedHashSet)2 IDType (un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)2 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)1 VesselTypeAssetQueryEnum (eu.europa.ec.fisheries.ers.fa.utils.VesselTypeAssetQueryEnum)1 AssetIdentifierDto (eu.europa.ec.fisheries.ers.service.dto.AssetIdentifierDto)1 CronologyTripDTO (eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CronologyTripDTO)1 BigInteger (java.math.BigInteger)1 HashMap (java.util.HashMap)1 VesselTransportMeans (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans)1