Update of
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/services/impl
In directory
james.mmbase.org:/tmp/cvs-serv18058/src/java/com/finalist/newsletter/services/impl
Modified Files:
NewsletterSubscriptionServicesImpl.java
Log Message:
CMSC-956 chang all subscriber to show correct data.
See also:
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/services/impl
See also: http://www.mmbase.org/jira/browse/CMSC-956
Index: NewsletterSubscriptionServicesImpl.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/services/impl/NewsletterSubscriptionServicesImpl.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- NewsletterSubscriptionServicesImpl.java 1 Aug 2008 02:16:58 -0000
1.23
+++ NewsletterSubscriptionServicesImpl.java 5 Aug 2008 05:47:14 -0000
1.24
@@ -298,38 +298,19 @@
return personIds;
}
- public List<Person> getAllSubscribers() {
-
- List<Person> persons = personService.getAllPersons();
- removeNoneSubscribers(persons);
- return persons;
- }
-
- private void removeNoneSubscribers(List<Person> persons) {
- for (int i = 0; i < persons.size(); i++) {
- Person person = persons.get(i);
- List<Subscription> subscrioptions =
subscriptionCAO.getSubscriptionByUserIdAndStatus(person.getAuthenticationId().intValue(),
null);
- if (subscrioptions.size() < 1) {
- persons.remove(i);
- }
- }
- }
-
public List<Person> getAllSubscribers(String name, String email) {
-
- Person person = new Person();
- if (StringUtils.isNotBlank(name)) {
- person.setLastName(name);
- }
-
- if (StringUtils.isNotBlank(email)) {
- person.setEmail(email);
+ List<Node> subscriptions =
subscriptionCAO.getAllSubscriptions();
+ Set<Integer> authenticationIds = new HashSet();
+ for (Node subscription : subscriptions) {
+ int authId = subscription.getIntValue("subscriber");
+ authenticationIds.add(authId);
}
-
- List<Person> persons = personService.getLikePersons(person);
- removeNoneSubscribers(persons);
-
+ if (authenticationIds.size() > 0) {
+ List<Person> persons =
personService.getPersonsByAuthenticationIds(authenticationIds, name, email);
return persons;
+ } else {
+ return null;
+ }
}
public List<Subscription> getSubscriptionBySubscriber(String newsletterid) {
@@ -404,4 +385,5 @@
return subscirberIds;
}
+
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs