Update of 
/var/cvs/contributions/CMSContainer/cmsc/portlets/src/java/com/finalist/cmsc/portlets
In directory 
james.mmbase.org:/tmp/cvs-serv30190/cmsc/portlets/src/java/com/finalist/cmsc/portlets

Modified Files:
        ContentChannelPortlet.java CmscPortlet.java 
        ContentPortlet.java AbstractContentPortlet.java 
        RelatedContentPortlet.java XsltPortlet.java 
Log Message:
CMSC-900 Use commons.lang.SringUtils for string emptiness


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/portlets/src/java/com/finalist/cmsc/portlets
See also: http://www.mmbase.org/jira/browse/CMSC-900


Index: ContentChannelPortlet.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/portlets/src/java/com/finalist/cmsc/portlets/ContentChannelPortlet.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- ContentChannelPortlet.java  21 Feb 2008 09:25:52 -0000      1.11
+++ ContentChannelPortlet.java  10 May 2008 16:31:23 -0000      1.12
@@ -14,7 +14,7 @@
 
 import javax.portlet.*;
 
-import net.sf.mmapps.commons.util.StringUtil;
+import org.apache.commons.lang.StringUtils;
 
 import org.mmbase.bridge.Node;
 
@@ -102,7 +102,7 @@
       PortletPreferences preferences = req.getPreferences();
 
       String channel = preferences.getValue(CONTENTCHANNEL, null);
-      if (!StringUtil.isEmpty(channel)) {
+      if (StringUtils.isNotEmpty(channel)) {
          addContentElements(req, channel);
          super.doView(req, res);
       }
@@ -112,11 +112,11 @@
    @Override
    protected void doEdit(RenderRequest req, RenderResponse res) throws 
PortletException, IOException {
       String elementId = req.getParameter(ELEMENT_ID);
-      if (StringUtil.isEmpty(elementId)) {
+      if (StringUtils.isEmpty(elementId)) {
          PortletPreferences preferences = req.getPreferences();
          String channel = preferences.getValue(CONTENTCHANNEL, null);
          addContentElements(req, channel);
-         if (!StringUtil.isEmpty(channel)) {
+         if (StringUtils.isNotEmpty(channel)) {
             if (ContentRepository.mayEdit(channel)) {
                super.doEdit(req, res);
             }
@@ -133,14 +133,14 @@
 
    protected void addContentElements(RenderRequest req, String channel) {
       String elementId = req.getParameter(ELEMENT_ID);
-      if (StringUtil.isEmpty(elementId)) {
+      if (StringUtils.isEmpty(elementId)) {
          PortletPreferences preferences = req.getPreferences();
          String portletId = 
preferences.getValue(PortalConstants.CMSC_OM_PORTLET_ID, null);
          List<String> contenttypes = SiteManagement.getContentTypes(portletId);
 
          int offset = 0;
          String currentOffset = req.getParameter(OFFSET);
-         if (!StringUtil.isEmpty(currentOffset)) {
+         if (StringUtils.isNotEmpty(currentOffset)) {
             offset = Integer.parseInt(currentOffset);
          }
          int startIndex = Integer.parseInt(preferences.getValue(START_INDEX, 
"1")) - 1;
@@ -197,12 +197,12 @@
          setAttribute(req, ELEMENTS_PER_PAGE, elementsPerPage);
 
          String pagesIndex = preferences.getValue(PAGES_INDEX, null);
-         if (StringUtil.isEmpty(pagesIndex)) {
+         if (StringUtils.isEmpty(pagesIndex)) {
             setAttribute(req, PAGES_INDEX, "center");
          }
 
          String showPages = preferences.getValue(SHOW_PAGES, null);
-         if (StringUtil.isEmpty(showPages)) {
+         if (StringUtils.isEmpty(showPages)) {
             setAttribute(req, SHOW_PAGES, 10);
          }
 
@@ -213,11 +213,11 @@
          setAttribute(req, USE_PAGING, usePaging);
 
          String indexPosition = preferences.getValue(INDEX_POSITION, null);
-         if (StringUtil.isEmpty(indexPosition)) {
+         if (StringUtils.isEmpty(indexPosition)) {
             setAttribute(req, INDEX_POSITION, "bottom");
          }
          String viewType = preferences.getValue(VIEW_TYPE, null);
-         if (StringUtil.isEmpty(viewType)) {
+         if (StringUtils.isEmpty(viewType)) {
             setAttribute(req, DISPLAY_TYPE, "list");
          }
          else {


Index: CmscPortlet.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/portlets/src/java/com/finalist/cmsc/portlets/CmscPortlet.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- CmscPortlet.java    9 May 2008 10:06:55 -0000       1.20
+++ CmscPortlet.java    10 May 2008 16:31:23 -0000      1.21
@@ -11,7 +11,7 @@
 import javax.servlet.jsp.jstl.fmt.LocalizationContext;
 
 import net.sf.mmapps.commons.bridge.CloudUtil;
-import net.sf.mmapps.commons.util.StringUtil;
+import org.apache.commons.lang.StringUtils;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -252,7 +252,7 @@
          Node userNode = SecurityUtil.getUserNode(cloud);
          if (userNode != null) {
             String userLanguage = userNode.getStringValue("language");
-            if (!StringUtil.isEmpty(userLanguage)) {
+            if (StringUtils.isNotEmpty(userLanguage)) {
                userLocale = new Locale(userLanguage);
             }
          }
@@ -270,7 +270,7 @@
     */
    protected void setResourceBundle(RenderRequest req, String template) {
       String baseName = null;
-      if (!StringUtil.isEmpty(template)) {
+      if (StringUtils.isNotEmpty(template)) {
          int extnsionIndex = template.lastIndexOf(".");
          if (extnsionIndex > -1) {
             baseName = template.substring(0, extnsionIndex);
@@ -286,7 +286,7 @@
          ResourceBundle bundle = null;
          CombinedResourceBundle cbundle = null;
 
-         while (!StringUtil.isEmpty(baseName)) {
+         while (StringUtils.isNotEmpty(baseName)) {
             try {
                ResourceBundle otherbundle = ResourceBundle.getBundle(baseName, 
locale);
                if (cbundle == null) {
@@ -388,7 +388,7 @@
       setAttribute(req, "views", views);
 
       String viewId = preferences.getValue(PortalConstants.CMSC_OM_VIEW_ID, 
null);
-      if (!StringUtil.isEmpty(viewId)) {
+      if (StringUtils.isNotEmpty(viewId)) {
          setAttribute(req, "view", viewId);
       }
    }
@@ -428,9 +428,9 @@
 
    protected String getTemplate(String type, String template, String 
resourceExtension) {
       String baseDir = getPortletContext().getInitParameter("cmsc.portal." + 
type + ".base.dir");
-      if (StringUtil.isEmpty(baseDir)) {
+      if (StringUtils.isEmpty(baseDir)) {
          String aggregationDir = 
getPortletContext().getInitParameter("cmsc.portal.aggregation.base.dir");
-         if (StringUtil.isEmpty(aggregationDir)) {
+         if (StringUtils.isEmpty(aggregationDir)) {
             aggregationDir = "/WEB-INF/templates/";
          }
          baseDir = aggregationDir + type + "/";
@@ -438,9 +438,9 @@
 
       logInitParameters();
 
-      if (StringUtil.isEmpty(template)) {
+      if (StringUtils.isEmpty(template)) {
          template = getInitParameter("template." + type);
-         if (StringUtil.isEmpty(template)) {
+         if (StringUtils.isEmpty(template)) {
             template = getPortletName() + "." + resourceExtension;
          }
       }
@@ -449,7 +449,7 @@
 
 
    protected void setAttribute(RenderRequest request, String var, Object 
value) {
-      if (!StringUtil.isEmpty(var)) {
+      if (StringUtils.isNotEmpty(var)) {
          // put in variable
          if (value != null) {
             request.setAttribute(var, value);


Index: ContentPortlet.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/portlets/src/java/com/finalist/cmsc/portlets/ContentPortlet.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- ContentPortlet.java 26 Nov 2007 11:43:40 -0000      1.8
+++ ContentPortlet.java 10 May 2008 16:31:23 -0000      1.9
@@ -12,7 +12,7 @@
 import java.io.IOException;
 import javax.portlet.*;
 
-import net.sf.mmapps.commons.util.StringUtil;
+import org.apache.commons.lang.StringUtils;
 
 /**
  * Portlet to edit content elements
@@ -31,13 +31,13 @@
    @Override
    protected void doView(RenderRequest req, RenderResponse res) throws 
PortletException, IOException {
       String elementId = req.getParameter(ELEMENT_ID);
-      if (StringUtil.isEmpty(elementId)) {
+      if (StringUtils.isEmpty(elementId)) {
          PortletPreferences preferences = req.getPreferences();
          elementId = preferences.getValue(CONTENTELEMENT, null);
       }
       getLogger().debug("doView for elementId: " + elementId);
 
-      if (!StringUtil.isEmpty(elementId)) {
+      if (StringUtils.isNotEmpty(elementId)) {
          setAttribute(req, ELEMENT_ID, elementId);
          setMetaData(req, elementId);
          super.doView(req, res);
@@ -49,13 +49,13 @@
    @Override
    protected void doEdit(RenderRequest req, RenderResponse res) throws 
IOException, PortletException {
       String elementId = req.getParameter(ELEMENT_ID);
-      if (StringUtil.isEmpty(elementId)) {
+      if (StringUtils.isEmpty(elementId)) {
          PortletPreferences preferences = req.getPreferences();
          elementId = preferences.getValue(CONTENTELEMENT, null);
       }
       getLogger().debug("doEdit for elementId: " + elementId);
 
-      if (!StringUtil.isEmpty(elementId)) {
+      if (StringUtils.isNotEmpty(elementId)) {
          setAttribute(req, ELEMENT_ID, elementId);
          setMetaData(req, elementId);
          doEdit(req, res, elementId);


Index: AbstractContentPortlet.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/portlets/src/java/com/finalist/cmsc/portlets/AbstractContentPortlet.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- AbstractContentPortlet.java 25 Feb 2008 12:08:08 -0000      1.10
+++ AbstractContentPortlet.java 10 May 2008 16:31:23 -0000      1.11
@@ -16,7 +16,7 @@
 
 import javax.portlet.*;
 
-import net.sf.mmapps.commons.util.StringUtil;
+import org.apache.commons.lang.StringUtils;
 import net.sf.mmapps.commons.bridge.CloudUtil;
 import org.mmbase.bridge.Cloud;
 import org.mmbase.bridge.Node;
@@ -133,7 +133,7 @@
                   String number = name.substring(index + 1, secondIndex);
                   String field = name.substring(secondIndex + 1);
                   String value = request.getParameter(name);
-                  if (!StringUtil.isEmpty(number)) {
+                  if (StringUtils.isNotEmpty(number)) {
                      if (!nodesMap.containsKey(number)) {
                         Cloud cloud = getCloud();
                         Node node = cloud.getNode(number);
@@ -198,7 +198,7 @@
 
       PortletPreferences preferences = req.getPreferences();
       String pageid = preferences.getValue(PAGE, null);
-      if (!StringUtil.isEmpty(pageid)) {
+      if (StringUtils.isNotEmpty(pageid)) {
 
          String pagepath = SiteManagement.getPath(Integer.valueOf(pageid), 
true);
 


Index: RelatedContentPortlet.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/portlets/src/java/com/finalist/cmsc/portlets/RelatedContentPortlet.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- RelatedContentPortlet.java  21 Apr 2008 10:11:52 -0000      1.5
+++ RelatedContentPortlet.java  10 May 2008 16:31:23 -0000      1.6
@@ -16,19 +16,19 @@
 import com.finalist.cmsc.portalImpl.PortalConstants;
 import com.finalist.cmsc.services.sitemanagement.SiteManagement;
 
-import net.sf.mmapps.commons.util.StringUtil;
+import org.apache.commons.lang.StringUtils;
 
 public class RelatedContentPortlet extends AbstractContentPortlet {
 
    protected void doView(RenderRequest req, RenderResponse res) throws 
PortletException, IOException {
       String window = req.getPreferences().getValue(WINDOW, null);
-      if (!StringUtil.isEmpty(window)) {
+      if (StringUtils.isNotEmpty(window)) {
          String elementId = getElementIdFromRequestParameters(req, window);
-         if (StringUtil.isEmpty(elementId)) {
+         if (StringUtils.isEmpty(elementId)) {
             elementId = getElementIdFromScreen(req, window);
          }
 
-         if (!StringUtil.isEmpty(elementId)) {
+         if (StringUtils.isNotEmpty(elementId)) {
             setAttribute(req, ELEMENT_ID, elementId);
          }
       }


Index: XsltPortlet.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/portlets/src/java/com/finalist/cmsc/portlets/XsltPortlet.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- XsltPortlet.java    7 Apr 2008 09:51:12 -0000       1.4
+++ XsltPortlet.java    10 May 2008 16:31:23 -0000      1.5
@@ -21,7 +21,7 @@
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.TransformerException;
 
-import net.sf.mmapps.commons.util.StringUtil;
+import org.apache.commons.lang.StringUtils;
 
 import org.apache.commons.lang.StringUtils;
 import org.xml.sax.SAXException;
@@ -90,7 +90,7 @@
        */
       PortletPreferences preferences = req.getPreferences();
       String pageid = preferences.getValue(PAGE, null);
-      if (!StringUtil.isEmpty(pageid)) {
+      if (StringUtils.isNotEmpty(pageid)) {
 
          String pagepath = SiteManagement.getPath(Integer.valueOf(pageid), 
true);
 
@@ -120,7 +120,7 @@
 
       // set required content type and write content
       response.setContentType("text/html");
-      if (!StringUtil.isEmpty(xsl) && !StringUtil.isEmpty(xmlSource)) {
+      if (StringUtils.isNotEmpty(xsl) && StringUtils.isNotEmpty(xmlSource)) {
          try {
             HashMap<String, Object> xslParams = getXsltParams(preferences);
             
@@ -206,7 +206,7 @@
       while (p.hasMoreElements()) {
          String pref = p.nextElement();
          String value = preferences.getValue(pref, null);
-         if (!StringUtils.isBlank(value)) {
+         if (StringUtils.isNotBlank(value)) {
             xslParams.put(pref, value);
          }
       }
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to