/** Return the book */ public void closeBookOrder() { try { bookOrderItemsService.closeBookOrder(currentBookOrderId); initDiscipleCurrentBookOrders(); } catch (Exception e) { e.printStackTrace(); FacesContext.getCurrentInstance() .addMessage( null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error: ", e.getMessage())); } }
public List<BookOrder> DiscipleCurrentBookOrders() { try { return bookOrderItemsService.getAllEntities(); } catch (Exception e) { e.printStackTrace(); FacesContext.getCurrentInstance() .addMessage( null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error: ", e.getMessage())); } return null; }
/** * Save new order * * @return */ public String addNewBookOrder() { try { this.newBookOrder.setDisciple(selectedDisciple); bookOrderItemsService.addNewBookOrder(this.newBookOrder); this.newBookOrder = new BookOrder(); // После добавления создаем // новый initDiscipleCurrentBookOrders(); } catch (Exception e) { e.printStackTrace(); FacesContext.getCurrentInstance() .addMessage( null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error: ", e.getMessage())); } return null; }
@Transactional public void initDiscipleCurrentBookOrders() { if (this.selectedDisciple == null) return; try { this.discipleCurrentBookOrders = bookOrderItemsService.findByDiscipleActiv(this.selectedDisciple); for (BookOrder bo : this.discipleCurrentBookOrders) { // Lazy init if (bo.getItems() != null) bo.getItems().size(); } } catch (Exception e) { e.printStackTrace(); FacesContext.getCurrentInstance() .addMessage( null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error: ", e.getMessage())); } }