Examples of PersonWithHistoryDTO


Examples of com.inspiresoftware.lib.dto.geda.benchmark.dto.PersonWithHistoryDTO

public class ManualListMapper implements Mapper {

    public Object fromEntity(final Object entity) {

        final Person person = (Person) entity;
        final PersonWithHistoryDTO dto = new PersonWithHistoryDTO();
        if (person.getPreviousAddresses() != null) {
            dto.setPreviousAddresses(new ArrayList<AddressDTO>());
            for (final Address address : person.getPreviousAddresses()) {
                dto.getPreviousAddresses().add(fromAddress(address));
            }
        }
        if (person.getName() != null) {
            dto.setFirstName(person.getName().getFirstname());
            dto.setLastName(person.getName().getSurname());
        }
        if (person.getCurrentAddress() != null) {
            final Address address = person.getCurrentAddress();
            final AddressDTO addressDTO = fromAddress(address);
            dto.setCurrentAddress(addressDTO);
        }
        dto.setId(person.getId());
        return dto;
    }
View Full Code Here

Examples of com.inspiresoftware.lib.dto.geda.benchmark.dto.PersonWithHistoryDTO

    }

    public Object fromDto(final Object dto) {

        final Person person = new Person();
        final PersonWithHistoryDTO personDTO = (PersonWithHistoryDTO) dto;

        person.setName(new Name(personDTO.getFirstName(), personDTO.getLastName()));

        if (personDTO.getCurrentAddress() != null) {
            final AddressDTO addressDTO = personDTO.getCurrentAddress();
            final Address address = fromAddressDTO(addressDTO);

            person.setCurrentAddress(address);
        }
        person.setPreviousAddresses(new ArrayList<Address>());
        for (final AddressDTO addressDTO : personDTO.getPreviousAddresses()) {
            person.getPreviousAddresses().add(fromAddressDTO(addressDTO));
        }
        person.setId(personDTO.getId());
        return person;
    }
View Full Code Here

Examples of com.inspiresoftware.lib.dto.geda.benchmark.dto.PersonWithHistoryDTO

        assertEquals(entity, fromDto);
        assertNotNull(fromDto.getPreviousAddresses());
        assertEquals(2, fromDto.getPreviousAddresses().size());
        assertEquals(entity.getPreviousAddresses().get(0), fromDto.getPreviousAddresses().get(0));

        final PersonWithHistoryDTO fromEntity = (PersonWithHistoryDTO) mapper.fromEntity(entity);
        assertEquals(dto, fromEntity);
        assertNotNull(fromEntity.getPreviousAddresses());
        assertEquals(2, fromEntity.getPreviousAddresses().size());
        assertEquals(((PersonWithHistoryDTO) dto).getPreviousAddresses().get(0), fromEntity.getPreviousAddresses().get(0));


    }
View Full Code Here

Examples of com.inspiresoftware.lib.dto.geda.benchmark.dto.PersonWithHistoryDTO

        assertEquals(entity, fromDto);
        assertNotNull(fromDto.getPreviousAddresses());
        assertEquals(2, fromDto.getPreviousAddresses().size());
        assertEquals(entity.getPreviousAddresses().get(0), fromDto.getPreviousAddresses().get(0));

        final PersonWithHistoryDTO fromEntity = (PersonWithHistoryDTO) mapper.fromEntity(entity);
        assertEquals(dto, fromEntity);
        assertNotNull(fromEntity.getPreviousAddresses());
        assertEquals(2, fromEntity.getPreviousAddresses().size());
        assertEquals(((PersonWithHistoryDTO) dto).getPreviousAddresses().get(0), fromEntity.getPreviousAddresses().get(0));

    }
View Full Code Here

Examples of com.inspiresoftware.lib.dto.geda.benchmark.dto.PersonWithHistoryDTO

        final PersonDTO dto;
        if (withHistory) {
            if (historyByCity) {
                dto = new PersonWithHistoryByCityDTO();
            } else {
                dto = new PersonWithHistoryDTO();
            }
        } else {
            dto = new PersonDTO();
        }
View Full Code Here

Examples of com.inspiresoftware.lib.dto.geda.benchmark.dto.PersonWithHistoryDTO

        assertEquals(entity, fromDto);
        assertNotNull(fromDto.getPreviousAddresses());
        assertEquals(2, fromDto.getPreviousAddresses().size());
        assertEquals(entity.getPreviousAddresses().get(0), fromDto.getPreviousAddresses().get(0));

        final PersonWithHistoryDTO fromEntity = (PersonWithHistoryDTO) mapper.fromEntity(entity);
        assertEquals(dto, fromEntity);
        assertNotNull(fromEntity.getPreviousAddresses());
        assertEquals(2, fromEntity.getPreviousAddresses().size());
        assertEquals(((PersonWithHistoryDTO) dto).getPreviousAddresses().get(0), fromEntity.getPreviousAddresses().get(0));

    }
View Full Code Here

Examples of com.inspiresoftware.lib.dto.geda.benchmark.dto.PersonWithHistoryDTO

    public GeDAListMapper() {
        asm = DTOAssembler.newAssembler(PersonWithHistoryDTO.class, Person.class, this.getClass().getClassLoader());
    }

    public Object fromEntity(final Object entity) {
        final PersonDTO person = new PersonWithHistoryDTO();
        asm.assembleDto(person, entity, null, bf);
        return person;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.