Search in sources :

Example 1 with ContactPersonEntity

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

the class ActivityDataUtil method getContactPartyEntity.

public static ContactPartyEntity getContactPartyEntity(String title, String givenName, String middleName, String familyName, String familyNamePrefix, String nameSuffix, String gender, String alias) {
    ContactPartyEntity contPartEntity = new ContactPartyEntity();
    ContactPersonEntity contactPersonEntity = new ContactPersonEntity();
    contactPersonEntity.setTitle(title);
    contactPersonEntity.setGivenName(givenName);
    contactPersonEntity.setMiddleName(middleName);
    contactPersonEntity.setFamilyName(familyName);
    contactPersonEntity.setFamilyNamePrefix(familyNamePrefix);
    contactPersonEntity.setNameSuffix(nameSuffix);
    contactPersonEntity.setGender(gender);
    contactPersonEntity.setAlias(alias);
    contPartEntity.setContactPerson(contactPersonEntity);
    return contPartEntity;
}
Also used : ContactPersonEntity(eu.europa.ec.fisheries.ers.fa.entities.ContactPersonEntity) ContactPartyEntity(eu.europa.ec.fisheries.ers.fa.entities.ContactPartyEntity)

Example 2 with ContactPersonEntity

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

the class ContactPartyMapper method getContactPersonEntity.

protected ContactPersonEntity getContactPersonEntity(List<ContactPerson> contactPersons, ContactPartyEntity contactPartyEntity) {
    if (CollectionUtils.isEmpty(contactPersons)) {
        return null;
    }
    ContactPersonEntity contactPersonEntity = ContactPersonMapper.INSTANCE.mapToContactPersonEntity(contactPersons.get(0));
    contactPersonEntity.setContactParty(contactPartyEntity);
    return contactPersonEntity;
}
Also used : ContactPersonEntity(eu.europa.ec.fisheries.ers.fa.entities.ContactPersonEntity)

Example 3 with ContactPersonEntity

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

the class ContactPartyMapperTest method testContactPartyMapperNullReturns.

@Test
public void testContactPartyMapperNullReturns() {
    Set<ContactPartyRoleEntity> contactPartyRoles = ContactPartyMapper.INSTANCE.getContactPartyRoles(null, new ContactPartyEntity());
    assertTrue(contactPartyRoles.size() == 0);
    ContactPersonEntity contactPersonEntity = ContactPartyMapper.INSTANCE.getContactPersonEntity(null, new ContactPartyEntity());
    assertNull(contactPersonEntity);
    Set<StructuredAddressEntity> structuredAddressEntity = ContactPartyMapper.INSTANCE.getStructuredAddressEntity(null, new ContactPartyEntity());
    assertTrue(structuredAddressEntity.size() == 0);
}
Also used : ContactPersonEntity(eu.europa.ec.fisheries.ers.fa.entities.ContactPersonEntity) StructuredAddressEntity(eu.europa.ec.fisheries.ers.fa.entities.StructuredAddressEntity) ContactPartyRoleEntity(eu.europa.ec.fisheries.ers.fa.entities.ContactPartyRoleEntity) ContactPartyEntity(eu.europa.ec.fisheries.ers.fa.entities.ContactPartyEntity) Test(org.junit.Test)

Example 4 with ContactPersonEntity

use of eu.europa.ec.fisheries.ers.fa.entities.ContactPersonEntity 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 5 with ContactPersonEntity

use of eu.europa.ec.fisheries.ers.fa.entities.ContactPersonEntity 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

ContactPersonEntity (eu.europa.ec.fisheries.ers.fa.entities.ContactPersonEntity)5 Test (org.junit.Test)3 ContactPartyEntity (eu.europa.ec.fisheries.ers.fa.entities.ContactPartyEntity)2 ContactPerson (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.ContactPerson)2 ContactPartyRoleEntity (eu.europa.ec.fisheries.ers.fa.entities.ContactPartyRoleEntity)1 StructuredAddressEntity (eu.europa.ec.fisheries.ers.fa.entities.StructuredAddressEntity)1 ContactPersonDetailsDTO (eu.europa.ec.fisheries.ers.service.dto.fareport.details.ContactPersonDetailsDTO)1