public void delIclubAssessmentType() { LOGGER.info("Class :: " + this.getClass() + " :: Method :: delIclubAssessmentType"); try { WebClient client = IclubWebHelper.createCustomClient(BASE_URL + "del/" + bean.getAtId()); Response response = client.accept(MediaType.APPLICATION_JSON).get(); if (response.getStatus() == 200) { IclubWebHelper.addMessage( getLabelBundle().getString("assessmentType") + " " + getLabelBundle().getString("del.success"), FacesMessage.SEVERITY_INFO); clearForm(); } else { IclubWebHelper.addMessage( getLabelBundle().getString("assessmentType") + " " + getLabelBundle().getString("del.service.error"), FacesMessage.SEVERITY_ERROR); } } catch (Exception e) { LOGGER.error(e, e); IclubWebHelper.addMessage( getLabelBundle().getString("assessmentType") + " " + getLabelBundle().getString("del.error") + " :: " + e.getMessage(), FacesMessage.SEVERITY_ERROR); } }
public boolean validateForm(boolean flag) { boolean ret = true; if (bean.getAtShortDesc() != null && !bean.getAtShortDesc().trim().equalsIgnoreCase("")) { WebClient client = IclubWebHelper.createCustomClient( BASE_URL + "validate/sd/" + bean.getAtShortDesc().trim() + "/" + ((bean.getAtId() == null) ? -999l : bean.getAtId())); ResponseModel message = client.accept(MediaType.APPLICATION_JSON).get(ResponseModel.class); client.close(); if (message.getStatusCode() != 0) { IclubWebHelper.addMessage(message.getStatusDesc(), FacesMessage.SEVERITY_ERROR); ret = ret && false; } } else { IclubWebHelper.addMessage( getLabelBundle().getString("val.ShortDesc.empty"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } if (bean.getAtLongDesc() == null || bean.getAtLongDesc().trim().equalsIgnoreCase("")) { IclubWebHelper.addMessage( getLabelBundle().getString("val.longdesc.empty"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } if (bean.getAtStatus() == null || bean.getAtStatus().trim().equalsIgnoreCase("")) { IclubWebHelper.addMessage( getLabelBundle().getString("val.select.valid"), FacesMessage.SEVERITY_ERROR); ret = ret && false; } return ret; }
public void modIclubAssessmentType() { LOGGER.info("Class :: " + this.getClass() + " :: Method :: modIclubAssessmentType"); try { if (validateForm(false)) { WebClient client = IclubWebHelper.createCustomClient(BASE_URL + "mod"); IclubAssessmentTypeModel model = new IclubAssessmentTypeModel(); model.setAtId(bean.getAtId()); model.setAtLongDesc(bean.getAtLongDesc()); model.setAtShortDesc(bean.getAtShortDesc()); model.setAtStatus(bean.getAtStatus()); ResponseModel response = client.accept(MediaType.APPLICATION_JSON).put(model, ResponseModel.class); client.close(); if (response.getStatusCode() == 0) { IclubWebHelper.addMessage( getLabelBundle().getString("assessmentType") + " " + getLabelBundle().getString("mod.success"), FacesMessage.SEVERITY_INFO); clearForm(); } else { IclubWebHelper.addMessage( getLabelBundle().getString("assessmentType") + " " + getLabelBundle().getString("mod.error") + " :: " + response.getStatusDesc(), FacesMessage.SEVERITY_ERROR); } } } catch (Exception e) { LOGGER.error(e, e); IclubWebHelper.addMessage( getLabelBundle().getString("assessmentType") + " " + getLabelBundle().getString("mod.error") + " :: " + e.getMessage(), FacesMessage.SEVERITY_ERROR); } }