Update of
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/preferences
In directory
james.mmbase.org:/tmp/cvs-serv30109/community/src/java/com/finalist/cmsc/services/community/preferences
Modified Files:
Tag: b1_5
PreferenceHibernateService.java
Log Message:
CMSC-1357: autoregistration for newsletter
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-1357
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.13.2.1
retrieving revision 1.13.2.2
diff -u -b -r1.13.2.1 -r1.13.2.2
--- PreferenceHibernateService.java 21 Oct 2008 13:05:01 -0000 1.13.2.1
+++ PreferenceHibernateService.java 9 Apr 2009 12:21:37 -0000 1.13.2.2
@@ -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