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.widget.PrescriptionRefillBox.java
License:Open Source License
public void retrieveData() { if (Util.getProgramMode() == ProgramMode.STUBBED) { // Runs in STUBBED MODE => Feed with Sample Data // HashMap<String, String>[] sampleData = getSampleData(); // loadData(sampleData); } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { wRequests.showloading(true);//from w ww.j ava 2 s .co m // Use JSON-RPC to retrieve the data String[] requestparams = {}; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode( Util.getJsonRequest("org.freemedsoftware.module.RxRefillRequest.GetAll", requestparams))); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { JsonUtil.debug(request.toString()); } @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) { loadData(data); } else wRequests.showloading(false); } } }); } 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.widget.ProviderWidget.java
License:Open Source License
protected void loadSuggestions(String req, final Request r, final Callback cb) { if (req.length() < CurrentState.getMinCharCountForSmartSearch()) return;//from w ww .jav a 2 s . c om if (Util.getProgramMode() == ProgramMode.STUBBED) { // Handle in a stubbed sort of way List<SuggestOracle.Suggestion> items = new ArrayList<SuggestOracle.Suggestion>(); map.clear(); addKeyValuePair(items, new String("Hackenbush, Hugo Z"), new String("1")); addKeyValuePair(items, new String("Firefly, Rufus T"), new String("2")); cb.onSuggestionsReady(r, new SuggestOracle.Response(items)); } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { String[] params = { req, new Integer(20).toString() }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode( Util.getJsonRequest("org.freemedsoftware.module.ProviderModule.InternalPicklist", params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(com.google.gwt.http.client.Request request, Throwable ex) { Window.alert(ex.toString()); } @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())) { HashMap<Integer, String> result = (HashMap<Integer, String>) JsonUtil.shoehornJson( JSONParser.parseStrict(response.getText()), "HashMap<Integer,String>"); if (result != null) { Set<Integer> keys = result.keySet(); Iterator<Integer> iter = keys.iterator(); List<SuggestOracle.Suggestion> items = new ArrayList<SuggestOracle.Suggestion>(); map.clear(); while (iter.hasNext()) { Integer keyInt = (Integer) iter.next(); String key = keyInt.toString(); String val = (String) result.get(keyInt); addKeyValuePair(items, val, key); } cb.onSuggestionsReady(r, new SuggestOracle.Response(items)); } } } else { Window.alert(response.toString()); } } }); } catch (RequestException e) { Window.alert(e.toString()); } } else { // TODO normal mode code goes here } }
From source file:org.freemedsoftware.gwt.client.widget.ProviderWidget.java
License:Open Source License
@Override public void getTextForValue(Integer val) { if (val > 0) { if (Util.getProgramMode() == ProgramMode.STUBBED) { searchBox.setText("Hackenbush, Hugo Z (STUB)"); } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { // textBox.setEnabled(false); String[] params = { val.toString() }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL .encode(Util.getJsonRequest("org.freemedsoftware.module.ProviderModule.To_Text", params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(com.google.gwt.http.client.Request request, Throwable ex) { // textBox.setEnabled(true); Window.alert(ex.toString()); }//from w w w .j a v a 2s . c o m public void onResponseReceived(com.google.gwt.http.client.Request request, com.google.gwt.http.client.Response response) { // textBox.setEnabled(true); if (Util.checkValidSessionResponse(response.getText())) { if (200 == response.getStatusCode()) { String result = (String) JsonUtil .shoehornJson(JSONParser.parseStrict(response.getText()), "String"); if (result != null) { searchBox.setText(result); } } else { Window.alert(response.toString()); } } } }); } catch (RequestException e) { // textBox.setEnabled(true); Window.alert(e.toString()); } } else { // TODO normal mode code goes here } } }
From source file:org.freemedsoftware.gwt.client.widget.RecentAllergiesList.java
License:Open Source License
@SuppressWarnings("unchecked") protected void populate() { if (Util.getProgramMode() == ProgramMode.STUBBED) { allergiesTable.clearData();/*w ww.j a v a 2 s.c o m*/ List<HashMap<String, String>> results = new ArrayList<HashMap<String, String>>(); { HashMap<String, String> item1 = new HashMap<String, String>(); item1.put("allergy", "Penicillin"); item1.put("reaction", "Swelling"); item1.put("severity", "Moderate"); results.add(item1); } { HashMap<String, String> item2 = new HashMap<String, String>(); item2.put("allergy", "Bee Stings"); item2.put("reaction", "Swelling"); item2.put("severity", "Severe"); results.add(item2); } { HashMap<String, String> item3 = new HashMap<String, String>(); item3.put("allergy", "Avocado"); item3.put("reaction", "Hives"); item3.put("severity", "Moderate"); results.add(item3); } allergiesTable.loadData(results.toArray((HashMap<String, String>[]) new HashMap<?, ?>[0])); } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { String[] params = { JsonUtil.jsonify(patientId) }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest("org.freemedsoftware.module.Allergies.GetMostRecent", params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { HashMap<String, String>[] r = (HashMap<String, String>[]) JsonUtil.shoehornJson( JSONParser.parseStrict(response.getText()), "HashMap<String,String>[]"); if (r != null) { allergiesTable.clearData(); try { allergiesTable.loadData(r); } catch (Exception e) { GWT.log("Exception", e); } } } else { } } }); } catch (RequestException e) { } } else { getProxy().GetMostRecent(patientId, new AsyncCallback<HashMap<String, String>[]>() { public void onSuccess(HashMap<String, String>[] m) { allergiesTable.clearData(); try { allergiesTable.loadData(m); } catch (Exception e) { GWT.log("Exception", e); } } public void onFailure(Throwable t) { GWT.log("Exception", t); } }); } }
From source file:org.freemedsoftware.gwt.client.widget.RecentMedicationsList.java
License:Open Source License
@SuppressWarnings("unchecked") protected void populate() { if (Util.getProgramMode() == ProgramMode.STUBBED) { medicationsTable.clearData();/*from ww w . j a va 2 s .c o m*/ List<HashMap<String, String>> results = new ArrayList<HashMap<String, String>>(); { HashMap<String, String> item1 = new HashMap<String, String>(); item1.put("mdrug", "Doxycycline"); item1.put("mdosage", "100mg"); item1.put("mroute", "Tablet"); item1.put("minterval", "BID"); item1.put("prescriber", "Hackenbush, Hugo Z"); results.add(item1); } { HashMap<String, String> item2 = new HashMap<String, String>(); item2.put("mdrug", "Keflex"); item2.put("mdosage", "50mg"); item2.put("mroute", "Capsule"); item2.put("minterval", "BID"); item2.put("prescriber", "Hackenbush, Hugo Z"); results.add(item2); } { HashMap<String, String> item3 = new HashMap<String, String>(); item3.put("mdrug", "Feldene"); item3.put("mdosage", "75mg"); item3.put("mroute", "Tablet"); item3.put("minterval", "BID"); item3.put("prescriber", "Hackenbush, Hugo Z"); results.add(item3); } medicationsTable.loadData(results.toArray((HashMap<String, String>[]) new HashMap<?, ?>[0])); } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { String[] params = { JsonUtil.jsonify(patientId) }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode( Util.getJsonRequest("org.freemedsoftware.api.ModuleInterface.ModuleAddMethod", params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { HashMap<String, String>[] r = (HashMap<String, String>[]) JsonUtil.shoehornJson( JSONParser.parseStrict(response.getText()), "HashMap<String,String>[]"); if (r != null) { medicationsTable.clearData(); try { medicationsTable.loadData(r); } catch (Exception e) { GWT.log("Exception", e); } } else { medicationsTable.noItemFound.setVisible(true); } } else { } } }); } catch (RequestException e) { } } else { getProxy().GetMostRecent(patientId, new AsyncCallback<HashMap<String, String>[]>() { public void onSuccess(HashMap<String, String>[] m) { medicationsTable.clearData(); try { medicationsTable.loadData(m); } catch (Exception e) { GWT.log("Exception", e); } } public void onFailure(Throwable t) { GWT.log("Exception", t); } }); } }
From source file:org.freemedsoftware.gwt.client.widget.RemittBillingWidget.java
License:Open Source License
public void loadSelectedProcedureInfo() { if (Util.getProgramMode() == ProgramMode.STUBBED) { } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { String[] params = { procs.toString() }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest("org.freemedsoftware.api.ClaimLog.getProceduresInfo", params))); try {//from w ww . j a va 2 s .c o m builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { Window.alert(ex.toString()); } @SuppressWarnings("unchecked") public void onResponseReceived(Request request, Response response) { if (Util.checkValidSessionResponse(response.getText())) { if (200 == response.getStatusCode()) { 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++) { HashMap<String, String> hm = new HashMap<String, String>(); procsInfoMap.put(result[i].get("id"), hm); } claimsTable.loadData(result); } } } catch (Exception e) { } } 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 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 w w . jav a 2s .c om 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 {/*from w w w . j av a 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 w w w . j a v a2s . 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 w ww. j ava 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 != 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 { } }