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

Modified Files:
        NewsletterUtil.java 
Log Message:
CMSC-735 Signout link in the footer


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/util
See also: http://www.mmbase.org/jira/browse/CMSC-735


Index: NewsletterUtil.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/util/NewsletterUtil.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- NewsletterUtil.java 6 May 2008 02:56:11 -0000       1.22
+++ NewsletterUtil.java 6 May 2008 14:02:53 -0000       1.23
@@ -12,6 +12,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.commons.lang.StringUtils;
 import org.mmbase.bridge.Cloud;
 import org.mmbase.bridge.Node;
 import org.mmbase.bridge.NodeList;
@@ -23,7 +24,9 @@
 import org.mmbase.storage.search.Step;
 
 import com.finalist.cmsc.beans.om.ContentElement;
+import com.finalist.cmsc.mmbase.PropertiesUtil;
 import com.finalist.newsletter.domain.Term;
+import com.finalist.newsletter.NewsletterSendFailException;
 import com.finalist.portlets.newsletter.NewsletterContentPortlet;
 
 public abstract class NewsletterUtil {
@@ -133,6 +136,7 @@
       }
       return (null);
    }
+
    public static List<ContentElement> getArticlesByNewsletter(String 
termNumbers, int offset, int elementsPerPage, String orderBy, String direction) 
{
 
          String[] numbers = termNumbers.split(",");
@@ -143,8 +147,9 @@
          if (sort.size() == 0) {
             return (null);
          }         
-         return getArticles( offset,  elementsPerPage,  orderBy,  
direction,sort);
+      return getArticles(offset, elementsPerPage, orderBy, direction, sort);
    }
+
    public static List<ContentElement> getArticlesByNewsletter(int 
newsletterNumber, int offset, int elementsPerPage, String orderBy, String 
direction) {
       if (newsletterNumber > 0) {
          Cloud cloud = CloudProviderFactory.getCloudProvider().getCloud();
@@ -160,12 +165,12 @@
          if (sort.size() == 0) {
             return (null);
          }
-         return getArticles( offset,  elementsPerPage,  orderBy,  
direction,sort);
+         return getArticles(offset, elementsPerPage, orderBy, direction, sort);
       }
       return (null);
    }
    
-   public  static List<ContentElement> getArticles(int offset, int 
elementsPerPage, String orderBy, String direction,SortedSet<Integer> sort) {
+   public static List<ContentElement> getArticles(int offset, int 
elementsPerPage, String orderBy, String direction, SortedSet<Integer> sort) {
       List<ContentElement> articles = new ArrayList<ContentElement>();
       Cloud cloud = CloudProviderFactory.getCloudProvider().getCloud();
 
@@ -190,6 +195,7 @@
       return (articles);
       
    }
+
    public static int countArticles(SortedSet<Integer> sort) {
       Cloud cloud = CloudProviderFactory.getCloudProvider().getCloud();
 
@@ -203,6 +209,7 @@
 
       return Queries.count(query);
    }
+
    public static int countArticlesByNewsletter(String termNumbers) {
 
          String[] numbers = termNumbers.split(",");
@@ -302,6 +309,7 @@
       }
       return (false);
    }
+
    public static boolean isPaused(Node newsletterNode) {
       if (newsletterNode != null) {
             boolean isPaused = newsletterNode.getBooleanValue("paused");
@@ -310,6 +318,7 @@
       }
       return (false);
    }
+
    public static void pauseNewsletter(int number) {
       if (number > 0) {
          Cloud cloud = CloudProviderFactory.getCloudProvider().getCloud();
@@ -361,4 +370,19 @@
    }
 
 
+   public static String getHostUrl() {
+      String hostUrl = PropertiesUtil.getProperty("host");
+
+      if (StringUtils.isEmpty(hostUrl)) {
+         throw new NewsletterSendFailException("get property <host> from 
system property and get nothing");
+      }
+
+      log.debug("get property <host> from system property and get:" + hostUrl);
+
+      if (!hostUrl.endsWith("/")) {
+         hostUrl += "/";
+      }
+      return hostUrl;
+   }
+
 }
\ No newline at end of file
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to