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 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); } }
public List<IclubAssessmentTypeBean> getBeans() { WebClient client = IclubWebHelper.createCustomClient(BASE_URL + "list"); Collection<? extends IclubAssessmentTypeModel> models = new ArrayList<IclubAssessmentTypeModel>( client .accept(MediaType.APPLICATION_JSON) .getCollection(IclubAssessmentTypeModel.class)); client.close(); beans = new ArrayList<IclubAssessmentTypeBean>(); if (models != null && models.size() > 0) { for (IclubAssessmentTypeModel model : models) { IclubAssessmentTypeBean bean = new IclubAssessmentTypeBean(); bean.setAtId(model.getAtId()); bean.setAtLongDesc(model.getAtLongDesc()); bean.setAtShortDesc(model.getAtShortDesc()); bean.setAtStatus(model.getAtStatus()); beans.add(bean); } } return beans; }
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; }