public List<IclubBuildingStateBean> getBeans() { WebClient client = IclubWebHelper.createCustomClient(BASE_URL + "list"); Collection<? extends IclubBuildingStateModel> models = new ArrayList<IclubBuildingStateModel>( client.accept(MediaType.APPLICATION_JSON).getCollection(IclubBuildingStateModel.class)); client.close(); beans = new ArrayList<IclubBuildingStateBean>(); if (models != null && models.size() > 0) { for (IclubBuildingStateModel model : models) { IclubBuildingStateBean bean = IclubBuildingStateTrans.fromWStoUI(model); beans.add(bean); } } return beans; }
public void modIclubBuildingState() { LOGGER.info("Class :: " + this.getClass() + " :: Method :: modIclubBuildingState"); try { if (validateForm(false)) { WebClient client = IclubWebHelper.createCustomClient(BASE_URL + "mod"); IclubBuildingStateModel model = IclubBuildingStateTrans.fromUItoWS(bean); ResponseModel response = client.accept(MediaType.APPLICATION_JSON).put(model, ResponseModel.class); client.close(); if (response.getStatusCode() == 0) { IclubWebHelper.addMessage( getLabelBundle().getString("buildingstate") + " " + getLabelBundle().getString("mod.success"), FacesMessage.SEVERITY_INFO); clearForm(); } else { IclubWebHelper.addMessage( getLabelBundle().getString("buildingstate") + " " + getLabelBundle().getString("mod.error") + " :: " + response.getStatusDesc(), FacesMessage.SEVERITY_ERROR); } } } catch (Exception e) { LOGGER.error(e, e); IclubWebHelper.addMessage( getLabelBundle().getString("buildingstate") + " " + getLabelBundle().getString("mod.error") + " :: " + e.getMessage(), FacesMessage.SEVERITY_ERROR); } }