@Override public void delete() { try { bc.delete(getId()); addMessageContext("Registro deletado com sucesso!", SeverityType.INFO); } catch (Exception e) { addMessageContext("Ocorreu um erro ao deletar o registro!", SeverityType.ERROR); } redirectListView(); }
@Override public void save() { try { bc.validateAndSave(getBean()); addMessageContext("Registro salvo com sucesso!", SeverityType.INFO); } catch (BusinessException ex) { addMessageContext(ex.getMessage(), SeverityType.WARN); } catch (Exception ex) { addMessageContext(ex.getMessage(), SeverityType.ERROR); } }
@Override public void deleteSelection() { try { boolean delete; for (Iterator<String> iter = getSelection().keySet().iterator(); iter.hasNext(); ) { String id = iter.next(); delete = getSelection().get(id); if (delete) { bc.delete(id); iter.remove(); } } addMessageContext("Registro deletado com sucesso!", SeverityType.INFO); redirectListView(); } catch (Exception e) { addMessageContext("Ocorreu um erro ao deletar o registro!", SeverityType.ERROR); } }
@Override protected Level handleLoad(String id) { return bc.load(id); }
@Override protected List<Level> handleResultList() { return bc.findAll(); }