[isidorus-cvs] r888 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Tue Sep 13 10:48:14 UTC 2011


Author: lgiessmann
Date: Tue Sep 13 03:48:13 2011
New Revision: 888

Log:
gdl-frontend: Widgets: fixed a bug when creating delete requests to update http://textgrid.org/serivceregistry/model/types/Hash-Object

Modified:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.java

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.java	Tue Sep 13 03:21:42 2011	(r887)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.java	Tue Sep 13 03:48:13 2011	(r888)
@@ -3,6 +3,7 @@
 import java.util.ArrayList;
 import us.isidor.gdl.anaToMia.Widgets.base.PSIs;
 import us.isidor.gdl.anaToMia.Widgets.base.TmHelper;
+import us.isidor.gdl.anaToMia.Widgets.base.Utils;
 import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
 import com.google.gwt.core.client.JsArray;
 import com.google.gwt.http.client.Request;
@@ -11,6 +12,9 @@
 import com.google.gwt.http.client.RequestException;
 import com.google.gwt.http.client.Response;
 import com.google.gwt.http.client.URL;
+import com.google.gwt.json.client.JSONArray;
+import com.google.gwt.json.client.JSONObject;
+import com.google.gwt.json.client.JSONString;
 import com.google.gwt.user.client.Window;
 import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.ExporterException;
 import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine;
@@ -172,7 +176,6 @@
 			String getUrl = URL.encode(this.GET_REQUEST_URL + psiValue);
 			RequestBuilder getBuilder = new RequestBuilder(RequestBuilder.GET, getUrl);
 			try{
-				Window.alert("edited: " + edited);
 				getBuilder.sendRequest(null, new HashObjectCheckRequest(jtm, psiValue, edited));
 			}catch(RequestException e){
 				Window.alert("could not commit the topic: " + jtm + ", because(" + e.getClass() + "): " + e.getMessage());
@@ -229,13 +232,31 @@
 		public void onResponseReceived(Request request, Response response) {
 			if (200 == response.getStatusCode()) {
 				if(edited){
-					String delObj = response.getText();
+					String[] topPsi = Utils.splitUriByLastFragment(psi);
+					String[] tmPsi = Utils.splitUriByLastFragment(IsidorusConstants.TOPIC_MAP_IDENTIFIER);
+					
+					JSONObject delObj = new JSONObject();
+					delObj.put("type", new JSONString("Topic"));
+					JSONObject prefs = new JSONObject();
+					prefs.put("pref_1", new JSONString(topPsi[0]));
+					prefs.put("pref_2", new JSONString(tmPsi[0]));
+					JSONObject delTop = new JSONObject();
+					delTop.put("prefixes", prefs);
+					JSONArray jPsis = new JSONArray();
+					jPsis.set(0, new JSONString("pref_1:" + topPsi[1]));
+					delTop.put("subject_identifiers", jPsis);
+					JSONArray jParents = new JSONArray();
+					jParents.set(0, new JSONString("pref_2:" + tmPsi[1]));
+					delTop.put("parent", jParents);
+					
+					Window.alert(">>\n" + delObj.toString());
+					
 					try{
 						String url = URL.encode(CommitCallback.this.DELETE_REUQEST_URL);
 						RequestBuilder builder = new RequestBuilder(RequestBuilder.DELETE, url);
 						builder.setHeader("Content-type", "application/json");
 						
-						builder.sendRequest(delObj, new HashObjectDeleteRequest(delObj, this.objectToBeSend));						
+						builder.sendRequest(delObj.toString(), new HashObjectDeleteRequest(delObj.toString(), this.objectToBeSend));						
 					}catch(RequestException e){
 						Window.alert("could not update the topic " + delObj);
 						//TODO: reset page




More information about the Isidorus-cvs mailing list