/** * Get an existing instance of LaboratoireReference * * @param entityId the id of the LaboratoireReferenceProxy to be fetched */ private void fetchLaboratoireReference(String entityId) { LaboratoireReferenceRequest request = requestFactory.laboratoireReferenceRequest(); /* get the LaboratoireReference instance from database */ Request<LaboratoireReferenceProxy> fetchRequest = request.findById(entityId); fetchRequest.with("nom"); fetchRequest.with("description"); fetchRequest.with("region"); fetchRequest.with("region.nom"); fetchRequest.with("districtSante"); fetchRequest.with("districtSante.nom"); fetchRequest.with("coordonnees"); fetchRequest.with("lieuxDits"); fetchRequest .to( new Receiver<LaboratoireReferenceProxy>() { @Override public void onSuccess(LaboratoireReferenceProxy entity) { viewLaboratoireReference(entity); } }) .fire(); }
/** * Get an existing instance of TransfertReference * * @param entityId the id of the TransfertReferenceProxy to be fetched */ private void fetchTransfertReference(String entityId) { TransfertReferenceRequest request = requestFactory.transfertReferenceRequest(); /* get the TransfertReference instance from database */ Request<TransfertReferenceProxy> fetchRequest = request.findById(entityId); fetchRequest.with("region"); fetchRequest.with("region.nom"); fetchRequest.with("districtSante"); fetchRequest.with("districtSante.nom"); fetchRequest.with("CDTDepart"); fetchRequest.with("patient"); fetchRequest.with("regionArrivee"); fetchRequest.with("regionArrivee.nom"); fetchRequest.with("districtSanteArrivee"); fetchRequest.with("districtSanteArrivee.nom"); fetchRequest.with("CDTArrivee"); fetchRequest .to( new Receiver<TransfertReferenceProxy>() { @Override public void onSuccess(TransfertReferenceProxy entity) { viewTransfertReference(entity); } }) .fire(); }
/** Persist the current instance of LaboratoireReference */ @Override protected void save() { editor.validateFields(); editorDriver.flush(); // Check for errors on the client side if (editorDriver.hasErrors()) { // Window.alert("LaboratoireReference form not validated locally"); return; } Request<Void> saveRequest = request.save(current, isNew); saveRequest.to( new Receiver<Void>() { @Override public void onSuccess(Void response) { requestFactory .getEventBus() .fireEvent(new SaveLaboratoireReferenceEvent(current, initField)); closeForm(); } @Override public void onConstraintViolation(Set<ConstraintViolation<?>> errors) { // Window.alert("LaboratoireReference form not validated on server"); // TODO manage errors on client side when made available by GWT if (errors != null && errors.size() > 0) { // convert ConstraintViolation to get localized messages EpicamRenderer renderer = EpicamRenderer.get(); Set<ConstraintViolation<?>> imogErrors = new HashSet<ConstraintViolation<?>>(); for (ConstraintViolation<?> error : errors) { ImogConstraintViolation violation = new ImogConstraintViolation(); violation.setLeafBean((BaseProxy) error.getLeafBean()); violation.setPropertyPath(error.getPropertyPath()); violation.setRootBean((BaseProxy) error.getRootBean()); violation.setMessage(renderer.getI18nErrorMessage(error.getMessage())); imogErrors.add(violation); } editorDriver.setConstraintViolations(imogErrors); } } @Override public void onFailure(ServerFailure error) { Window.alert("Error updating the LaboratoireReference"); super.onFailure(error); } }); request.fire(); }
/** * Get an existing instance of LieuDit * * @param entityId the id of the LieuDitProxy to be fetched */ private void fetchLieuDit(String entityId) { LieuDitRequest request = requestFactory.lieuDitRequest(); /* get the LieuDit instance from database */ Request<LieuDitProxy> fetchRequest = request.findById(entityId); fetchRequest.with("description"); fetchRequest.with("coordonnees"); fetchRequest .to( new Receiver<LieuDitProxy>() { @Override public void onSuccess(LieuDitProxy entity) { viewLieuDit(entity); } }) .fire(); }