Search in sources :

Example 1 with ContactPerson

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

the class MapperUtil method getContactPerson.

public static ContactPerson getContactPerson() {
    TextType title = getTextType("MR");
    TextType givenName = getTextType("Test Name");
    TextType middleName = getTextType("Test Middle Name");
    TextType familyNamePrefix = getTextType("Test Prefix");
    TextType familyName = getTextType("Test Family Name");
    TextType nameSuffix = getTextType("Test Suffix");
    CodeType genderCode = getCodeType("Gender", "4ryf65-fhtfyd-thfey45-tu5r7ght");
    TextType alias = getTextType("Test Alias");
    // ContactPerson contactPerson = new ContactPerson();
    ContactPerson contactPerson = new ContactPerson(title, givenName, middleName, familyNamePrefix, familyName, nameSuffix, genderCode, alias, null, null, null, null, null, null, null);
    return contactPerson;
}
Also used : CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType) ContactPerson(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.ContactPerson) TextType(un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType)

Example 2 with ContactPerson

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

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

the class ContactPersonMapperTest method testContactPersonMapper.

@Test
public void testContactPersonMapper() {
    ContactPerson contactPerson = MapperUtil.getContactPerson();
    ContactPersonEntity contactPersonEntity = ContactPersonMapper.INSTANCE.mapToContactPersonEntity(contactPerson);
    assertEquals(contactPerson.getAlias().getValue(), contactPersonEntity.getAlias());
    assertEquals(contactPerson.getFamilyName().getValue(), contactPersonEntity.getFamilyName());
    assertEquals(contactPerson.getFamilyNamePrefix().getValue(), contactPersonEntity.getFamilyNamePrefix());
    assertEquals(contactPerson.getGenderCode().getValue(), contactPersonEntity.getGender());
    assertEquals(contactPerson.getGivenName().getValue(), contactPersonEntity.getGivenName());
    assertEquals(contactPerson.getMiddleName().getValue(), contactPersonEntity.getMiddleName());
    assertEquals(contactPerson.getNameSuffix().getValue(), contactPersonEntity.getNameSuffix());
    assertEquals(contactPerson.getTitle().getValue(), contactPersonEntity.getTitle());
    assertNull(contactPersonEntity.getContactParty());
}
Also used : ContactPersonEntity(eu.europa.ec.fisheries.ers.fa.entities.ContactPersonEntity) ContactPerson(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.ContactPerson) Test(org.junit.Test)

Example 4 with ContactPerson

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

the class ContactPersonMapperTest method testContactPersonDetailsDTOMapper.

@Test
public void testContactPersonDetailsDTOMapper() {
    ContactPerson contactPerson = MapperUtil.getContactPerson();
    ContactPersonEntity contactPersonEntity = ContactPersonMapper.INSTANCE.mapToContactPersonEntity(contactPerson);
    ContactPersonDetailsDTO contactPersonDetailsDTO = ContactPersonMapper.INSTANCE.mapToContactPersonDetailsDTO(contactPersonEntity);
    assertEquals(contactPersonEntity.getAlias(), contactPersonDetailsDTO.getAlias());
    assertEquals(contactPersonEntity.getFamilyName(), contactPersonDetailsDTO.getFamilyName());
    assertEquals(contactPersonEntity.getFamilyNamePrefix(), contactPersonDetailsDTO.getFamilyNamePrefix());
    assertEquals(contactPersonEntity.getGender(), contactPersonDetailsDTO.getGender());
    assertEquals(contactPersonEntity.getGivenName(), contactPersonDetailsDTO.getGivenName());
    assertEquals(contactPersonEntity.getMiddleName(), contactPersonDetailsDTO.getMiddleName());
    assertEquals(contactPersonEntity.getNameSuffix(), contactPersonDetailsDTO.getNameSuffix());
    assertEquals(contactPersonEntity.getTitle(), contactPersonDetailsDTO.getTitle());
}
Also used : ContactPersonEntity(eu.europa.ec.fisheries.ers.fa.entities.ContactPersonEntity) ContactPersonDetailsDTO(eu.europa.ec.fisheries.ers.service.dto.fareport.details.ContactPersonDetailsDTO) ContactPerson(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.ContactPerson) Test(org.junit.Test)

Aggregations

ContactPerson (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.ContactPerson)4 ContactPersonEntity (eu.europa.ec.fisheries.ers.fa.entities.ContactPersonEntity)2 Test (org.junit.Test)2 ContactPartyEntity (eu.europa.ec.fisheries.ers.fa.entities.ContactPartyEntity)1 ContactPersonDetailsDTO (eu.europa.ec.fisheries.ers.service.dto.fareport.details.ContactPersonDetailsDTO)1 ArrayList (java.util.ArrayList)1 ContactParty (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.ContactParty)1 CodeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType)1 TextType (un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType)1