Search in sources :

Example 11 with FAReportDocument

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);
    }
}
Also used : VesselTransportMeansEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity) VesselTransportMeans(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans)

Example 12 with FAReportDocument

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;
}
Also used : FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) FAReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument) HashSet(java.util.HashSet)

Example 13 with FAReportDocument

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;
}
Also used : FLUXReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXReportDocument) ArrayList(java.util.ArrayList) ActivityTableType(eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityTableType) ActivityUniquinessList(eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityUniquinessList) List(java.util.List) ArrayList(java.util.ArrayList) EnumMap(java.util.EnumMap) ActivityIDType(eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityIDType) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType) FAReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument)

Example 14 with FAReportDocument

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());
}
Also used : FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) FaReportIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportIdentifierEntity) FAReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) Test(org.junit.Test)

Example 15 with FAReportDocument

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;
}
Also used : FLUXReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXReportDocument) FishingActivity(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity) DateTimeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType) CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType) FAReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument) VesselTransportMeans(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans)

Aggregations

FAReportDocument (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument)9 ArrayList (java.util.ArrayList)5 FaReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)4 IDType (un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)4 FLUXReportDocument (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXReportDocument)3 CodeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType)3 FaReportIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportIdentifierEntity)2 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)2 ActivityUniquinessList (eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityUniquinessList)2 FishingActivity (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity)2 VesselTransportMeans (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans)2 DateTimeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType)2 VesselTransportMeansEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity)1 FaReportStatusType (eu.europa.ec.fisheries.ers.fa.utils.FaReportStatusType)1 ActivityModelMarshallException (eu.europa.ec.fisheries.uvms.activity.model.exception.ActivityModelMarshallException)1 ActivityIDType (eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityIDType)1 ActivityTableType (eu.europa.ec.fisheries.uvms.activity.model.schemas.ActivityTableType)1 GetNonUniqueIdsRequest (eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsRequest)1 GetNonUniqueIdsResponse (eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsResponse)1 EnumMap (java.util.EnumMap)1