Search in sources :

Example 1 with StructuredAddressEntity

use of eu.europa.ec.fisheries.ers.fa.entities.StructuredAddressEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class FaCatchMapper method getFluxLocationEntities.

protected Set<FluxLocationEntity> getFluxLocationEntities(List<FLUXLocation> specifiedFluxLocations, List<FLUXLocation> destFluxLocations, FaCatchEntity faCatchEntity) {
    Set<FluxLocationEntity> fluxLocationEntities = new HashSet<>();
    if (specifiedFluxLocations != null && !specifiedFluxLocations.isEmpty()) {
        for (FLUXLocation fluxLocation : specifiedFluxLocations) {
            FluxLocationEntity fluxLocationEntity = FluxLocationMapper.INSTANCE.mapToFluxLocationEntity(fluxLocation);
            Set<StructuredAddressEntity> structuredAddressEntitySet = new HashSet<>();
            StructuredAddress physicalStructuredAddress = fluxLocation.getPhysicalStructuredAddress();
            StructuredAddressEntity physicalStructuredAddressEntity = StructuredAddressMapper.INSTANCE.mapToStructuredAddressEntity(physicalStructuredAddress);
            if (physicalStructuredAddressEntity != null) {
                physicalStructuredAddressEntity.setFluxLocation(fluxLocationEntity);
                physicalStructuredAddressEntity.setStructuredAddressType(StructuredAddressTypeEnum.FLUX_PHYSICAL.getType());
                structuredAddressEntitySet.add(physicalStructuredAddressEntity);
            }
            List<StructuredAddress> postalStructuredAddresses = fluxLocation.getPostalStructuredAddresses();
            if (postalStructuredAddresses != null && !postalStructuredAddresses.isEmpty()) {
                for (StructuredAddress structuredAddress : postalStructuredAddresses) {
                    StructuredAddressEntity structuredAddressEntity = StructuredAddressMapper.INSTANCE.mapToStructuredAddressEntity(structuredAddress);
                    if (structuredAddressEntity != null) {
                        structuredAddressEntity.setStructuredAddressType(StructuredAddressTypeEnum.FLUX_POSTAL.getType());
                        structuredAddressEntity.setFluxLocation(fluxLocationEntity);
                        structuredAddressEntitySet.add(structuredAddressEntity);
                    }
                }
            }
            fluxLocationEntity.setStructuredAddresses(structuredAddressEntitySet);
            fluxLocationEntity.setFaCatch(faCatchEntity);
            fluxLocationEntity.setFluxLocationType(FluxLocationCatchTypeEnum.FA_CATCH_SPECIFIED.getType());
            fluxLocationEntities.add(fluxLocationEntity);
        }
    }
    if (destFluxLocations != null && !destFluxLocations.isEmpty()) {
        for (FLUXLocation fluxLocation : destFluxLocations) {
            FluxLocationEntity fluxLocationEntity = FluxLocationMapper.INSTANCE.mapToFluxLocationEntity(fluxLocation);
            fluxLocationEntity.setFaCatch(faCatchEntity);
            fluxLocationEntity.setFluxLocationType(FluxLocationCatchTypeEnum.FA_CATCH_DESTINATION.getType());
            fluxLocationEntities.add(fluxLocationEntity);
        }
    }
    return fluxLocationEntities;
}
Also used : StructuredAddressEntity(eu.europa.ec.fisheries.ers.fa.entities.StructuredAddressEntity) FLUXLocation(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXLocation) StructuredAddress(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.StructuredAddress) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) HashSet(java.util.HashSet)

Example 2 with StructuredAddressEntity

use of eu.europa.ec.fisheries.ers.fa.entities.StructuredAddressEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class ContactPartyMapper method getStructuredAddressEntity.

protected Set<StructuredAddressEntity> getStructuredAddressEntity(List<StructuredAddress> structuredAddresses, ContactPartyEntity contactPartyEntity) {
    if (CollectionUtils.isEmpty(structuredAddresses)) {
        return Collections.emptySet();
    }
    Set<StructuredAddressEntity> structuredAddressEntities = new HashSet<>();
    for (StructuredAddress structuredAddress : structuredAddresses) {
        StructuredAddressEntity structuredAddressEntity = StructuredAddressMapper.INSTANCE.mapToStructuredAddressEntity(structuredAddress);
        structuredAddressEntity.setStructuredAddressType(StructuredAddressTypeEnum.CONTACT_PARTY_SPECIFIED.getType());
        structuredAddressEntity.setContactParty(contactPartyEntity);
        structuredAddressEntities.add(structuredAddressEntity);
    }
    return structuredAddressEntities;
}
Also used : StructuredAddressEntity(eu.europa.ec.fisheries.ers.fa.entities.StructuredAddressEntity) StructuredAddress(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.StructuredAddress) HashSet(java.util.HashSet)

Aggregations

StructuredAddressEntity (eu.europa.ec.fisheries.ers.fa.entities.StructuredAddressEntity)2 HashSet (java.util.HashSet)2 StructuredAddress (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.StructuredAddress)2 FluxLocationEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)1 FLUXLocation (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXLocation)1