Update of
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/forms
In directory
james.mmbase.org:/tmp/cvs-serv18251/portlets-newsletter/src/java/com/finalist/newsletter/forms
Modified Files:
SubscriptioManagementAction.java
NewsletterSubscriberSearchAction.java
Log Message:
CMSC-1283 - Newsletter: improved code efficiency. Added count method. Added
infix to fullname.
See also:
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/forms
See also: http://www.mmbase.org/jira/browse/CMSC-1283
Index: SubscriptioManagementAction.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/forms/SubscriptioManagementAction.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- SubscriptioManagementAction.java 10 Dec 2008 04:52:58 -0000 1.17
+++ SubscriptioManagementAction.java 6 Feb 2009 16:12:52 -0000 1.18
@@ -171,7 +171,11 @@
List<Object[]> qResults = subscriptionHService
.getSubscribersRelatedInfo(authenticationIds, name, "", email,
true);
for (Object[] result : qResults) {
- String tmpFullName = result[0].toString() + " " +
result[1].toString();
+ String tmpFullName = result[0].toString(); //Firstname
+ if(StringUtils.isNotEmpty(result[1].toString())) { //If infix is not
empty, add it
+ tmpFullName += " " + result[1].toString();
+ }
+ tmpFullName += " " + result[2].toString(); //Add Lastname
String tmpEmail = result[2].toString();
int tmpAuthenticationId = Integer.parseInt(result[3].toString());
String tmpUserName = result[4].toString();
@@ -205,7 +209,7 @@
Set<Long> authenticationIds = new HashSet<Long>();
authenticationIds =
subscriptionServices.getAuthenticationIdsByNewsletter(newsletterId);
if (authenticationIds.size() > 0) {
- resultCount =
subscriptionHService.getSubscribersRelatedInfo(authenticationIds, name, "",
email, false).size();
+ resultCount =
subscriptionHService.getSubscribersRelatedInfoCount(authenticationIds, name,
"", email, false);
}
return resultCount;
}
@@ -247,13 +251,16 @@
Set<Long> authenticationIds = new HashSet<Long>();
authenticationIds = subscriptionServices.getAuthenticationIds();
- List<Object[]> qResults =
subscriptionHService.getSubscribersRelatedInfo(authenticationIds, fullname, "",
email,
- true);
+ List<Object[]> qResults =
subscriptionHService.getSubscribersRelatedInfo(authenticationIds, fullname, "",
email, true);
for (Object[] result : qResults) {
- String tmpFullName = result[0].toString() + " " +
result[1].toString();
- String tmpEmail = result[2].toString();
- int tmpAuthenticationId = Integer.parseInt(result[3].toString());
- String tmpUserName = result[4].toString();
+ String tmpFullName = result[0].toString(); //Firstname
+ if(StringUtils.isNotEmpty(result[1].toString())) { //If infix is not
empty, add it
+ tmpFullName += " " + result[1].toString();
+ }
+ tmpFullName += " " + result[2].toString(); //Add Lastname
+ String tmpEmail = result[3].toString();
+ int tmpAuthenticationId = Integer.parseInt(result[4].toString());
+ String tmpUserName = result[5].toString();
addToSubscriptionMap(results, tmpFullName, tmpUserName, tmpEmail,
tmpAuthenticationId);
}
return results;
@@ -264,8 +271,7 @@
Set<Long> authenticationIds = new HashSet<Long>();
authenticationIds = subscriptionServices.getAuthenticationIds();
if (authenticationIds.size() > 0) {
- resultCount =
subscriptionHService.getSubscribersRelatedInfo(authenticationIds, fullname, "",
email, false)
- .size();
+ resultCount =
subscriptionHService.getSubscribersRelatedInfoCount(authenticationIds,
fullname, "", email, false);
}
return resultCount;
}
Index: NewsletterSubscriberSearchAction.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/forms/NewsletterSubscriberSearchAction.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- NewsletterSubscriberSearchAction.java 14 Oct 2008 11:22:43 -0000
1.13
+++ NewsletterSubscriberSearchAction.java 6 Feb 2009 16:12:52 -0000
1.14
@@ -10,6 +10,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionForm;
@@ -161,12 +162,16 @@
email, true);
for (Object[] result : qResults) {
- String tmpFullName = result[0].toString() + " " +
result[1].toString();
- String tmpEmail = result[2].toString();
- int tmpAuthenticationId = Integer.parseInt(result[3].toString());
+ String tmpFullName = result[0].toString(); //Firstname
+ if(StringUtils.isNotEmpty(result[1].toString())) { //If infix is not
empty, add it
+ tmpFullName += " " + result[1].toString();
+ }
+ tmpFullName += " " + result[2].toString(); //Add Lastname
+ String tmpEmail = result[3].toString();
+ int tmpAuthenticationId = Integer.parseInt(result[4].toString());
String tmpNewsletters =
subscriptionService.getNewsletterNameList(tmpAuthenticationId);
String tmpTerms =
subscriptionService.getTermsNameList(tmpAuthenticationId);
- String tmpUserName = result[4].toString();
+ String tmpUserName = result[5].toString();
addToMap(results, tmpFullName, tmpUserName, tmpEmail, tmpNewsletters,
tmpTerms, tmpAuthenticationId);
}
return results;
@@ -189,8 +194,7 @@
authenticationIds =
subscriptionService.getAuthenticationIdsByTerms(newsletterId, terms);
if (authenticationIds.size() > 0) {
- resultCount =
subscriptionHService.getSubscribersRelatedInfo(authenticationIds, fullName,
userName, email,
- false).size();
+ resultCount =
subscriptionHService.getSubscribersRelatedInfoCount(authenticationIds,
fullName, userName, email, false);
}
return resultCount;
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs