r7245 - in dumbhippo/trunk: openfire/src/plugins/hippo/src/java/com/dumbhippo/jive openfire/src/plugins/hippo/src/java/com/dumbhippo/jive/annotations server/src/com/dumbhippo/server/impl
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r7245 - in dumbhippo/trunk: openfire/src/plugins/hippo/src/java/com/dumbhippo/jive openfire/src/plugins/hippo/src/java/com/dumbhippo/jive/annotations server/src/com/dumbhippo/server/impl
- Date: Mon, 21 Jan 2008 17:25:23 -0600 (CST)
Author: otaylor
Date: 2008-01-21 17:25:15 -0600 (Mon, 21 Jan 2008)
New Revision: 7245
Modified:
dumbhippo/trunk/openfire/src/plugins/hippo/src/java/com/dumbhippo/jive/AnnotatedIQMethod.java
dumbhippo/trunk/openfire/src/plugins/hippo/src/java/com/dumbhippo/jive/LegacyBlocksIQHandler.java
dumbhippo/trunk/openfire/src/plugins/hippo/src/java/com/dumbhippo/jive/annotations/IQMethod.java
dumbhippo/trunk/server/src/com/dumbhippo/server/impl/StackerBean.java
Log:
* Allow an IQ handler to force a read-write session for get IQ methods
* Force a ReadWrite transaction for the legacy getBlocks IQ
* Don't notify about changes to the stacker filter when we aren't changing it
Modified: dumbhippo/trunk/openfire/src/plugins/hippo/src/java/com/dumbhippo/jive/AnnotatedIQMethod.java
===================================================================
--- dumbhippo/trunk/openfire/src/plugins/hippo/src/java/com/dumbhippo/jive/AnnotatedIQMethod.java 2008-01-21 22:56:36 UTC (rev 7244)
+++ dumbhippo/trunk/openfire/src/plugins/hippo/src/java/com/dumbhippo/jive/AnnotatedIQMethod.java 2008-01-21 23:25:15 UTC (rev 7245)
@@ -88,7 +88,7 @@
DataModel model = DataService.getModel();
DMSession session;
- if (annotation.type() == IQ.Type.get)
+ if (annotation.type() == IQ.Type.get && !annotation.forceReadWrite())
session = model.initializeReadOnlySession(client);
else
session = model.initializeReadWriteSession(client);
Modified: dumbhippo/trunk/openfire/src/plugins/hippo/src/java/com/dumbhippo/jive/LegacyBlocksIQHandler.java
===================================================================
--- dumbhippo/trunk/openfire/src/plugins/hippo/src/java/com/dumbhippo/jive/LegacyBlocksIQHandler.java 2008-01-21 22:56:36 UTC (rev 7244)
+++ dumbhippo/trunk/openfire/src/plugins/hippo/src/java/com/dumbhippo/jive/LegacyBlocksIQHandler.java 2008-01-21 23:25:15 UTC (rev 7245)
@@ -65,7 +65,9 @@
throw IQException.createBadRequest("Unrecognized boolean value '" + value + "'");
}
- @IQMethod(name="blocks", type=IQ.Type.get)
+ // The method both gets the current blocks and stores the new filter, so we need
+ // to force a readwrite session
+ @IQMethod(name="blocks", type=IQ.Type.get, forceReadWrite=true)
public void getBlocks(UserViewpoint viewpoint, IQ request, IQ reply) throws IQException {
Element child = request.getChildElement();
Modified: dumbhippo/trunk/openfire/src/plugins/hippo/src/java/com/dumbhippo/jive/annotations/IQMethod.java
===================================================================
--- dumbhippo/trunk/openfire/src/plugins/hippo/src/java/com/dumbhippo/jive/annotations/IQMethod.java 2008-01-21 22:56:36 UTC (rev 7244)
+++ dumbhippo/trunk/openfire/src/plugins/hippo/src/java/com/dumbhippo/jive/annotations/IQMethod.java 2008-01-21 23:25:15 UTC (rev 7245)
@@ -33,4 +33,10 @@
* of the IQ
*/
public boolean needsTransaction() default true;
+
+ /**
+ * @return if true, create a ReadWrite transaction even for a get method
+ * (don't use this except for compatibility with broken interfaces)
+ */
+ public boolean forceReadWrite() default true;
}
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/StackerBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/StackerBean.java 2008-01-21 22:56:36 UTC (rev 7244)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/StackerBean.java 2008-01-21 23:25:15 UTC (rev 7245)
@@ -2264,7 +2264,12 @@
}
public void setUserStackFilterPrefs(User user, String filter) {
- user.getAccount().setStackFilter(filter);
- DataService.currentSessionRW().changed(UserDMO.class, user.getGuid(), "stackFilter");
+ String oldFilter = getUserStackFilterPrefs(user);
+ if ((filter == null && oldFilter != null) ||
+ (filter != null && !filter.equals(oldFilter)))
+ {
+ user.getAccount().setStackFilter(filter);
+ DataService.currentSessionRW().changed(UserDMO.class, user.getGuid(), "stackFilter");
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]