List of usage examples for com.google.gwt.http.client URL encode
public static String encode(String decodedURL)
From source file:org.freemedsoftware.gwt.client.screen.ACLScreen.java
License:Open Source License
public void onClick(ClickEvent evt) { Widget w = (Widget) evt.getSource(); if (w == addGroupButton) { if (checkInput() == true) { blockScreenWidget.setText(_("Please wait while permissions are being applied...")); aclContainerVPanel.add(blockScreenWidget); HashMap<String, String> m = new HashMap<String, String>(); m.put("groupName", groupName.getText()); String requestURL = "org.freemedsoftware.module.ACL.AddGroupWithPermissions"; if (groupId != null) { requestURL = "org.freemedsoftware.module.ACL.ModGroupWithPermissions"; m.put("groupId", groupId.toString()); }// w w w . j a v a2 s . co m final HashMap<String, List> permissions = new HashMap<String, List>(); final HashMap<String, List> allPermiHashMap = populateAllPermissions(); final Iterator<String> aclPermissionsMapItr = allPermiHashMap.keySet().iterator(); int permissionAddedCounter = 0; while (aclPermissionsMapItr.hasNext()) { String section = aclPermissionsMapItr.next(); permissions.put(section, allPermiHashMap.get(section)); permissionAddedCounter++; if (permissionAddedCounter == 8) { if (allPermiHashMap.get("admin") != null) permissions.put("admin", allPermiHashMap.get("admin")); if (allPermiHashMap.get("acl") != null) permissions.put("acl", allPermiHashMap.get("acl")); break; } } if (permissions.size() == 0) { Window.alert(_("Please select at least one module!")); aclContainerVPanel.remove(blockScreenWidget); return; } if (Util.getProgramMode() == ProgramMode.STUBBED) { // Do nothing. } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { String[] params = { JsonUtil.jsonify(m), JsonUtil.jsonify(permissions) }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest(requestURL, params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { Util.showErrorMsg("ACL", _("Failed to add.")); } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { Integer r = (Integer) JsonUtil .shoehornJson(JSONParser.parseStrict(response.getText()), "Integer"); if (r != null) { if (aclPermissionsMapItr.hasNext()) sendDataInChucks(aclPermissionsMapItr, allPermiHashMap, r);//Sending data to server in chunks else { aclContainerVPanel.remove(blockScreenWidget); retrieveAllGroups(); clearForm(); Util.showInfoMsg(className, _("Permissions successfully applied.")); } } else { Boolean b = (Boolean) JsonUtil.shoehornJson( JSONParser.parseStrict(response.getText()), "Boolean"); if (b) { if (aclPermissionsMapItr.hasNext()) sendDataInChucks(aclPermissionsMapItr, allPermiHashMap, groupId);//Sending data to server in chunks else { aclContainerVPanel.remove(blockScreenWidget); retrieveAllGroups(); clearForm(); Util.showInfoMsg(className, _("Permissions successfully applied.")); } } } } else { Util.showErrorMsg("ACL", _("Failed to apply permissions.")); } } }); } catch (RequestException e) { Util.showErrorMsg("Bottle Transfer", "Failed to apply Permissions."); } } else { // TODO: Create GWT-RPC stuff here } } } else if (w == deleteGroupButton) { if (true) { if (Util.getProgramMode() == ProgramMode.STUBBED) { // Do nothing. } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { String[] params = { JsonUtil.jsonify(groupId) }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode( Util.getJsonRequest("org.freemedsoftware.module.ACL.DelGroupWithPermissions", params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { Util.showErrorMsg("ACL", _("Failed to delete.")); } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { Boolean flag = (Boolean) JsonUtil .shoehornJson(JSONParser.parseStrict(response.getText()), "Boolean"); if (flag) { Util.showInfoMsg(className, _("Successfully deleted.")); retrieveAllGroups(); clearForm(); } } else { Util.showErrorMsg("ACL", _("Failed to add.")); } } }); } catch (RequestException e) { Util.showErrorMsg("ACL", _("Failed to add.")); } } else { // TODO: Create GWT-RPC stuff here } } } else if (w == clearButton) { clearForm(); } else if (w == copyButton) { copyGroup(); } }
From source file:org.freemedsoftware.gwt.client.screen.ACLScreen.java
License:Open Source License
public void retrieveAllGroups() { if (Util.getProgramMode() == ProgramMode.STUBBED) { // Do nothing } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { // Use JSON-RPC to retrieve the data String[] params = { JsonUtil.jsonify(true) }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest("org.freemedsoftware.module.ACL.userGroups", params))); try {/*from w w w . j a v a 2s .c o m*/ builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { GWT.log(request.toString(), ex); } @SuppressWarnings("unchecked") public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == 200) { HashMap<String, String>[] data = (HashMap<String, String>[]) JsonUtil.shoehornJson( JSONParser.parseStrict(response.getText()), "HashMap<String,String>[]"); if (data != null) { groupsTable.clearData(); groupsTable.loadData(data); } } } }); } catch (RequestException e) { // nothing here right now } } else if (Util.getProgramMode() == ProgramMode.NORMAL) { // Use GWT-RPC to retrieve the data // TODO: Create that stuff } }
From source file:org.freemedsoftware.gwt.client.screen.ACLScreen.java
License:Open Source License
public void getACLPermissions() { if (Util.getProgramMode() == ProgramMode.STUBBED) { // Do nothing } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { // Use JSON-RPC to retrieve the data String[] params = {};//from w w w. jav a 2s.c om RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest("org.freemedsoftware.module.ACL.GetAllPermissions", params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { GWT.log(request.toString(), ex); } @SuppressWarnings("unchecked") public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == 200) { HashMap<String, String[]> data = (HashMap<String, String[]>) JsonUtil.shoehornJson( JSONParser.parseStrict(response.getText()), "HashMap<String,String[]>"); if (data != null) { addACLGroupPermissions(data); blockScreenWidget.removeFromParent(); } } } }); } catch (RequestException e) { // nothing here right now } } else if (Util.getProgramMode() == ProgramMode.NORMAL) { // Use GWT-RPC to retrieve the data // TODO: Create that stuff } }
From source file:org.freemedsoftware.gwt.client.screen.ACLScreen.java
License:Open Source License
public void getGroupPermissions(Integer groupId) { if (Util.getProgramMode() == ProgramMode.STUBBED) { // Do nothing } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { // Use JSON-RPC to retrieve the data String[] params = { JsonUtil.jsonify(groupId) }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest("org.freemedsoftware.module.ACL.GetGroupPermissions", params))); try {//from ww w .j a v a 2 s.c om builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { GWT.log(request.toString(), ex); } @SuppressWarnings("unchecked") public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == 200) { HashMap<String, String[]> data = (HashMap<String, String[]>) JsonUtil.shoehornJson( JSONParser.parseStrict(response.getText()), "HashMap<String,String[]>"); if (data != null) { Iterator<String> iterator = data.keySet().iterator(); while (iterator.hasNext()) { final String section = iterator.next(); String[] values = data.get(section); for (int i = 0; i < values.length; i++) { final String value = values[i]; if (aclPermissionsMap.get(section + ":" + value) != null) aclPermissionsMap.get(section + ":" + value).setValue(true); } } addGroupButton.setText(_("Modify Group")); deleteGroupButton.setVisible(true); copyButton.setVisible(true); } } } }); } catch (RequestException e) { // nothing here right now } } else if (Util.getProgramMode() == ProgramMode.NORMAL) { // Use GWT-RPC to retrieve the data // TODO: Create that stuff } }
From source file:org.freemedsoftware.gwt.client.screen.CallInScreen.java
License:Open Source License
public void showCallinInfo(Integer callinId) { tabPanel.selectTab(0);// w w w .j a va 2s. c o m if (Util.getProgramMode() == ProgramMode.STUBBED) { // TODO STUBBED MODE STUFF } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { String[] params = { JsonUtil.jsonify(callinId) }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest("org.freemedsoftware.module.Callin.GetDetailedRecord", params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { } @SuppressWarnings("unchecked") public void onResponseReceived(Request request, Response response) { if (Util.checkValidSessionResponse(response.getText())) { if (200 == response.getStatusCode()) { HashMap<String, String> data = (HashMap<String, String>) JsonUtil.shoehornJson( JSONParser.parseStrict(response.getText()), "HashMap<String,String>"); if (data != null) { Popup callinDetailPopup = new Popup(); callinDetailPopup.setPixelSize(500, 20); FlexTable callinPatientDetail = new FlexTable(); while (callinPatientDetail.getRowCount() > 0) callinPatientDetail.removeRow(0); int row = 0; callinPatientDetail.setWidget(row, 0, new Label(_("Name") + ":")); callinPatientDetail.setWidget(row++, 1, new Label(data.get("name"))); callinPatientDetail.setWidget(row, 0, new Label(_("Date of Birth") + ":")); callinPatientDetail.setWidget(row++, 1, new Label(data.get("dob"))); callinPatientDetail.setWidget(row, 0, new Label(_("Complaint") + ":")); callinPatientDetail.setWidget(row++, 1, new Label(data.get("complaint"))); callinPatientDetail.setWidget(row, 0, new Label(_("Home Phone") + ":")); callinPatientDetail.setWidget(row++, 1, new Label(data.get("phone_home"))); callinPatientDetail.setWidget(row, 0, new Label(_("Work Phone") + ":")); callinPatientDetail.setWidget(row++, 1, new Label(data.get("phone_work"))); callinPatientDetail.setWidget(row, 0, new Label(_("Facility") + ":")); callinPatientDetail.setWidget(row++, 1, new Label(data.get("facility"))); callinPatientDetail.setWidget(row, 0, new Label(_("Provider") + ":")); callinPatientDetail.setWidget(row++, 1, new Label(data.get("physician"))); callinPatientDetail.setWidget(row, 0, new Label(_("Call Date") + ":")); callinPatientDetail.setWidget(row++, 1, new Label(data.get("call_date"))); callinPatientDetail.setWidget(row, 0, new Label(_("Took Call") + ":")); callinPatientDetail.setWidget(row++, 1, new Label(data.get("took_call"))); PopupView viewInfo = new PopupView(callinPatientDetail); callinDetailPopup.setNewWidget(viewInfo); callinDetailPopup.initialize(); } } else { } } } }); } catch (RequestException e) { } } else { // TODO NORMAL MODE STUFF } }
From source file:org.freemedsoftware.gwt.client.screen.CallInScreen.java
License:Open Source License
protected void modifyEntry(final Integer callinId) { if (Util.getProgramMode() == ProgramMode.STUBBED) { // TODO STUBBED MODE STUFF } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { String[] params = { JsonUtil.jsonify(callinId) }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode( Util.getJsonRequest("org.freemedsoftware.module.Callin.GetDetailedRecordWithIntake", params))); try {/*from w w w . j av a2 s . c o m*/ builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { } @SuppressWarnings("unchecked") public void onResponseReceived(Request request, Response response) { if (Util.checkValidSessionResponse(response.getText())) { if (200 == response.getStatusCode()) { HashMap<String, String> data = (HashMap<String, String>) JsonUtil.shoehornJson( JSONParser.parseStrict(response.getText()), "HashMap<String,String>"); if (data != null) { if (data.get("intaketype") == null) { formSelection.setWidgetValue("Basic"); handleFormSelection(); Util.populateForm(basicFormFields, data); if (data.get("ciisinsured") != null) callinPatientCoverages.loadCoverageData(1, data); btnAdd.setText("Modify"); } } } else { } } } }); } catch (RequestException e) { } } else { // TODO NORMAL MODE STUFF } }
From source file:org.freemedsoftware.gwt.client.screen.CallInScreen.java
License:Open Source License
protected void unarchiveEntry(final Integer callinId) { if (Util.getProgramMode() == ProgramMode.STUBBED) { // TODO STUBBED MODE STUFF } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { String[] params = { JsonUtil.jsonify(callinId) }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest("org.freemedsoftware.module.Callin.GetRecord", params))); try {// ww w .j av a 2 s .c om builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { } public void onResponseReceived(Request request, Response response) { populate(searchCriteria); tabPanel.selectTab(1); selectedEntryId = callinId; modifyEntry(callinId); } }); } catch (RequestException e) { } } else { // TODO NORMAL MODE STUFF } }
From source file:org.freemedsoftware.gwt.client.screen.CallInScreen.java
License:Open Source License
public void populate(HashMap<String, String> criteria) { if (Util.getProgramMode() == ProgramMode.STUBBED) { // TODO: handle stubbed } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { callInTable.showloading(true);/*w w w. j a v a 2 s. c om*/ String[] params = {}; if (criteria != null && criteria.size() > 0) { String[] tempParams = { JsonUtil.jsonify(criteria) }; params = tempParams; } RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL .encode(Util.getJsonRequest("org.freemedsoftware.module.Callin.GetAllWithInsurance", params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(com.google.gwt.http.client.Request request, Throwable ex) { GWT.log("Exception", ex); } @SuppressWarnings("unchecked") public void onResponseReceived(com.google.gwt.http.client.Request request, com.google.gwt.http.client.Response response) { if (200 == response.getStatusCode()) { HashMap<String, String>[] result = (HashMap<String, String>[]) JsonUtil.shoehornJson( JSONParser.parseStrict(response.getText()), "HashMap<String,String>[]"); if (result != null) { callInTable.clearAllSelections(); callInTable.loadData(result); } else { callInTable.showloading(false); } } else { } } }); } catch (RequestException e) { GWT.log("Exception", e); } } else { getProxy().GetReports(locale, new AsyncCallback<HashMap<String, String>[]>() { public void onSuccess(HashMap<String, String>[] r) { callInTable.loadData(r); } public void onFailure(Throwable t) { GWT.log("Exception", t); } }); } }
From source file:org.freemedsoftware.gwt.client.screen.CallInScreen.java
License:Open Source License
public void saveForm() { if (validateForm()) { // Add callin info if (Util.getProgramMode() == ProgramMode.STUBBED) { // TODO STUBBED MODE STUFF } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { RequestBuilder builder = null; if (btnAdd.getText().equals(_("Add"))) { String[] params = { JsonUtil.jsonify(populateHashMap(null)) }; builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest("org.freemedsoftware.module.Callin.add", params))); } else { String[] params = { JsonUtil.jsonify(populateHashMap(selectedEntryId)) }; builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest("org.freemedsoftware.module.Callin.mod", params))); }/*ww w . ja v a2 s. com*/ try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { Integer r = null; r = (Integer) JsonUtil.shoehornJson(JSONParser.parseStrict(response.getText()), "Integer"); if (r != null) { // clearForm(); // populate(); showPopupAfterSaveCallin(r); Util.showInfoMsg("Callin Form", _("Entry successfully added.")); } else { r = (Boolean) JsonUtil.shoehornJson(JSONParser.parseStrict(response.getText()), "Boolean") ? 1 : 0; if (r == 1) { // clearForm(); // populate(); formSelection.setWidgetValue(""); tabPanel.selectTab(0); Util.showInfoMsg("Callin Form", _("Entry successfully modified.")); btnAdd.setText("Add"); showPopupAfterSaveCallin(selectedEntryId); } else { } } } else { Util.showErrorMsg("Callin Form", _("Callin form failed.")); } } }); } catch (RequestException e) { } } else if (Util.getProgramMode() == ProgramMode.NORMAL) { // TODO GWT WORK } } }
From source file:org.freemedsoftware.gwt.client.screen.CallInScreen.java
License:Open Source License
protected void deleteEntry(Integer callId, final int curItem, final int totalItems) { if (Util.getProgramMode() == ProgramMode.STUBBED) { // TODO STUBBED MODE STUFF } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { String[] params = { JsonUtil.jsonify(callId) }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest("org.freemedsoftware.module.Callin.del", params))); try {/*from ww w . ja va 2 s .com*/ builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { Util.showErrorMsg("Callin Form", _("Failed to delete entry.")); } public void onResponseReceived(Request request, Response response) { if (Util.checkValidSessionResponse(response.getText())) { if (200 == response.getStatusCode()) { Boolean r = (Boolean) JsonUtil .shoehornJson(JSONParser.parseStrict(response.getText()), "Boolean"); if (r != null) { Util.showInfoMsg("Callin Form", _("Entry deleted.")); if (curItem == totalItems) populate(null); } } else { Util.showErrorMsg("Callin Form", _("Failed to delete entry.")); } } } }); } catch (RequestException e) { } } else { // TODO NORMAL MODE STUFF } }