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;
}
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;
}
Aggregations