use of eu.europa.ec.fisheries.ers.fa.entities.FaReportIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class MapperUtil method getFaReportDocumentEntity.
public static FaReportDocumentEntity getFaReportDocumentEntity() {
FaReportDocumentEntity faReportDocumentEntity = new FaReportDocumentEntity();
faReportDocumentEntity.setStatus(FaReportStatusType.UPDATED.getStatus());
faReportDocumentEntity.setTypeCode("FISHING_OPERATION");
faReportDocumentEntity.setTypeCodeListId("FLUX_FA_REPORT_TYPE");
faReportDocumentEntity.setAcceptedDatetime(new Date());
faReportDocumentEntity.setFmcMarker("FMC Marker");
faReportDocumentEntity.setFmcMarkerListId("FMC Marker list Id");
Geometry geometry = null;
try {
geometry = wktReader.read("MULTIPOINT ((-10 40), (-40 30), (-20 20), (-30 10))");
} catch (ParseException e) {
e.printStackTrace();
}
faReportDocumentEntity.setGeom(geometry);
FaReportIdentifierEntity faReportIdentifierEntity = new FaReportIdentifierEntity();
faReportIdentifierEntity.setFaReportIdentifierId("Identifier Id 1");
faReportIdentifierEntity.setFaReportIdentifierSchemeId("57th785-tjf845-tjfui5-tjfuir8");
faReportIdentifierEntity.setFaReportDocument(faReportDocumentEntity);
faReportDocumentEntity.setFaReportIdentifiers(new HashSet<>(Collections.singletonList(faReportIdentifierEntity)));
FluxReportDocumentEntity fluxReportDocumentEntity = getFluxReportDocumentEntity();
fluxReportDocumentEntity.setFaReportDocument(faReportDocumentEntity);
faReportDocumentEntity.setFluxReportDocument(fluxReportDocumentEntity);
return faReportDocumentEntity;
}
use of eu.europa.ec.fisheries.ers.fa.entities.FaReportIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FaReportDocumentMapperTest method testFaReportDocumentMapperNullReturns.
@Test
public void testFaReportDocumentMapperNullReturns() {
Set<FishingActivityEntity> fishingActivityEntities = FaReportDocumentMapper.INSTANCE.getFishingActivityEntities(null, new FaReportDocumentEntity());
assertTrue(fishingActivityEntities.size() == 0);
Set<VesselTransportMeansEntity> vesselTransportMeansEntityList = FaReportDocumentMapper.INSTANCE.getVesselTransportMeansEntity(null, new FaReportDocumentEntity());
assertNull(vesselTransportMeansEntityList);
Set<FishingActivityEntity> fishingActivityEntities1 = FaReportDocumentMapper.INSTANCE.getFishingActivityEntities(null, new FaReportDocumentEntity());
assertTrue(fishingActivityEntities1.size() == 0);
Set<FaReportIdentifierEntity> faReportIdentifierEntities = FaReportDocumentMapper.INSTANCE.mapToFAReportIdentifierEntities(null, new FaReportDocumentEntity());
assertTrue(faReportIdentifierEntities.size() == 0);
}
use of eu.europa.ec.fisheries.ers.fa.entities.FaReportIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEntityToModelMapper method mapRelatedReportIDs.
private void mapRelatedReportIDs(FAReportDocument target, Set<FaReportIdentifierEntity> faReportIdentifiers) {
if (CollectionUtils.isNotEmpty(faReportIdentifiers)) {
List<IDType> idTypeList = new ArrayList<>();
for (FaReportIdentifierEntity source : faReportIdentifiers) {
IDType idType = new IDType();
String faReportIdentifierId = source.getFaReportIdentifierId();
String faReportIdentifierSchemeId = source.getFaReportIdentifierSchemeId();
idType.setSchemeID(faReportIdentifierSchemeId);
idType.setValue(faReportIdentifierId);
idTypeList.add(idType);
}
target.setRelatedReportIDs(idTypeList);
}
}
use of eu.europa.ec.fisheries.ers.fa.entities.FaReportIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FaReportDocumentMapper method mapToFAReportIdentifierEntities.
protected Set<FaReportIdentifierEntity> mapToFAReportIdentifierEntities(List<IDType> idTypes, FaReportDocumentEntity faReportDocumentEntity) {
if (CollectionUtils.isEmpty(idTypes)) {
return Collections.emptySet();
}
Set<FaReportIdentifierEntity> faReportIdentifierEntities = new HashSet<>();
for (IDType idType : idTypes) {
FaReportIdentifierEntity faReportIdentifierEntity = FaReportDocumentMapper.INSTANCE.mapToFAReportIdentifierEntity(idType);
faReportIdentifierEntity.setFaReportDocument(faReportDocumentEntity);
faReportIdentifierEntities.add(faReportIdentifierEntity);
}
return faReportIdentifierEntities;
}
use of eu.europa.ec.fisheries.ers.fa.entities.FaReportIdentifierEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FaReportDocumentMapperTest method testFaReportDocumentMapper.
@Test
public void testFaReportDocumentMapper() {
FAReportDocument faReportDocument = MapperUtil.getFaReportDocument();
FaReportDocumentEntity faReportDocumentEntity = FaReportDocumentMapper.INSTANCE.mapToFAReportDocumentEntity(faReportDocument, FaReportSourceEnum.FLUX);
assertFaReportDocumentFields(faReportDocument, faReportDocumentEntity);
assertNotNull(faReportDocumentEntity.getFaReportIdentifiers());
FaReportIdentifierEntity faReportIdentifierEntity = faReportDocumentEntity.getFaReportIdentifiers().iterator().next();
assertNotNull(faReportDocumentEntity);
assertEquals(faReportDocument.getRelatedReportIDs().get(0).getValue(), faReportIdentifierEntity.getFaReportIdentifierId());
assertEquals(faReportDocument.getRelatedReportIDs().get(0).getSchemeID(), faReportIdentifierEntity.getFaReportIdentifierSchemeId());
assertFaReportDocumentFields(faReportDocument, faReportIdentifierEntity.getFaReportDocument());
assertNotNull(faReportDocumentEntity.getFishingActivities());
FishingActivityEntity fishingActivityEntity = faReportDocumentEntity.getFishingActivities().iterator().next();
assertNotNull(fishingActivityEntity);
assertFaReportDocumentFields(faReportDocument, fishingActivityEntity.getFaReportDocument());
assertNotNull(faReportDocumentEntity.getFluxReportDocument());
assertFaReportDocumentFields(faReportDocument, faReportDocumentEntity.getFluxReportDocument().getFaReportDocument());
assertNotNull(faReportDocumentEntity.getVesselTransportMeans());
}
Aggregations