Search in sources :

Example 6 with VesselTransportMeans

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityEntityToModelMapper method mapIDs.

private void mapIDs(VesselTransportMeans vesselTransportMeans, Set<VesselIdentifierEntity> vesselIdentifiers) {
    if (CollectionUtils.isNotEmpty(vesselIdentifiers)) {
        List<IDType> idTypeList = new ArrayList<>();
        for (VesselIdentifierEntity vesselIdentifierEntity : vesselIdentifiers) {
            IDType idType = new IDType();
            idType.setValue(vesselIdentifierEntity.getVesselIdentifierId());
            idType.setSchemeID(vesselIdentifierEntity.getVesselIdentifierSchemeId());
            idTypeList.add(idType);
        }
        vesselTransportMeans.setIDS(idTypeList);
    }
}
Also used : VesselIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity) ArrayList(java.util.ArrayList) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)

Example 7 with VesselTransportMeans

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans 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 8 with VesselTransportMeans

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityEntityToModelMapper method mapSpecifiedContactParties.

private void mapSpecifiedContactParties(VesselTransportMeans target, Set<ContactPartyEntity> contactPartyEntities) {
    ArrayList<ContactParty> contactParties = new ArrayList<>();
    if (CollectionUtils.isNotEmpty(contactPartyEntities)) {
        for (ContactPartyEntity source : contactPartyEntities) {
            ContactParty contactParty = new ContactParty();
            ContactPerson contactPerson = ContactPersonMapper.INSTANCE.mapToContactPerson(source.getContactPerson());
            if (contactPerson != null) {
                // TODO @Greg mapstruct add non-iterable type
                contactParty.setSpecifiedContactPersons(Collections.singletonList(contactPerson));
            }
            mapRoles(contactParty, source.getContactPartyRole());
            contactParty.setSpecifiedStructuredAddresses(StructuredAddressMapper.INSTANCE.mapToStructuredAddressList(source.getStructuredAddresses()));
            contactParties.add(contactParty);
        }
    }
    target.setSpecifiedContactParties(contactParties);
}
Also used : ArrayList(java.util.ArrayList) ContactParty(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.ContactParty) ContactPartyEntity(eu.europa.ec.fisheries.ers.fa.entities.ContactPartyEntity) ContactPerson(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.ContactPerson)

Example 9 with VesselTransportMeans

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingActivityMapper method getVesselTransportMeansEntity.

protected Set<VesselTransportMeansEntity> getVesselTransportMeansEntity(FishingActivity fishingActivity, FaReportDocumentEntity faReportDocumentEntity, FishingActivityEntity fishingActivityEntity) {
    List<VesselTransportMeans> vesselList = fishingActivity.getRelatedVesselTransportMeans();
    if (vesselList == null || vesselList.isEmpty()) {
        return null;
    }
    Set<VesselTransportMeansEntity> vesselTransportMeansEntities = new HashSet<>();
    for (VesselTransportMeans vesselTransportMeans : vesselList) {
        VesselTransportMeansEntity vesselTransportMeansEntity = VesselTransportMeansMapper.INSTANCE.mapToVesselTransportMeansEntity(vesselTransportMeans);
        vesselTransportMeansEntity.setFaReportDocument(faReportDocumentEntity);
        vesselTransportMeansEntity.setFishingActivity(fishingActivityEntity);
        vesselTransportMeansEntities.add(vesselTransportMeansEntity);
    }
    return vesselTransportMeansEntities;
}
Also used : VesselTransportMeansEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity) VesselTransportMeans(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans) HashSet(java.util.HashSet)

Example 10 with VesselTransportMeans

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingActivityMapper method getFlagState.

protected String getFlagState(FishingActivity fishingActivity) {
    List<VesselTransportMeans> vesselList = fishingActivity.getRelatedVesselTransportMeans();
    if (CollectionUtils.isEmpty(vesselList)) {
        return null;
    }
    VesselTransportMeans vesselTransportMeans = vesselList.get(0);
    if (vesselTransportMeans == null)
        return null;
    return getCountry(vesselTransportMeans.getRegistrationVesselCountry());
}
Also used : VesselTransportMeans(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans)

Aggregations

VesselTransportMeans (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans)7 IDType (un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)5 CodeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType)4 VesselTransportMeansEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity)3 VesselIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity)2 ArrayList (java.util.ArrayList)2 ContactParty (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.ContactParty)2 FLAPDocument (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLAPDocument)2 FishingActivity (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity)2 RegistrationEvent (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.RegistrationEvent)2 VesselCountry (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselCountry)2 DateTimeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType)2 TextType (un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType)2 ContactPartyEntity (eu.europa.ec.fisheries.ers.fa.entities.ContactPartyEntity)1 HashSet (java.util.HashSet)1 Test (org.junit.Test)1 ContactPerson (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.ContactPerson)1 DelimitedPeriod (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.DelimitedPeriod)1 FACatch (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch)1 FAReportDocument (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument)1