List of usage examples for com.google.gwt.http.client RequestBuilder POST
Method POST
To view the source code for com.google.gwt.http.client RequestBuilder POST.
Click Source Link
From source file:org.freemedsoftware.gwt.client.widget.RemittBillingWidget.java
License:Open Source License
public void loadCoverageList(final CustomListBox covList, final String proc) { if (Util.getProgramMode() == ProgramMode.JSONRPC) { // //////////////////// String[] params = { proc }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode( Util.getJsonRequest("org.freemedsoftware.module.ProcedureModule.getCoverages", params))); try {//from w ww . ja v a 2 s . com builder.sendRequest(null, new RequestCallback() { public void onError(com.google.gwt.http.client.Request request, Throwable ex) { } @SuppressWarnings("unchecked") public void onResponseReceived(com.google.gwt.http.client.Request request, com.google.gwt.http.client.Response response) { if (200 == response.getStatusCode()) { if (Util.checkValidSessionResponse(response.getText())) { try { HashMap<String, String>[] result = (HashMap<String, String>[]) JsonUtil .shoehornJson(JSONParser.parseStrict(response.getText()), "HashMap<String,String>[]"); if (result != null) { if (result.length != 0) { for (int i = 0; i < result.length; i++) { covList.addItem( result[i].get("payer") + " - " + result[i].get("type"), result[i].get("id")); } HashMap<String, String> hm = procsInfoMap.get(proc); hm.put("cov", covList.getStoredValue()); } else { } } } catch (Exception e) { // Window.alert(e.getMessage()); } } } else { } } }); } catch (RequestException e) { Window.alert(e.toString()); } } else { } }
From source file:org.freemedsoftware.gwt.client.widget.RemittBillingWidget.java
License:Open Source License
public void processClaims(ArrayList<String> procIds, ArrayList<String> patientIds) { if (Util.getProgramMode() == ProgramMode.JSONRPC) { // //////////////////// String[] params = { patientIds.toString(), procIds.toString(), "", "1", "1", "1" }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util .getJsonRequest("org.freemedsoftware.module.RemittBillingTransport.ProcessClaims", params))); try {// www. ja va 2 s . c o m builder.sendRequest(null, new RequestCallback() { public void onError(com.google.gwt.http.client.Request request, Throwable ex) { } @SuppressWarnings("unchecked") public void onResponseReceived(com.google.gwt.http.client.Request request, com.google.gwt.http.client.Response response) { if (200 == response.getStatusCode()) { if (Util.checkValidSessionResponse(response.getText())) { try { HashMap<String, String>[] result = (HashMap<String, String>[]) JsonUtil .shoehornJson(JSONParser.parseStrict(response.getText()), "HashMap<String,String>[]"); if (result.length > 0) { showStatus(result); } } catch (Exception e) { // Window.alert(e.getMessage()); } } } else { } } }); } catch (RequestException e) { Window.alert(e.toString()); } } else { } }
From source file:org.freemedsoftware.gwt.client.widget.RemittBillingWidget.java
License:Open Source License
public void rebill() { if (Util.getProgramMode() == ProgramMode.JSONRPC) { // //////////////////// String[] params = { billKeysSet.toString() }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode( Util.getJsonRequest("org.freemedsoftware.module.RemittBillingTransport.rebillkeys", params))); try {/*from ww w. j a va 2s. c o m*/ builder.sendRequest(null, new RequestCallback() { public void onError(com.google.gwt.http.client.Request request, Throwable ex) { } @SuppressWarnings("unchecked") public void onResponseReceived(com.google.gwt.http.client.Request request, com.google.gwt.http.client.Response response) { if (200 == response.getStatusCode()) { if (Util.checkValidSessionResponse(response.getText())) { try { HashMap<String, String>[] result = (HashMap<String, String>[]) JsonUtil .shoehornJson(JSONParser.parseStrict(response.getText()), "HashMap<String,String>[]"); if (result.length > 0) { showStatus(result); } } catch (Exception e) { // Window.alert(e.getMessage()); } } } else { } } }); } catch (RequestException e) { Window.alert(e.toString()); } } else { } }
From source file:org.freemedsoftware.gwt.client.widget.RemittBillingWidget.java
License:Open Source License
public void loadStatus() { if (Util.getProgramMode() == ProgramMode.JSONRPC) { // //////////////////// String[] params = { JsonUtil.jsonify(remittUniqueIds) }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode( Util.getJsonRequest("org.freemedsoftware.module.RemittBillingTransport.GetStatus", params))); try {//from www .j a va 2 s .c o m builder.sendRequest(null, new RequestCallback() { public void onError(com.google.gwt.http.client.Request request, Throwable ex) { } @SuppressWarnings("unchecked") public void onResponseReceived(com.google.gwt.http.client.Request request, com.google.gwt.http.client.Response response) { if (200 == response.getStatusCode()) { if (Util.checkValidSessionResponse(response.getText())) { try { HashMap<String, String> result = (HashMap<String, String>) JsonUtil .shoehornJson(JSONParser.parseStrict(response.getText()), "HashMap<String,String>"); if (result != null) { Iterator<String> iterator = result.keySet().iterator(); boolean isAllCompleted = true; while (iterator.hasNext() && isAllCompleted) { String id = iterator.next(); String item = result.get(id); if (!item.equals("0")) { isAllCompleted = false; } if (fileNamesMap.get(id) == null) { isAllCompleted = false; } } if (isAllCompleted) t.cancel(); for (int i = 0; i < ss.length; i++) { ss[i] = new HashMap<String, String>(); ss[i].put("billkey", billKeys[i]); ss[i].put("result", remittUniqueIds[i]); ss[i].put("target", target[i]); ss[i].put("format", formats[i]); if (result.get(remittUniqueIds[i]) != null) { if (result.get(remittUniqueIds[i]).equals("0")) { ss[i].put("status", "completed"); } else if (result.get(remittUniqueIds[i]).equals("1")) { ss[i].put("status", "validation"); } else if (result.get(remittUniqueIds[i]).equals("2")) { ss[i].put("status", "render"); } else if (result.get(remittUniqueIds[i]).equals("3")) { ss[i].put("status", "translation"); } else if (result.get(remittUniqueIds[i]).equals("4")) { ss[i].put("status", "transmission"); } else if (result.get(remittUniqueIds[i]).equals("5")) { ss[i].put("status", "unknown"); } } else ss[i].put("status", ""); } statusTable.loadData(ss); } } catch (Exception e) { // Window.alert(e.getMessage()); } } } else { } } }); } catch (RequestException e) { Window.alert(e.toString()); } } else { } }
From source file:org.freemedsoftware.gwt.client.widget.RemittBillingWidget.java
License:Open Source License
public void markAsBilled() { final RemittBillingWidget rbw = this; if (Util.getProgramMode() == ProgramMode.JSONRPC) { // //////////////////// String[] params = { JsonUtil.jsonify(billBatches) }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode( Util.getJsonRequest("org.freemedsoftware.module.RemittBillingTransport.MarkAsBilled", params))); try {/*from w w w .jav a2 s .c om*/ builder.sendRequest(null, new RequestCallback() { public void onError(com.google.gwt.http.client.Request request, Throwable ex) { } public void onResponseReceived(com.google.gwt.http.client.Request request, com.google.gwt.http.client.Response response) { if (200 == response.getStatusCode()) { if (Util.checkValidSessionResponse(response.getText())) { try { Boolean result = (Boolean) JsonUtil .shoehornJson(JSONParser.parseStrict(response.getText()), "Boolean"); if (result != null) { if (result) { rbw.removeFromParent(); callback.jsonifiedData("update"); } } } catch (Exception e) { // Window.alert(e.getMessage()); } } } else { } } }); } catch (RequestException e) { Window.alert(e.toString()); } } else { } }
From source file:org.freemedsoftware.gwt.client.widget.RemittBillingWidget.java
License:Open Source License
public void getFileName(final String id) { // final RemittBillingWidget rbw = this; if (Util.getProgramMode() == ProgramMode.JSONRPC) { // //////////////////// String[] params = { "output", "payload", JsonUtil.jsonify(id) }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest("org.freemedsoftware.api.Remitt.GetFileList", params))); try {//from www . j av a 2 s . com builder.sendRequest(null, new RequestCallback() { public void onError(com.google.gwt.http.client.Request request, Throwable ex) { } @SuppressWarnings("unchecked") public void onResponseReceived(com.google.gwt.http.client.Request request, com.google.gwt.http.client.Response response) { if (200 == response.getStatusCode()) { if (Util.checkValidSessionResponse(response.getText())) { try { HashMap<String, String>[] result = (HashMap<String, String>[]) JsonUtil .shoehornJson(JSONParser.parseStrict(response.getText()), "HashMap<String,String>[]"); if (result != null) { for (HashMap<String, String> r : result) { fileNamesMap.put(id, r.get("filename")); } } } catch (Exception e) { // Window.alert(e.getMessage()); } } } else { } } }); } catch (RequestException e) { Window.alert(e.toString()); } } else { } }
From source file:org.freemedsoftware.gwt.client.widget.ReportingWidget.java
License:Open Source License
public void populate(String reportCategory) { if (Util.getProgramMode() == ProgramMode.STUBBED) { // TODO: handle stubbed } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { String[] params = { locale, reportCategory }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest("org.freemedsoftware.module.Reporting.GetReports", params))); try {/*from w ww.j a v a 2s . c om*/ 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) { reportTable.loadData(result); } else { } } else { } } }); } catch (RequestException e) { GWT.log("Exception", e); } } else { getProxy().GetReports(locale, new AsyncCallback<HashMap<String, String>[]>() { public void onSuccess(HashMap<String, String>[] r) { reportTable.loadData(r); } public void onFailure(Throwable t) { GWT.log("Exception", t); } }); } }
From source file:org.freemedsoftware.gwt.client.widget.SupportModuleListBox.java
License:Open Source License
public void loadValues() { if (Util.getProgramMode() == ProgramMode.STUBBED) { listBox.addItem("Item 1", "i1"); } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { listBox.setEnabled(false);/* w ww. j a v a 2s . co m*/ String[] params = { moduleName, "" }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest( "org.freemedsoftware.api.ModuleInterface.ModuleSupportPicklistMethod", params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { JsonUtil.debug("SupportModuleListBox: Error retrieving Data"); listBox.setEnabled(false); } @SuppressWarnings("unchecked") public void onResponseReceived(Request request, Response response) { if (Util.checkValidSessionResponse(response.getText())) { if (200 == response.getStatusCode()) { HashMap<String, String> result = (HashMap<String, String>) JsonUtil.shoehornJson( JSONParser.parseStrict(response.getText()), "HashMap<String,String>"); if (result != null) { Set<String> keys = result.keySet(); Iterator<String> iter = keys.iterator(); while (iter.hasNext()) { final String key = (String) iter.next(); final String val = (String) result.get(key); listBox.addItem(val, key); } } listBox.setEnabled(true); if (holdWidgetValue != null) setWidgetValue(holdWidgetValue); } else { Window.alert(response.toString()); } } } }); } catch (RequestException e) { listBox.setEnabled(true); JsonUtil.debug("Exception in SupportModuleListBox.loadValues; Message:" + e.getMessage()); } } }
From source file:org.freemedsoftware.gwt.client.widget.SupportModuleMultipleChoiceWidget.java
License:Open Source License
public void setValue(Integer[] values) { // In future, need to implement multiple resolve function so we don't // have to make a thousand RPC calls for a thousand entries. - Jeff // Clear current values in the widget clearValues();/*w ww . jav a2 s.c om*/ // Loop through all values given for (int iter = 0; iter < values.length; iter++) { if (Util.getProgramMode() == ProgramMode.STUBBED) { addValue("Value " + new Integer(iter).toString(), new Integer(iter)); } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { final Integer i = new Integer(values[iter]); String[] params = { module, JsonUtil.jsonify(i) }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode( Util.getJsonRequest("org.freemedsoftware.api.ModuleInterface.ModuleToTextMethod", params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(com.google.gwt.http.client.Request request, Throwable ex) { GWT.log("Exception", ex); } public void onResponseReceived(com.google.gwt.http.client.Request request, com.google.gwt.http.client.Response response) { if (200 == response.getStatusCode()) { String result = (String) JsonUtil .shoehornJson(JSONParser.parseStrict(response.getText()), "String"); if (result != null) { addValue(result, i); } } else { GWT.log(response.toString(), null); } } }); } catch (RequestException e) { GWT.log("Exception", e); } } else { ModuleInterfaceAsync service = null; try { service = ((ModuleInterfaceAsync) Util .getProxy("org.freemedsoftware.gwt.client.Api.ModuleInterface")); } catch (Exception e) { } final Integer i = new Integer(values[iter]); service.ModuleToTextMethod(module, i, new AsyncCallback<String>() { public void onSuccess(String textual) { addValue(textual, i); } public void onFailure(Throwable t) { } }); } } }
From source file:org.freemedsoftware.gwt.client.widget.SupportModuleWidget.java
License:Open Source License
/** * Set value of current widget based on integer value, asynchronously. * // w ww . j a va 2s. co m * @param widgetValue */ public void setValue(Integer widgetValue) { value = widgetValue; if (Util.getProgramMode() == ProgramMode.STUBBED) { searchBox.setText("Stub Value"); searchBox.setTitle("Stub Value"); } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { if (widgetValue.compareTo(0) == 0) { searchBox.setText(""); searchBox.setTitle(""); } else { // textBox.setEnabled(false); String[] params = { moduleName, widgetValue.toString() }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode( Util.getJsonRequest("org.freemedsoftware.api.ModuleInterface.ModuleToTextMethod", params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(com.google.gwt.http.client.Request request, Throwable ex) { textBox.setEnabled(true); } public void onResponseReceived(com.google.gwt.http.client.Request request, com.google.gwt.http.client.Response response) { if (Util.checkValidSessionResponse(response.getText())) { if (200 == response.getStatusCode()) { String result = (String) JsonUtil .shoehornJson(JSONParser.parseStrict(response.getText()), "String"); // textBox.setEnabled(true); if (result != null) { searchBox.setText(result); searchBox.setTitle(result); if (callback != null) { callback.jsonifiedData("done"); } } } else { Window.alert(response.toString()); } } } }); } catch (RequestException e) { textBox.setEnabled(true); } } } else { ModuleInterfaceAsync service = null; try { service = ((ModuleInterfaceAsync) Util .getProxy("org.freemedsoftware.gwt.client.Api.ModuleInterface")); } catch (Exception e) { } textBox.setEnabled(false); service.ModuleToTextMethod(moduleName, widgetValue, new AsyncCallback<String>() { public void onSuccess(String textual) { textBox.setEnabled(true); searchBox.setText(textual); searchBox.setTitle(textual); } public void onFailure(Throwable t) { } }); } }