/**
  * Search article by id
  *
  * @param id
  * @return
  */
 public Article getArticle(int id) {
   for (Article a : articles) {
     if (a.getId() == id) {
       return a;
     }
   }
   return null;
 }
 @Override
 public Object getValueAt(int rowIndex, int colIndex) {
   Article a = articles.get(rowIndex);
   switch (colIndex) {
     case 0:
       return a.getId();
     case 1:
       return a.getName();
     case 2:
       return a.getPrice();
     case 3:
       return a.isAvailable();
   }
   return null;
 }
 @Override
 public void setValueAt(Object value, int row, int col) {
   Article a = articles.get(row);
   em.getTransaction().begin();
   switch (col) {
     case 1:
       a.setName((String) value);
       break;
     case 2:
       a.setPrice((double) value);
       break;
     case 3:
       a.setAvailable((boolean) value);
       break;
   }
   em.persist(a);
   em.getTransaction().commit();
   fireTableCellUpdated(row, col);
 }