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());
}
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;
}
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;
}
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;
}
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;
}
Aggregations