Update of 
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/services/impl
In directory 
james.mmbase.org:/tmp/cvs-serv7203/portlets-newsletter/src/java/com/finalist/newsletter/services/impl

Modified Files:
      Tag: b1_5
        NewsletterSubscriptionServicesImpl.java 
        StatisticServiceImpl.java 
Log Message:
CMSC-907 - Clean up code: convert to better methods; fix naming convention 
violations; remove extra imports.


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-907


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.26.2.4
retrieving revision 1.26.2.5
diff -u -b -r1.26.2.4 -r1.26.2.5
--- NewsletterSubscriptionServicesImpl.java     10 Nov 2008 06:47:00 -0000      
1.26.2.4
+++ NewsletterSubscriptionServicesImpl.java     11 Feb 2009 09:08:27 -0000      
1.26.2.5
@@ -346,32 +346,32 @@
 
    public String getNewsletterNameList(int authenticationId) {
       Set<Node> newsletterList = 
subscriptionCAO.getNewslettersByScriptionRecord(authenticationId);
-      String tmpTitle = "";
+      StringBuilder tmpTitle = new StringBuilder();
       for (Node newsletterNode : newsletterList) {
          if (StringUtils.isNotBlank(newsletterNode.getStringValue("title"))) {
-            tmpTitle += newsletterNode.getStringValue("title") + ", ";
+            tmpTitle.append(newsletterNode.getStringValue("title") + ", ");
          }
       }
       if (tmpTitle.length() > 0) {
          return tmpTitle.substring(0, tmpTitle.length() - 2);
       } else {
-         return tmpTitle;
+         return tmpTitle.toString();
       }
 
    }
 
    public String getTermsNameList(int authenticationId) {
       Set<Node> termList = 
subscriptionCAO.getTermsByScriptionRecord(authenticationId);
-      String tmpNames = "";
+      StringBuilder tmpNames = new StringBuilder();
       for (Node termNode : termList) {
          if (StringUtils.isNotBlank(termNode.getStringValue("name"))) {
-            tmpNames += termNode.getStringValue("name") + ", ";
+            tmpNames.append(termNode.getStringValue("name") + ", ");
          }
       }
       if (tmpNames.length() > 0) {
          return tmpNames.substring(0, tmpNames.length() - 2);
       } else {
-         return tmpNames;
+         return tmpNames.toString();
       }
 
    }
@@ -379,18 +379,18 @@
    public Set<Long> getAuthenticationIdsByTerms(int newsletterId, String 
terms) {
       List<Node> subscriptions = 
subscriptionCAO.getSubscriptionsByTerms(newsletterId, terms);
 
-      Set<Long> subscirberIds = new HashSet<Long>();
+      Set<Long> subscriberIds = new HashSet<Long>();
       for (Node subscription : subscriptions) {
-         subscirberIds.add(new Long(subscription.getIntValue("subscriber")));
+         
subscriberIds.add(Long.valueOf(subscription.getIntValue("subscriber")));
       }
-      return subscirberIds;
+      return subscriberIds;
    }
 
    public Set<Long> getAuthenticationIdsByNewsletter(int newsletterId) {
       List<Subscription> subscriptions = 
subscriptionCAO.getSubscription(newsletterId);
       Set<Long> subscriberIds = new HashSet<Long>();
       for(Subscription subscription: subscriptions){
-         subscriberIds.add(new 
Long(Integer.parseInt(subscription.getSubscriberId())));
+         
subscriberIds.add(Long.valueOf(Integer.parseInt(subscription.getSubscriberId())));
       }
       return subscriberIds;
    }
@@ -399,7 +399,7 @@
       List<Node> subscriptions = subscriptionCAO.getAllSubscriptions();
       Set<Long> subscriberIds = new HashSet<Long>();
       for(Node subscription: subscriptions){
-         subscriberIds.add(new Long(subscription.getIntValue("subscriber")));
+         
subscriberIds.add(Long.valueOf(subscription.getIntValue("subscriber")));
       }
       return subscriberIds;
    }


Index: StatisticServiceImpl.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/services/impl/StatisticServiceImpl.java,v
retrieving revision 1.5.2.1
retrieving revision 1.5.2.2
diff -u -b -r1.5.2.1 -r1.5.2.2
--- StatisticServiceImpl.java   10 Nov 2008 06:47:00 -0000      1.5.2.1
+++ StatisticServiceImpl.java   11 Feb 2009 09:08:27 -0000      1.5.2.2
@@ -60,7 +60,7 @@
       Date endDate;
       startDate = DateUtil.parser(start);
       endDate = DateUtil.parser(end);
-      List<StatisticResult> list = 
statisticCAO.getRecordsByNewsletterAndPeriod(startDate, endDate,newsletterId);
+      List<StatisticResult> list = 
statisticCAO.getRecordsByNewsletterAndPeriod(startDate, endDate, newsletterId);
       StatisticResult result = new StatisticResult();
       for (StatisticResult r : list) {
          result.setPost(result.getPost() + r.getPost());
@@ -109,18 +109,16 @@
       return result;
    }
 
-   public List<StatisticResult> StatisticDetailByNewsletterPeriod(
+   public List<StatisticResult> statisticDetailByNewsletterPeriod(
          int newsletterId, String start, String end) throws ServiceException {
 
-      Date startDate;
-      Date endDate;
-      startDate = DateUtil.parser(start);
-      endDate = DateUtil.parser(end);
-      List<StatisticResult> list = 
statisticCAO.getRecordsByNewsletterAndPeriod(startDate, endDate,newsletterId);
+      Date startDate = DateUtil.parser(start);
+      Date endDate = DateUtil.parser(end);
+      List<StatisticResult> list = 
statisticCAO.getRecordsByNewsletterAndPeriod(startDate, endDate, newsletterId);
       return list;
    }
 
-   public StatisticResult StatisticSummaryByNewsletter(int newsletterId) {
+   public StatisticResult statisticSummaryByNewsletter(int newsletterId) {
       List<StatisticResult> list = 
statisticCAO.getRecordsByNewsletter(newsletterId);
       StatisticResult result = new StatisticResult();
       for (StatisticResult r : list) {
@@ -148,4 +146,5 @@
       
       return statisticCAO.insertSumedLogs(listRecorder);
    }
+   
 }
_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to