use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEntityToModelMapper method mapSpecifiedVesselTransportMeans.
private void mapSpecifiedVesselTransportMeans(FAReportDocument target, Set<VesselTransportMeansEntity> entities) {
if (CollectionUtils.isNotEmpty(entities) && target != null) {
VesselTransportMeans vesselTransportMeans = new VesselTransportMeans();
VesselTransportMeansEntity source = entities.iterator().next();
setRoleCode(vesselTransportMeans, source.getRoleCodeListId(), source.getRoleCode());
mapNames(vesselTransportMeans, source.getName());
mapRegistrationVesselCountry(vesselTransportMeans, source.getCountry(), source.getCountrySchemeId());
mapRegistrationEvent(vesselTransportMeans, source.getRegistrationEvent());
mapIDs(vesselTransportMeans, source.getVesselIdentifiers());
mapSpecifiedContactParties(vesselTransportMeans, source.getContactParty());
vesselTransportMeans.setGrantedFLAPDocuments(FlapDocumentMapper.INSTANCE.mapToFlapDocumentList(source.getFlapDocuments()));
target.setSpecifiedVesselTransportMeans(vesselTransportMeans);
}
}
use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument in project UVMS-ActivityModule-APP by UnionVMS.
the class FluxFaReportMessageMapper method getFaReportDocuments.
private Set<FaReportDocumentEntity> getFaReportDocuments(List<FAReportDocument> faReportDocuments, FaReportSourceEnum faReportSourceEnum, FluxFaReportMessageEntity fluxFaReportMessage) {
Set<FaReportDocumentEntity> faReportDocumentEntities = new HashSet<>();
for (FAReportDocument faReportDocument : faReportDocuments) {
FaReportDocumentEntity entity = FaReportDocumentMapper.INSTANCE.mapToFAReportDocumentEntity(faReportDocument, faReportSourceEnum);
entity.setFluxFaReportMessage(fluxFaReportMessage);
faReportDocumentEntities.add(entity);
}
return faReportDocumentEntities;
}
use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEventServiceBean method collectAllIdsFromMessage.
private Map<ActivityTableType, List<IDType>> collectAllIdsFromMessage(FLUXFAReportMessage faRepMessage) {
Map<ActivityTableType, List<IDType>> idsmap = new EnumMap<>(ActivityTableType.class);
idsmap.put(ActivityTableType.RELATED_FLUX_REPORT_DOCUMENT_ENTITY, new ArrayList<IDType>());
if (faRepMessage == null) {
return idsmap;
}
List<FAReportDocument> faReportDocuments = faRepMessage.getFAReportDocuments();
if (CollectionUtils.isNotEmpty(faReportDocuments)) {
for (FAReportDocument faRepDoc : faReportDocuments) {
FLUXReportDocument relatedFLUXReportDocument = faRepDoc.getRelatedFLUXReportDocument();
if (relatedFLUXReportDocument != null) {
List<IDType> idTypes = new ArrayList<>();
idTypes.addAll(relatedFLUXReportDocument.getIDS());
idTypes.add(relatedFLUXReportDocument.getReferencedID());
idTypes.removeAll(Collections.singletonList(null));
idsmap.get(ActivityTableType.RELATED_FLUX_REPORT_DOCUMENT_ENTITY).addAll(idTypes);
}
}
}
return idsmap;
}
use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument 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());
}
use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument in project UVMS-ActivityModule-APP by UnionVMS.
the class MapperUtil method getFaReportDocument.
public static FAReportDocument getFaReportDocument() {
CodeType typeCode = getCodeType("DECLARATION", "FLUX_FA_REPORT_TYPE");
CodeType fmcMarkerCode = getCodeType("Fmz marker 1", "h49rh-fhrus33-fj84hjs82-4h84hw82");
List<IDType> relatedReportIDs = Arrays.asList(getIdType("ID 1", "47rfh-5hry4-thfur75-4hf743"));
DateTimeType acceptanceDateTime = getDateTimeType("2016-07-01 11:15:00");
FLUXReportDocument relatedFLUXReportDocument = getFluxReportDocument();
List<FishingActivity> specifiedFishingActivities = Arrays.asList(getFishingActivity());
VesselTransportMeans specifiedVesselTransportMeans = getVesselTransportMeans();
FAReportDocument faReportDocument = new FAReportDocument(typeCode, fmcMarkerCode, relatedReportIDs, acceptanceDateTime, relatedFLUXReportDocument, specifiedFishingActivities, specifiedVesselTransportMeans);
return faReportDocument;
}
Aggregations