Package org.shams.phonebook.domain.impl

Examples of org.shams.phonebook.domain.impl.Item


        assertEquals(after, before + 1);
    }

    public void load() {
        int before = countRowsInTable("_item");
        Item item = getItem();
        dao.save(item);
        assertEquals(countRowsInTable("_item"), before + 1);
        List<Item> items = dao.load();
        assertEquals(items.size(), before + 1);
        assertEquals(items.get(before).getFirstName(), "f");

        Item lastItem = dao.load(items.get(before).getId());
        assertNotNull(lastItem);
        assertEquals(lastItem.getLastName(), "l");

        assertEquals(dao.load("@").size(), 1);
        assertEquals(dao.load("@1").size(), 0);
    }
View Full Code Here


        dao.delete(items.get(before));
        assertEquals(before, dao.load().size());
    }

    private Item getItem() {
        return new Item("f", "l", "p", "m", "@", "A");
    }
View Full Code Here

        service.save(getItem());
        assertEquals(1, countRowsInTable("_item"));
        List<Item> items = service.load("f");
        assertEquals(1, items.size());
        assertEquals("@", items.get(0).getMail());
        Item item = service.load(items.get(0).getId());
        assertNotNull(item);
        assertEquals("A", item.getAddress());
    }
View Full Code Here

        assertEquals(0, service.load("f").size());
    }


    private Item getItem() {
        return new Item("f", "l", "p", "m", "@", "A");
    }
View Full Code Here

        getSimpleJdbcTemplate().update(query, item.getId());
    }

    private class ItemRowMapper implements ParameterizedRowMapper<Item> {
        public Item mapRow(ResultSet rs, int i) throws SQLException {
            Item item = new Item();
            item.setId(rs.getLong("id"));
            item.setFirstName(rs.getString("name"));
            item.setLastName(rs.getString("family"));
            item.setPhone(rs.getString("phone"));
            item.setMobile(rs.getString("mobile"));
            item.setMail(rs.getString("mail"));
            item.setAddress(rs.getString("address"));
            return item;
        }
View Full Code Here

    public void update(Item item) {
        getJpaTemplate().merge(item);
    }

    public void delete(Item item) {
        Item attached = getJpaTemplate().find(Item.class, item.getId());
        getJpaTemplate().remove(attached);
    }
View Full Code Here

        return itemService.load(searchItem);
    }

    public Item getItem() {
        if (item == null) {
            item = new Item();
        }
        return item;
    }
View Full Code Here

        return List.class;
    }

    public Item getItem() {
        if (item == null) {
            item = new Item();
        }
        return item;
    }
View Full Code Here

TOP

Related Classes of org.shams.phonebook.domain.impl.Item

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.