Search in sources :

Example 6 with FluxReportDocumentEntity

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

the class FluxReportDocumentMapperTest method testFluxReportDocumentMapper.

@Test
public void testFluxReportDocumentMapper() {
    FLUXReportDocument fluxReportDocument = MapperUtil.getFluxReportDocument();
    FluxReportDocumentEntity entity = FluxReportDocumentMapper.INSTANCE.mapToFluxReportDocumentEntity(fluxReportDocument);
    assertEquals(fluxReportDocument.getIDS().get(0).getValue(), entity.getFluxReportIdentifiers().iterator().next().getFluxReportIdentifierId());
    assertEquals(fluxReportDocument.getIDS().get(0).getSchemeID(), entity.getFluxReportIdentifiers().iterator().next().getFluxReportIdentifierSchemeId());
    assertEquals(fluxReportDocument.getReferencedID().getValue(), entity.getReferenceId());
    assertEquals(fluxReportDocument.getCreationDateTime().getDateTime().toGregorianCalendar().getTime(), entity.getCreationDatetime());
    assertEquals(fluxReportDocument.getPurposeCode().getValue(), entity.getPurposeCode());
    assertEquals(fluxReportDocument.getPurposeCode().getListID(), entity.getPurposeCodeListId());
    assertTrue(entity.getPurpose().startsWith(fluxReportDocument.getPurpose().getValue()));
    assertEquals(fluxReportDocument.getOwnerFLUXParty().getIDS().get(0).getValue(), entity.getFluxParty().getFluxPartyIdentifiers().iterator().next().getFluxPartyIdentifierId());
    assertEquals(fluxReportDocument.getOwnerFLUXParty().getNames().get(0).getValue(), entity.getFluxParty().getFluxPartyName());
    assertNull(entity.getFaReportDocument());
}
Also used : FLUXReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXReportDocument) FluxReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity) Test(org.junit.Test)

Example 7 with FluxReportDocumentEntity

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

the class FaReportDocumentMapper method getFluxReportDocument.

protected FluxReportDocumentEntity getFluxReportDocument(FLUXReportDocument fluxReportDocument, FaReportDocumentEntity faReportDocumentEntity) {
    if (fluxReportDocument == null) {
        return null;
    }
    FluxReportDocumentEntity fluxReportDocumentEntity = FluxReportDocumentMapper.INSTANCE.mapToFluxReportDocumentEntity(fluxReportDocument);
    if (fluxReportDocument.getOwnerFLUXParty() != null) {
        FluxPartyEntity fluxPartyEntity = FluxPartyMapper.INSTANCE.mapToFluxPartyEntity(fluxReportDocument.getOwnerFLUXParty());
        fluxPartyEntity.setFluxReportDocument(fluxReportDocumentEntity);
        fluxReportDocumentEntity.setFluxParty(fluxPartyEntity);
    }
    Set<FluxReportIdentifierEntity> reportIdentifierEntitySet = new HashSet<>();
    if (CollectionUtils.isNotEmpty(fluxReportDocument.getIDS())) {
        for (IDType idType : fluxReportDocument.getIDS()) {
            FluxReportIdentifierEntity fluxReportIdentifierEntity = FluxReportIdentifierMapper.INSTANCE.mapToFluxReportIdentifierEntity(idType);
            fluxReportIdentifierEntity.setFluxReportDocument(fluxReportDocumentEntity);
            reportIdentifierEntitySet.add(fluxReportIdentifierEntity);
        }
    }
    fluxReportDocumentEntity.setFluxReportIdentifiers(reportIdentifierEntitySet);
    fluxReportDocumentEntity.setFaReportDocument(faReportDocumentEntity);
    return fluxReportDocumentEntity;
}
Also used : FluxReportIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxReportIdentifierEntity) FluxReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity) FluxPartyEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxPartyEntity) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType) HashSet(java.util.HashSet)

Example 8 with FluxReportDocumentEntity

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

the class FluxFaReportMessageMapper method getFluxReportDocument.

private FluxReportDocumentEntity getFluxReportDocument(FLUXReportDocument fluxReportDocument, FluxFaReportMessageEntity fluxFaReportMessage) {
    if (fluxReportDocument == null) {
        return null;
    }
    FluxReportDocumentEntity entity = FluxReportDocumentMapper.INSTANCE.mapToFluxReportDocumentEntity(fluxReportDocument);
    entity.setFluxFaReportMessage(fluxFaReportMessage);
    return entity;
}
Also used : FluxReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity)

Example 9 with FluxReportDocumentEntity

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

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

the class MapperUtil method getFluxReportDocumentEntity.

public static FluxReportDocumentEntity getFluxReportDocumentEntity() {
    FluxReportDocumentEntity fluxReportDocumentEntity = new FluxReportDocumentEntity();
    fluxReportDocumentEntity.setCreationDatetime(new Date());
    fluxReportDocumentEntity.setFluxReportIdentifiers(new HashSet<FluxReportIdentifierEntity>(Arrays.asList(getFluxReportIdentifierEntity())));
    fluxReportDocumentEntity.setFluxParty(getFluxPartyEntity());
    fluxReportDocumentEntity.setPurpose("Test purpose");
    fluxReportDocumentEntity.setPurposeCode("5");
    fluxReportDocumentEntity.setPurposeCodeListId("57thf-58fj88-4d9834-thdue");
    fluxReportDocumentEntity.setReferenceId("Ref Id 1");
    return fluxReportDocumentEntity;
}
Also used : FluxReportIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxReportIdentifierEntity) FluxReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity) Date(java.util.Date)

Aggregations

FluxReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity)10 FaReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)5 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)3 FluxReportIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportIdentifierEntity)3 VesselTransportMeansEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity)3 ArrayList (java.util.ArrayList)3 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)2 FishingTripEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)2 FluxPartyEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxPartyEntity)2 SizeDistributionEntity (eu.europa.ec.fisheries.ers.fa.entities.SizeDistributionEntity)2 Date (java.util.Date)2 HashSet (java.util.HashSet)2 Test (org.junit.Test)2 Geometry (com.vividsolutions.jts.geom.Geometry)1 ParseException (com.vividsolutions.jts.io.ParseException)1 FaReportIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportIdentifierEntity)1 FishingTripIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity)1 FluxFaReportMessageEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxFaReportMessageEntity)1 FluxPartyIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxPartyIdentifierEntity)1 InputStream (java.io.InputStream)1