Search in sources :

Example 1 with ContactParty

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

the class ActivityEntityToModelMapper method mapRoles.

private void mapRoles(ContactParty target, Set<ContactPartyRoleEntity> contactPartyRoleEntities) {
    List<CodeType> codeTypeList = new ArrayList<>();
    if (CollectionUtils.isNotEmpty(contactPartyRoleEntities)) {
        for (ContactPartyRoleEntity source : contactPartyRoleEntities) {
            CodeType codeType = new CodeType();
            codeType.setValue(source.getRoleCode());
            codeType.setListID(source.getRoleCodeListId());
            codeTypeList.add(codeType);
        }
    }
    target.setRoleCodes(codeTypeList);
}
Also used : ArrayList(java.util.ArrayList) CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType) ContactPartyRoleEntity(eu.europa.ec.fisheries.ers.fa.entities.ContactPartyRoleEntity)

Example 2 with ContactParty

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

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

the class VesselTransportMeansMapper method getContactPartyEntity.

protected Set<ContactPartyEntity> getContactPartyEntity(List<ContactParty> contactParties, VesselTransportMeansEntity vesselTransportMeansEntity) {
    if (contactParties == null || contactParties.isEmpty()) {
        return Collections.emptySet();
    }
    Set<ContactPartyEntity> contactPartyEntities = new HashSet<>();
    for (ContactParty contactParty : contactParties) {
        ContactPartyEntity contactPartyEntity = ContactPartyMapper.INSTANCE.mapToContactPartyEntity(contactParty, vesselTransportMeansEntity);
        contactPartyEntity.setVesselTransportMeans(vesselTransportMeansEntity);
        contactPartyEntities.add(contactPartyEntity);
    }
    return contactPartyEntities;
}
Also used : ContactPartyEntity(eu.europa.ec.fisheries.ers.fa.entities.ContactPartyEntity) ContactParty(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.ContactParty) HashSet(java.util.HashSet)

Example 4 with ContactParty

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

the class MapperUtil method getContactParty.

public static ContactParty getContactParty() {
    ContactParty contactParty = new ContactParty();
    CodeType roleCode = getCodeType("MASTER", "FLUX_CONTACT_ ROLE");
    contactParty.setRoleCodes(Arrays.asList(roleCode));
    contactParty.setSpecifiedContactPersons(Arrays.asList(getContactPerson()));
    contactParty.setSpecifiedStructuredAddresses(Arrays.asList(getStructuredAddress()));
    return contactParty;
}
Also used : CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType) ContactParty(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.ContactParty)

Example 5 with ContactParty

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

the class MapperUtil method getVesselTransportMeans.

public static VesselTransportMeans getVesselTransportMeans() {
    VesselTransportMeans vesselTransportMeans = new VesselTransportMeans();
    CodeType roleCode = getCodeType("CATCHING_VESSEL", "FA_VESSEL_ROLE");
    List<TextType> names = Arrays.asList(getTextType("Test Name"));
    List<FLAPDocument> grantedFLAPDocuments = Arrays.asList(getFlapDocument());
    List<IDType> ids = Arrays.asList(getIdType("ID 1", "CFR"));
    List<ContactParty> specifiedContactParties = Arrays.asList(getContactParty());
    List<RegistrationEvent> specifiedRegistrationEvents = Arrays.asList(getRegistrationEvent());
    VesselCountry vesselCounty = new VesselCountry(getIdType("Country Id 1", "tu587r-5jt85-tjfur7-tjgut7"));
    vesselTransportMeans.setRoleCode(roleCode);
    vesselTransportMeans.setNames(names);
    vesselTransportMeans.setGrantedFLAPDocuments(grantedFLAPDocuments);
    vesselTransportMeans.setIDS(ids);
    vesselTransportMeans.setSpecifiedContactParties(specifiedContactParties);
    vesselTransportMeans.setSpecifiedRegistrationEvents(specifiedRegistrationEvents);
    vesselTransportMeans.setRegistrationVesselCountry(vesselCounty);
    return vesselTransportMeans;
}
Also used : VesselCountry(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselCountry) RegistrationEvent(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.RegistrationEvent) FLAPDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLAPDocument) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType) VesselTransportMeans(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans) TextType(un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType) CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType) ContactParty(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.ContactParty)

Aggregations

ContactParty (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.ContactParty)4 CodeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType)3 ContactPartyEntity (eu.europa.ec.fisheries.ers.fa.entities.ContactPartyEntity)2 ArrayList (java.util.ArrayList)2 ContactPartyRoleEntity (eu.europa.ec.fisheries.ers.fa.entities.ContactPartyRoleEntity)1 HashSet (java.util.HashSet)1 ContactPerson (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.ContactPerson)1 FLAPDocument (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLAPDocument)1 RegistrationEvent (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.RegistrationEvent)1 VesselCountry (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselCountry)1 VesselTransportMeans (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans)1 IDType (un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)1 TextType (un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType)1