mirror of
https://github.com/svek95/WST_Labs.git
synced 2026-05-18 02:51:45 +03:00
Add Lab6 finish
This commit is contained in:
@@ -54,8 +54,20 @@ public class CarExceptionsResource {
|
|||||||
@QueryParam("model") String model,
|
@QueryParam("model") String model,
|
||||||
@QueryParam("country") String country,
|
@QueryParam("country") String country,
|
||||||
@QueryParam("dateOfSales") Date dateOfSales,
|
@QueryParam("dateOfSales") Date dateOfSales,
|
||||||
@QueryParam("power") Integer power) {
|
@QueryParam("power") Integer power) throws WrongIDException, WrongValueException{
|
||||||
return String.valueOf(carDao.updateDB(id, name, model, country, dateOfSales, power));
|
if (carDao.findID(id)){
|
||||||
|
if (power < 1 || power > 2000) {
|
||||||
|
throw new WrongValueException("insert","Power must be between 1 PS and 2000 PS");
|
||||||
|
} else {
|
||||||
|
return carDao.updateDB(id, name, model, country, dateOfSales, power).getStringValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throw new WrongIDException(id, "update");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//return String.valueOf(carDao.updateDB(id, name, model, country, dateOfSales, power));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user