Package cz.muni.fi.pa165.stis.entity

Examples of cz.muni.fi.pa165.stis.entity.Tyre


            }
        }
    }

    private static Tyre createTyre(Double diameter, String name, String type, String vendor, BigDecimal price) {
        Tyre t = new Tyre();
        t.setDiameter(diameter);
        t.setName(name);
        t.setType(type);
        t.setVendor(vendor);
        t.setPrice(price);

        return t;
    }
View Full Code Here


    @Override
    public Tyre get(Long id) {
        if (id == null) {
            throw new IllegalArgumentException("id is null");
        }
        Tyre result = em.find(Tyre.class, id);
        return result;
    }
View Full Code Here

            throw new IllegalArgumentException("tyre is null");
        }
        if (tyre.getId() == null) {
            throw new IllegalArgumentException("tyre.id is null");
        }
        Tyre toRemove = em.find(Tyre.class, tyre.getId());
        if (toRemove == null) {
            throw new IllegalArgumentException("tyre does not exist");
        }
        em.remove(toRemove);
    }
View Full Code Here

        extraServiceDAO.create(es1);
        ExtraService es2 = newExtraService("Vysavanie", "Vysavanie auta", BigDecimal.valueOf(122.5));
        extraServiceDAO.create(es2);
        extraServices = new HashSet<ExtraService>(Arrays.asList(new ExtraService[]{es1, es2}));
        //
        Tyre t1 = newTyre(17D, "MM22", "EZ256", "Michellin", BigDecimal.valueOf(222));
        tyreDAO.create(t1);
        Tyre t2 = newTyre(17D, "MM23", "EZ257", "Michellin", BigDecimal.valueOf(222));
        tyreDAO.create(t2);
        Tyre t3 = newTyre(18D, "PR89", "NT99", "Pirelli", BigDecimal.valueOf(253.4));
        tyreDAO.create(t3);
        tyres = new EnumMap<TyrePosition, Tyre>(TyrePosition.class);
        tyres.put(TyrePosition.FRONT_LEFT, t1);
        tyres.put(TyrePosition.FRONT_RIGHT, t2);
        tyres.put(TyrePosition.REAR_LEFT, t3);
View Full Code Here

        assertEquals("Orders are not the same", o2, o);
        assertDeepEquals(o2, o);
        //
        // test tyre remove and add
        o.getTyres().remove(TyrePosition.FRONT_LEFT);
        Tyre t = newTyre(12D, "AJ22", "BRPL", "Matador", BigDecimal.valueOf(77.7));
        tyreDAO.create(t);
        o.getTyres().put(TyrePosition.REAR_RIGHT, t);
        dao.update(o);
        //
        Order o3 = dao.get(o.getId());
View Full Code Here

            assertDeepEquals(os.get(i), orders.get(i));
        }
    }
   
    private static Tyre newTyre(Double diameter, String name, String type, String vendor, BigDecimal price) {
        Tyre t = new Tyre();
        t.setDiameter(diameter);
        t.setName(name);
        t.setType(type);
        t.setVendor(vendor);
        t.setPrice(price);
       
        return t;
    }
View Full Code Here

        }
       
        if (tyre.getId() != null) {
            throw new IllegalArgumentException("tyre.id is not null");
        }
        Tyre tm = mapper.map(tyre, Tyre.class);
        tyreDAO.create(tm);
        tyre.setId(tm.getId());
    }
View Full Code Here

    public TyreTO get(Long id) {
        if (id == null) {
            throw new IllegalArgumentException("Tyre.Id is null");
        }
       
        Tyre tyre = tyreDAO.get(id);
        if (tyre == null) {
            return null;
        }       
        return mapper.map(tyre, TyreTO.class);
    }
View Full Code Here

            throw new IllegalArgumentException("Tyre is null");
        }       
        if (tyre.getId() == null) {
            throw new IllegalArgumentException("Tyre.id is null");
        }
        Tyre tm = mapper.map(tyre, Tyre.class);
        tyreDAO.update(tm);
    }
View Full Code Here

            throw new IllegalArgumentException("Tyre is null");
        }       
        if (tyre.getId() == null) {
            throw new IllegalArgumentException("Tyre.id is null");
        }
        Tyre tm = mapper.map(tyre, Tyre.class);
        tyreDAO.remove(tm);
    }
View Full Code Here

TOP

Related Classes of cz.muni.fi.pa165.stis.entity.Tyre

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.