classification.create(c);
classification.refresh(c);
}
}
Book b = new Book();
form.copyTo(b);
try {
ISBN validIsbn = new ISBN(fIsbn.getValue());
b.setIsbn(validIsbn.toString());
} catch (InvalidStandardIDException e) {
// TODO Auto-generated catch block
b.setIsbn("");
e.printStackTrace();
}
DateFormat df = new SimpleDateFormat("yyyy");
Date year = df.parse(fPubDate.getSelectedValues().get(0).toString());
if(year != null)
b.setPubdate(year);
if(a != null)
b.setAuthor(a);
if(b != null)
b.setPublisher(p);
if(c != null)
b.setClassification(c);
if(fQtty.getValue().isEmpty())
b.setQuantity(1);
Integer book_id = b.getId();
if (book_id != 0 && book_id != null) {
book.update(b);
} else {
book.create(b);
}