Package org.apache.deltaspike.data.test.domain.dto

Examples of org.apache.deltaspike.data.test.domain.dto.SimpleDto


{

    @Override
    public Object mapResult(Simple result)
    {
        SimpleDto dto = new SimpleDto();
        dto.setId(new SimpleId(result.getId()));
        dto.setName(result.getName());
        dto.setEnabled(result.getEnabled());
        return dto;
    }
View Full Code Here


    @Override
    public Object mapParameter(Object parameter)
    {
        if (parameter instanceof SimpleDto)
        {
            SimpleDto dto = (SimpleDto) parameter;
            Simple simple = new Simple(dto.getName());
            simple.setId(dto.getId() != null ? dto.getId().getId() : null);
            simple.setEnabled(dto.getEnabled());
            return simple;
        }
        return ((SimpleId) parameter).getId();
    }
View Full Code Here

    }

    @Override
    protected SimpleDto toDto(Simple entity)
    {
        SimpleDto dto = new SimpleDto();
        dto.setId(new SimpleId(entity.getId()));
        dto.setEnabled(entity.getEnabled());
        dto.setName(entity.getName());
        return dto;
    }
View Full Code Here

    @Test
    public void should_map_entityrepo_methods()
    {
        // given
        SimpleDto dto = new SimpleDto();
        dto.setName("should_map_entityrepo_methods");
        dto.setEnabled(Boolean.TRUE);

        // when
        SimpleDto saved = repository.saveAndFlush(dto);
        SimpleDto loadedDto = repository.findBy(saved.getId());
        Simple loaded = entityManager.find(Simple.class, saved.getId().getId());

        // then
        assertNotNull(loadedDto);
        assertNotNull(loaded);
View Full Code Here

    @Test
    public void should_save_new_entity_with_simplemapper()
    {
        // given
        SimpleDto dto = new SimpleDto();
        dto.setName("should_save_new_entity_with_simplemapper");
        dto.setEnabled(Boolean.TRUE);

        // when
        SimpleDto result = dtoRepository.save(dto);

        // then
        assertNotNull(result);
        assertNotNull(result.getId());
    }
View Full Code Here

        final String name = "should_update_existing_entity_with_simplemapper";
        Simple simple = new Simple(name);
        simple.setEnabled(Boolean.TRUE);
        entityManager.persist(simple);

        SimpleDto dto = new SimpleDto();
        dto.setName(name + "_updated");
        dto.setEnabled(Boolean.TRUE);
        dto.setId(new SimpleId(simple.getId()));

        // when
        dtoRepository.save(dto);
        Simple lookup = entityManager.find(Simple.class, simple.getId());
View Full Code Here

    @Test
    public void should_map_entityrepo_methods()
    {
        // given
        SimpleDto dto = new SimpleDto();
        dto.setName("should_map_entityrepo_methods");
        dto.setEnabled(Boolean.TRUE);

        // when
        SimpleDto saved = repository.saveAndFlush(dto);
        SimpleDto loadedDto = repository.findBy(saved.getId());
        Simple loaded = entityManager.find(Simple.class, saved.getId().getId());

        // then
        assertNotNull(loadedDto);
        assertNotNull(loaded);
View Full Code Here

{

    @Override
    public Object mapResult(Simple result)
    {
        SimpleDto dto = new SimpleDto();
        dto.setId(new SimpleId(result.getId()));
        dto.setName(result.getName());
        dto.setEnabled(result.getEnabled());
        return dto;
    }
View Full Code Here

    @Override
    public Object mapParameter(Object parameter)
    {
        if (parameter instanceof SimpleDto)
        {
            SimpleDto dto = (SimpleDto) parameter;
            Simple simple = new Simple();
            simple.setId(dto.getId() != null ? dto.getId().getId() : null);
            simple.setEnabled(dto.getEnabled());
            simple.setName(dto.getName());
            System.out.println("Converted " + simple);
            return simple;
        }
        return ((SimpleId) parameter).getId();
    }
View Full Code Here

TOP

Related Classes of org.apache.deltaspike.data.test.domain.dto.SimpleDto

Copyright © 2018 www.massapicom. 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.