[jboss-svn-commits] JBL Code SVN: r11181 - in labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums: ui and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Apr 20 20:29:20 EDT 2007


Author: dejp
Date: 2007-04-20 20:29:20 -0400 (Fri, 20 Apr 2007)
New Revision: 11181

Modified:
   labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/impl/PosterImpl.java
   labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java
Log:
JBFORUMS-198

Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/impl/PosterImpl.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/impl/PosterImpl.java	2007-04-21 00:28:58 UTC (rev 11180)
+++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/impl/PosterImpl.java	2007-04-21 00:29:20 UTC (rev 11181)
@@ -17,8 +17,10 @@
 import org.jboss.portal.core.modules.ModuleConstants;
 import org.jboss.portal.core.modules.ModuleException;
 import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.NoSuchUserException;
 import org.jboss.portal.identity.UserModule;
 import org.jboss.portlet.forums.model.Poster;
+import org.jboss.portlet.forums.ui.PortalUtil;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -70,6 +72,9 @@
             e.printStackTrace();
             return null;
          }
+         catch (NoSuchUserException e) {
+             return PortalUtil.getUserNA();
+         }
          catch (IdentityException e)
          {
             e.printStackTrace();

Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java	2007-04-21 00:28:58 UTC (rev 11180)
+++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java	2007-04-21 00:29:20 UTC (rev 11181)
@@ -25,11 +25,13 @@
 import java.io.StringWriter;
 import java.net.URLEncoder;
 import java.text.SimpleDateFormat;
+import java.util.Collection;
 import java.util.Date;
 import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
 import java.util.ResourceBundle;
+import java.util.Set;
 
 import javax.faces.FactoryFinder;
 import javax.faces.application.Application;
@@ -171,6 +173,204 @@
             }
         };
 
+        private static User userNA = new User() 
+        {
+            {
+                this.id = new Long(-1);
+                this.userName = "N/A";
+            }
+            
+            protected Object id;
+            
+            protected String userName;
+            
+            public Object getId()
+            {
+                return id;
+            }
+
+            public boolean getEnabled()
+            {
+                return false;
+            }
+
+            public void setEnabled(boolean enabled)
+            {
+            }
+
+            public void updatePassword(String password)
+            {
+            }
+
+            public boolean validatePassword(String password)
+            {
+                return false;
+            }
+
+            public PropertyMap getProperties()
+            {
+                return properties;
+            }
+
+            public String getUserName()
+            {
+                return userName;
+            }
+
+            public String getGivenName()
+            {
+                return null;
+            }
+
+            public void setGivenName(String givenName)
+            {
+            }
+
+            public String getFamilyName()
+            {
+                return null;
+            }
+
+            public void setFamilyName(String familyName)
+            {
+            }
+
+            public String getRealEmail()
+            {
+                return null;
+            }
+
+            public void setRealEmail(String realEmail)
+            {
+            }
+
+            public String getFakeEmail()
+            {
+                return null;
+            }
+
+            public void setFakeEmail(String fakeEmail)
+            {
+            }
+
+            public Date getRegistrationDate()
+            {
+                return null;
+            }
+
+            public boolean getViewRealEmail()
+            {
+                return false;
+            }
+
+            public void setViewRealEmail(boolean viewRealEmail)
+            {
+            }
+
+            public Locale getPreferredLocale()
+            {
+                return null;
+            }
+
+            public void setPreferredLocale(Locale locale)
+            {
+            }
+
+            public String getSignature()
+            {
+                return null;
+            }
+
+            public void setSignature(String signature)
+            {
+            }
+
+            public Date getLastVisitDate()
+            {
+                return null;
+            }
+
+            public void setLastVisitDate(Date date)
+            {
+            }
+
+            public String getTheme()
+            {
+                return null;
+            }
+
+            public void setTheme(String theme)
+            {
+            }
+            
+            protected PropertyMap properties = new PropertyMap()
+            {
+
+               public boolean isReadOnly(Object key)
+               {
+                  return true;
+               }
+
+               public int size()
+               {
+                  return 0;
+               }
+
+               public boolean isEmpty()
+               {
+                  return false;
+               }
+
+               public boolean containsKey(Object key)
+               {
+                  return false;
+               }
+
+               public boolean containsValue(Object value)
+               {
+                   return false;
+               }
+
+               public Object get(Object key)
+               {
+                   return null;
+               }
+
+               public Object put(Object key, Object newValue) throws IllegalArgumentException
+               {
+                   return null;
+               }
+
+               public Object remove(Object key) throws IllegalArgumentException
+               {
+                   return null;
+               }
+
+               public void clear()
+               {
+               }
+         
+               public Set keySet()
+               {
+                   return null;
+               }
+
+               public Collection values()
+               {
+                   return null;
+               }
+
+               public Set entrySet()
+               {
+                   return null;
+               }
+
+               public void putAll(Map map)
+               {
+               }
+            };
+            
+        };
      
         /**
          * 
@@ -673,5 +873,10 @@
     public static TempFileBinding getUploadedAttachment()
     {
         return (TempFileBinding)PortalUtil.uploadedAttachment.get();
-    }    
+    }
+    
+    public static User getUserNA() {
+        return userNA;
+    }
+
 }




More information about the jboss-svn-commits mailing list