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

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Mon Sep 12 16:30:55 UTC 2011


Author: lgiessmann
Date: Mon Sep 12 09:30:54 2011
New Revision: 876

Log:
gdl-frontend: Widgets: changed the behavior of the commit callback => old psis

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/IsidorusConstants.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	Mon Sep 12 06:17:58 2011	(r875)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.java	Mon Sep 12 09:30:54 2011	(r876)
@@ -45,11 +45,22 @@
 				this.commitCreatedEnvironment(constructs, tmEngine);
 			}
 		}catch(Exception e){
+			e.printStackTrace();
 			Window.alert("failed to commit the Topic Maps data, because: " + e.getMessage());
 		}
 	}
 	
 	
+	// remove all psis from the passed topic
+	private void removeSubjectIdentifiers(Topic top){
+		if(top == null) return;
+		JsArray<Locator> psis = top.getSubjectIdentifiers();
+		ArrayList<Locator> jPsis = new ArrayList<Locator>();
+		for(int i = 0; i != psis.length(); ++i)jPsis.add(psis.get(i));
+		for (Locator jPsi : jPsis)top.removeSubjectIdentifier(jPsi);
+	}
+	
+	
 	private void commitCreatedEnvironment(ArrayList<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmEngine) throws ExporterException {
 		final String carrierPsi = PSIs.GDL.gdl + "environment_default_creator_topic_view_id";
 		ArrayList<Topic> topics = new ArrayList<Topic>();
@@ -77,13 +88,11 @@
 		
 		if(top != null){
 			// remove old psis
-			JsArray<Locator> psis = top.getSubjectIdentifiers();
-			for(int i = 0; i != psis.length(); ++i)top.removeSubjectIdentifier(psis.get(i));
+			this.removeSubjectIdentifiers(top);
 			
-			// set the new vaid psi
+			// set the new valid psi
 			Name envName = top.getNames().get(0);
 			Locator psi = tm.createLocator("http://textgrid.org/serviceregistry/environment/" + envName.getValue());
-			top.removeSubjectIdentifier(carrierLocator);
 			top.addSubjectIdentifier(psi);
 		}
 		
@@ -101,6 +110,7 @@
 			// since it would be exactly the same topic.
 			builder.sendRequest(jtm, new EnvironmentCommitRequest(jtm));
 		}catch(RequestException e){
+			e.printStackTrace();
 			Window.alert("could not commit the topic: " + jtm + ", because(" + e.getClass() + "): " + e.getMessage());
 		}
 	}
@@ -151,7 +161,7 @@
 			Name env = assoc.getRoles(TmHelper.getTopicByPsi("http://textgrid.org/serviceregistry/model/environment", tm)).get(0).getPlayer().getNames().get(0);
 			Occurrence key = top.getOccurrences(TmHelper.getTopicByPsi("http://textgrid.org/serviceregistry/model/key", tm)).get(0);
 			Locator psi = tm.createLocator("http://textgrid.org/serviceregistry/hash-object/" + env.getValue() + "/" + key.getValue());
-			top.removeSubjectIdentifier(carrierLocator);
+			this.removeSubjectIdentifiers(top);
 			top.addSubjectIdentifier(psi);
 		
 			String jtm = null;

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/IsidorusConstants.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/IsidorusConstants.java	Mon Sep 12 06:17:58 2011	(r875)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/IsidorusConstants.java	Mon Sep 12 09:30:54 2011	(r876)
@@ -1,6 +1,7 @@
 package us.isidor.gdl.anaToMia.Widgets.isidorus;
 
 
+import com.google.gwt.core.client.GWT;
 import com.google.gwt.user.client.Window;
 
 
@@ -8,6 +9,6 @@
 	public final static String DELETE_REQUEST_URL = Window.Location.getProtocol() + "//" + Window.Location.getHost() + "/gdl/delete";
 	public final static String COMMIT_REQUEST_URL = Window.Location.getProtocol() + "//" + Window.Location.getHost() + "/gdl/commit";
 	public final static String GET_FRAGMENT_REQUEST_URL = Window.Location.getProtocol() + "//" + Window.Location.getHost() + "/gdl/fragment/";
-	public final static String GET_SCHEMA_REQUEST_URL = Window.Location.getProtocol() + "//" + Window.Location.getHost() + "/gdl/schema";
-	//public final static String GET_SCHEMA_REQUEST_URL = GWT.getModuleBaseURL() + "TextGrid_ServiceRegistry_required_TMCL_and_GDL_Schema_with_test_data.jtm";
+	//public final static String GET_SCHEMA_REQUEST_URL = Window.Location.getProtocol() + "//" + Window.Location.getHost() + "/gdl/schema";
+	public final static String GET_SCHEMA_REQUEST_URL = GWT.getModuleBaseURL() + "TextGrid_ServiceRegistry_required_TMCL_and_GDL_Schema_with_test_data.jtm";
 }




More information about the Isidorus-cvs mailing list