incubator-wookie-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scot...@apache.org
Subject svn commit: r1161090 - in /incubator/wookie/trunk/src/org/apache/wookie: beans/jpa/JPAPersistenceManager.java controller/ParticipantsController.java feature/ext/WookieAPIImpl.java helpers/Notifier.java util/SiblingPageNormalizer.java
Date Wed, 24 Aug 2011 13:20:33 GMT
Author: scottbw
Date: Wed Aug 24 13:20:33 2011
New Revision: 1161090

URL: http://svn.apache.org/viewvc?rev=1161090&view=rev
Log:
Replaced all direct access to WidgetInstance.getSharedDataKey with calls to the SharedDataHelper
facade. This should eventually make it easier to  address WOOKIE-214 if it involves altering
the internal shared data key format.

Modified:
    incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/JPAPersistenceManager.java
    incubator/wookie/trunk/src/org/apache/wookie/controller/ParticipantsController.java
    incubator/wookie/trunk/src/org/apache/wookie/feature/ext/WookieAPIImpl.java
    incubator/wookie/trunk/src/org/apache/wookie/helpers/Notifier.java
    incubator/wookie/trunk/src/org/apache/wookie/util/SiblingPageNormalizer.java

Modified: incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/JPAPersistenceManager.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/JPAPersistenceManager.java?rev=1161090&r1=1161089&r2=1161090&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/JPAPersistenceManager.java (original)
+++ incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/JPAPersistenceManager.java Wed
Aug 24 13:20:33 2011
@@ -92,6 +92,7 @@ import org.apache.wookie.beans.jpa.impl.
 import org.apache.wookie.beans.jpa.impl.WidgetTypeImpl;
 import org.apache.wookie.beans.util.IPersistenceManager;
 import org.apache.wookie.beans.util.PersistenceCommitException;
+import org.apache.wookie.helpers.SharedDataHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -682,7 +683,7 @@ public class JPAPersistenceManager imple
         {
             try
             {
-                String sharedDataKey = widgetInstance.getSharedDataKey();
+                String sharedDataKey = SharedDataHelper.getInternalSharedDataKey(widgetInstance);
                 Query query = entityManager.createNamedQuery("PARTICIPANTS");
                 query.setParameter("sharedDataKey", sharedDataKey);
                 List<IParticipant> participantsList = query.getResultList();
@@ -715,7 +716,7 @@ public class JPAPersistenceManager imple
         {
             try
             {
-                String sharedDataKey = widgetInstance.getSharedDataKey();
+                String sharedDataKey = SharedDataHelper.getInternalSharedDataKey(widgetInstance);
                 String userId = widgetInstance.getUserId();
                 Query query = entityManager.createNamedQuery("PARTICIPANT_VIEWER");
                 query.setParameter("sharedDataKey", sharedDataKey);

Modified: incubator/wookie/trunk/src/org/apache/wookie/controller/ParticipantsController.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/controller/ParticipantsController.java?rev=1161090&r1=1161089&r2=1161090&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/controller/ParticipantsController.java (original)
+++ incubator/wookie/trunk/src/org/apache/wookie/controller/ParticipantsController.java Wed
Aug 24 13:20:33 2011
@@ -34,6 +34,7 @@ import org.apache.wookie.exceptions.Reso
 import org.apache.wookie.exceptions.UnauthorizedAccessException;
 import org.apache.wookie.helpers.Notifier;
 import org.apache.wookie.helpers.ParticipantHelper;
+import org.apache.wookie.helpers.SharedDataHelper;
 import org.apache.wookie.helpers.WidgetKeyManager;
 
 /**
@@ -163,7 +164,7 @@ public class ParticipantsController exte
 		// Does participant already exist?
         IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
 		Map<String, Object> map = new HashMap<String, Object>();
-		map.put("sharedDataKey", instance.getSharedDataKey());//$NON-NLS-1$
+		map.put("sharedDataKey", SharedDataHelper.getInternalSharedDataKey(instance));//$NON-NLS-1$
 		map.put("participantId", participantId);//$NON-NLS-1$
 		if (persistenceManager.findByValues(IParticipant.class, map).length != 0) return false;
	
 
@@ -172,7 +173,7 @@ public class ParticipantsController exte
 		participant.setParticipantId(participantId);
 		participant.setParticipantDisplayName(participantDisplayName);
 		participant.setParticipantThumbnailUrl(participantThumbnailUrl);
-		participant.setSharedDataKey(instance.getSharedDataKey());
+		participant.setSharedDataKey(SharedDataHelper.getInternalSharedDataKey(instance));
 		persistenceManager.save(participant);
 		return true;
 	}
@@ -189,7 +190,7 @@ public class ParticipantsController exte
 		// Does participant exist?
         IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
 		Map<String, Object> map = new HashMap<String, Object>();
-		map.put("sharedDataKey", instance.getSharedDataKey());//$NON-NLS-1$
+		map.put("sharedDataKey", SharedDataHelper.getInternalSharedDataKey(instance));//$NON-NLS-1$
 		map.put("participantId", participantId);//$NON-NLS-1$
 		participants = persistenceManager.findByValues(IParticipant.class, map);
 		if (participants.length != 1) return false;	

Modified: incubator/wookie/trunk/src/org/apache/wookie/feature/ext/WookieAPIImpl.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/feature/ext/WookieAPIImpl.java?rev=1161090&r1=1161089&r2=1161090&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/feature/ext/WookieAPIImpl.java (original)
+++ incubator/wookie/trunk/src/org/apache/wookie/feature/ext/WookieAPIImpl.java Wed Aug 24
13:20:33 2011
@@ -103,7 +103,7 @@ public class WookieAPIImpl implements IW
     if(widgetInstance == null) return localizedMessages.getString("WidgetAPIImpl.0");
     if(widgetInstance.isLocked()) return localizedMessages.getString("WidgetAPIImpl.2");
     if(ContextListener.useSharedDataInstanceQueues){//  
-      QueueManager.getInstance().queueSetSharedDataRequest(id_key, widgetInstance.getSharedDataKey(),
key, value, false);
+      QueueManager.getInstance().queueSetSharedDataRequest(id_key, SharedDataHelper.getInternalSharedDataKey(widgetInstance),
key, value, false);
     }
     else{
       PropertiesController.updateSharedDataEntry(widgetInstance, key, value, false);
@@ -123,7 +123,7 @@ public class WookieAPIImpl implements IW
         IWidgetInstance widgetInstance = persistenceManager.findWidgetInstanceByIdKey(id_key);
     if(widgetInstance == null) return localizedMessages.getString("WidgetAPIImpl.0");
     //
-    String sharedDataKey = widgetInstance.getSharedDataKey();
+    String sharedDataKey = SharedDataHelper.getInternalSharedDataKey(widgetInstance);
     WidgetInstancesController.lockWidgetInstance(widgetInstance);
     Notifier.callSiblings(widgetInstance,"Widget.onLocked(\""+sharedDataKey+"\");");//$NON-NLS-1$
         return "okay"; //$NON-NLS-1$
@@ -140,7 +140,7 @@ public class WookieAPIImpl implements IW
         IWidgetInstance widgetInstance = persistenceManager.findWidgetInstanceByIdKey(id_key);
     if(widgetInstance==null) return localizedMessages.getString("WidgetAPIImpl.0");
     //
-    String sharedDataKey = widgetInstance.getSharedDataKey();
+    String sharedDataKey = SharedDataHelper.getInternalSharedDataKey(widgetInstance);
     WidgetInstancesController.unlockWidgetInstance(widgetInstance);
     Notifier.callSiblings(widgetInstance,"Widget.onUnlocked(\""+sharedDataKey+"\");");//$NON-NLS-1$
         return "okay"; //$NON-NLS-1$
@@ -207,7 +207,7 @@ public class WookieAPIImpl implements IW
     if(widgetInstance == null) return localizedMessages.getString("WidgetAPIImpl.0");
     if(widgetInstance.isLocked()) return localizedMessages.getString("WidgetAPIImpl.2");
     if(ContextListener.useSharedDataInstanceQueues){//
-      QueueManager.getInstance().queueSetSharedDataRequest(id_key, widgetInstance.getSharedDataKey(),
key, value, true);
+      QueueManager.getInstance().queueSetSharedDataRequest(id_key, SharedDataHelper.getInternalSharedDataKey(widgetInstance),
key, value, true);
     }
     else{
       PropertiesController.updateSharedDataEntry(widgetInstance, key, value, true);

Modified: incubator/wookie/trunk/src/org/apache/wookie/helpers/Notifier.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/helpers/Notifier.java?rev=1161090&r1=1161089&r2=1161090&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/helpers/Notifier.java (original)
+++ incubator/wookie/trunk/src/org/apache/wookie/helpers/Notifier.java Wed Aug 24 13:20:33
2011
@@ -59,7 +59,7 @@ public class Notifier {
 	 * @param widgetInstance the instance that is the source of the update
 	 */
 	public static void notifySiblings(IWidgetInstance widgetInstance){
-		String sharedDataKey = widgetInstance.getSharedDataKey();
+		String sharedDataKey = SharedDataHelper.getInternalSharedDataKey(widgetInstance);
 		String script = "Widget.onSharedUpdate(\""+sharedDataKey+"\");"; //$NON-NLS-1$ //$NON-NLS-2$
 		callSiblings(widgetInstance,script);
 	}

Modified: incubator/wookie/trunk/src/org/apache/wookie/util/SiblingPageNormalizer.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/util/SiblingPageNormalizer.java?rev=1161090&r1=1161089&r2=1161090&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/util/SiblingPageNormalizer.java (original)
+++ incubator/wookie/trunk/src/org/apache/wookie/util/SiblingPageNormalizer.java Wed Aug 24
13:20:33 2011
@@ -18,6 +18,7 @@ import java.util.HashMap;
 import org.apache.wookie.beans.IWidgetInstance;
 import org.apache.wookie.beans.util.IPersistenceManager;
 import org.apache.wookie.beans.util.PersistenceManagerFactory;
+import org.apache.wookie.helpers.SharedDataHelper;
 import org.directwebremoting.impl.DefaultPageNormalizer;
 
 /**
@@ -43,7 +44,7 @@ org.directwebremoting.extend.PageNormali
 	 * @return the normalized URI of the widget instance
 	 */
 	public String getNormalizedPage(IWidgetInstance instance){
-		return super.normalizePage(instance.getWidget().getUrl())+"?"+instance.getApiKey()+"="+instance.getSharedDataKey();
+		return super.normalizePage(instance.getWidget().getUrl())+"?"+instance.getApiKey()+"="+SharedDataHelper.getInternalSharedDataKey(instance);
 	}
 
 	/**
@@ -73,7 +74,7 @@ org.directwebremoting.extend.PageNormali
 		// Strip off query and add on API key and shared data key
 		setNormalizeIncludesQueryString(false);
 		page = super.normalizePage(page);
-		page += "?"+widgetInstance.getApiKey()+"="+widgetInstance.getSharedDataKey();
+		page += "?"+widgetInstance.getApiKey()+"="+SharedDataHelper.getInternalSharedDataKey(widgetInstance);
 		setNormalizeIncludesQueryString(true);
 		return page;
 	}



Mime
View raw message