[isidorus-cvs] r889 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base isidorus

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Tue Sep 13 10:53:22 UTC 2011


Author: lgiessmann
Date: Tue Sep 13 03:53:22 2011
New Revision: 889

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/base/Utils.java
   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/base/Utils.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/Utils.java	Tue Sep 13 03:48:13 2011	(r888)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/Utils.java	Tue Sep 13 03:53:22 2011	(r889)
@@ -12,6 +12,25 @@
 
 public class Utils {
 	
+	// returns an array with two string objects.
+	//  * the first element is the uri prefix until the last "/" or "#" character
+	//  * the second element is the sufix
+	public static String[] splitUriByLastFragment(String uri) {
+		if(uri == null) return new String[]{null, null};
+		
+		int idxSlash = uri.lastIndexOf("/");
+		int idxSharp = uri.lastIndexOf("#");
+		int lastPos = idxSlash < idxSharp ? idxSharp : idxSlash;
+		if(lastPos <= 0) return new String[]{uri, null}; 
+		
+		String prefix = uri.substring(0, lastPos + 1);
+		String suffix = uri.substring(lastPos);
+		suffix = suffix == null ? "" : suffix;
+
+		return new String[]{prefix, suffix};
+	}
+	
+	
 	// returns a string of the form:
 	// {
 	// association-type: psi

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:48:13 2011	(r888)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.java	Tue Sep 13 03:53:22 2011	(r889)
@@ -248,6 +248,7 @@
 					JSONArray jParents = new JSONArray();
 					jParents.set(0, new JSONString("pref_2:" + tmPsi[1]));
 					delTop.put("parent", jParents);
+					delObj.put("delete", delTop);
 					
 					Window.alert(">>\n" + delObj.toString());
 					




More information about the Isidorus-cvs mailing list