public boolean hasShipType(String descricao) { Tbshiptype shipType = null; List<Tbshiptype> embarcacoes = null; try { embarcacoes = shipTypeService.getShipTypeByDescription(descricao); if (embarcacoes != null && !embarcacoes.isEmpty()) { FacesMessageUtil.addErrorMessage( FacesContext.getCurrentInstance(), "msgsGrowl", FacesMessageUtil.getMessage("label_embarcacao_ja_cadastrado", null), null); FacesContext.getCurrentInstance().validationFailed(); return true; // FacesContext.getCurrentInstance().validationFailed(); } } catch (Exception e) { FacesMessageUtil.addGlobalErrorMessage( FacesContext.getCurrentInstance(), e.getMessage(), null); e.printStackTrace(); } return false; }
public void updateShipType(Tbshiptype shipType) { try { shipTypeService.updateShipType(shipType); FacesMessageUtil.addInfoMessage( FacesContext.getCurrentInstance(), "msgsGrowl", FacesMessageUtil.getMessage("label_msg_sucesso_salvar_tipo_embarcacao", null), null); } catch (Exception e) { FacesMessageUtil.addGlobalErrorMessage( FacesContext.getCurrentInstance(), e.getMessage(), null); e.printStackTrace(); } }
public List<Tbshiptype> listShipsType() { List<Tbshiptype> shipsType = null; try { shipsType = shipTypeService.getAllShipsType(); } catch (Exception e) { FacesMessageUtil.addGlobalErrorMessage( FacesContext.getCurrentInstance(), e.getMessage(), null); e.printStackTrace(); } return shipsType; }