Update of
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/preferences
In directory
james.mmbase.org:/tmp/cvs-serv16636/community/src/java/com/finalist/cmsc/services/community/preferences
Modified Files:
Tag: b1_6
PreferenceHibernateService.java
Log Message:
CMSC-1374 merged from 1.5 branch
See also:
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/preferences
See also: http://www.mmbase.org/jira/browse/CMSC-1374
Index: PreferenceHibernateService.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/preferences/PreferenceHibernateService.java,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -u -b -r1.14 -r1.14.2.1
--- PreferenceHibernateService.java 21 Oct 2008 07:49:46 -0000 1.14
+++ PreferenceHibernateService.java 15 Apr 2009 13:02:10 -0000 1.14.2.1
@@ -167,14 +167,20 @@
public void deletePreference(String module, String userId, String key,
String value) {
Long authenticationId =
authenticationService.getAuthenticationIdForUserId(userId);
Criteria criteria = getSession().createCriteria(Preference.class);
+ if (module != null) {
criteria.add(Restrictions.eq("module", module));
+ }
criteria.add(Restrictions.eq("authenticationId", authenticationId));
+ if (key != null) {
criteria.add(Restrictions.eq("key", key));
+ }
+ if (value != null) {
criteria.add(Restrictions.eq("value", value));
+ }
List preferences = criteria.list();
- if (preferences.size() == 1) {
- Preference p = (Preference) preferences.get(0);
- getSession().delete(p);
+ for (Iterator iter = preferences.iterator(); iter.hasNext(); ) {
+ Preference pref = (Preference) iter.next();
+ getSession().delete(pref);
}
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs