[jboss-svn-commits] JBL Code SVN: r11180 - in labs/jbossforums/branches/forums101P22/forums/src: main/org/jboss/portlet/forums/ui and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Apr 20 20:28:58 EDT 2007
Author: dejp
Date: 2007-04-20 20:28:58 -0400 (Fri, 20 Apr 2007)
New Revision: 11180
Added:
labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/WEB-INF/forums-object.xml
Modified:
labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/impl/PosterImpl.java
labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java
Log:
JBFORUMS-198
Modified: labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/impl/PosterImpl.java
===================================================================
--- labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/impl/PosterImpl.java 2007-04-21 00:28:32 UTC (rev 11179)
+++ labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/impl/PosterImpl.java 2007-04-21 00:28:58 UTC (rev 11180)
@@ -13,11 +13,13 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import org.jboss.portal.core.model.NoSuchUserException;
import org.jboss.portal.core.model.User;
import org.jboss.portal.core.modules.ModuleConstants;
import org.jboss.portal.core.modules.ModuleException;
import org.jboss.portal.core.modules.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>
@@ -69,6 +71,9 @@
e.printStackTrace();
return null;
}
+ catch (NoSuchUserException e) {
+ return PortalUtil.getUserNA();
+ }
catch (ModuleException e)
{
e.printStackTrace();
Modified: labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java
===================================================================
--- labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java 2007-04-21 00:28:32 UTC (rev 11179)
+++ labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java 2007-04-21 00:28:58 UTC (rev 11180)
@@ -25,11 +25,14 @@
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Calendar;
+import java.util.Collection;
import java.util.Date;
+import java.util.HashSet;
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;
import javax.faces.application.ApplicationFactory;
@@ -49,6 +52,7 @@
import org.jboss.portal.format.util.CLLoader;
import org.jboss.portal.core.CoreConstants;
import org.jboss.portal.core.modules.UserModule;
+import org.jboss.portal.core.model.PropertyMap;
import org.jboss.portal.core.model.User;
import org.jboss.portlet.forums.ForumsConstants;
import org.jboss.portlet.forums.helper.TempFileBinding;
@@ -77,8 +81,191 @@
private static CoreConstants coreConstants = new CoreConstants()
{
};
-
+ private static User userNA = new User()
+ {
+ {
+ this.id = new Long(-1);
+ this.userName = "N/A";
+ this.roles = new HashSet();
+ }
+
+ private Object id;
+
+ private String userName;
+
+ private Set roles;
+
+ public Object getId()
+ {
+ return id;
+ }
+
+ public boolean getEnabled() {
+ return false;
+ }
+
+ public String getFakeEmail() {
+ return null;
+ }
+
+ public String getFamilyName() {
+ return null;
+ }
+
+ public String getGivenName() {
+ return null;
+ }
+
+ public Date getLastVisitDate() {
+ return null;
+ }
+
+ public String getPassword() {
+ return null;
+ }
+
+ public Locale getPreferredLocale() {
+ return null;
+ }
+
+ public PropertyMap getProperties() {
+ return properties;
+ }
+
+ public String getRealEmail() {
+ return null;
+ }
+
+ public Date getRegistrationDate() {
+ return null;
+ }
+
+ public Set getRoleNames() {
+ return null;
+ }
+
+ public Set getRoles() {
+ return roles;
+ }
+
+ public String getSignature() {
+ return null;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public boolean getViewRealEmail() {
+ return false;
+ }
+
+ public void setEnabled(boolean b) {
+ }
+
+ public void setFakeEmail(String fakeEmail) {
+ }
+
+ public void setFamilyName(String familyName) {
+ }
+
+ public void setGivenName(String givenName) {
+ }
+
+ public void setLastVisitDate(Date lastVisitDate) {
+ }
+
+ public void setPassword(String password) {
+ }
+
+ public void setPreferredLocale(Locale locale) {
+ }
+
+ public void setRealEmail(String realEmail) {
+ }
+
+ public void setRegistrationDate(Date registrationDate) {
+ }
+
+ public void setRoles(Set roles) {
+ }
+
+ public void setSignature(String signature) {
+ }
+
+ public void setViewRealEmail(boolean viewRealEmail) {
+ }
+
+ 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)
+ {
+ }
+ };
+
+ };
+
/**
*
*
@@ -417,9 +604,11 @@
return null;
}
String property = PortalUtil.userProperty(user.getProperties(), "INFO_USER_LAST_LOGIN_DATE");
- Calendar calendar = Calendar.getInstance();
- calendar.setTimeInMillis(Long.parseLong(property));
- return calendar.getTime();
+ if (property != null) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(Long.parseLong(property));
+ return calendar.getTime();
+ }
} catch (Exception e)
{
JSFUtil.handleException(e);
@@ -660,4 +849,9 @@
{
return (TempFileBinding) PortalUtil.uploadedAttachment.get();
}
+
+ public static User getUserNA() {
+ return userNA;
+ }
+
}
Added: labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/WEB-INF/forums-object.xml
===================================================================
--- labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/WEB-INF/forums-object.xml (rev 0)
+++ labs/jbossforums/branches/forums101P22/forums/src/resources/portal-forums-war/WEB-INF/forums-object.xml 2007-04-21 00:28:58 UTC (rev 11180)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployments>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <parent-ref>default</parent-ref>
+ <page>
+ <page-name>forums</page-name>
+
+ <window>
+ <window-name>NavigationPortletWindow</window-name>
+ kosmos/
+ <instance-ref>NavigationPortletInstance</instance-ref>
+ <region>navigation</region>
+ <height>0</height>
+ <!-- keep portal and page properties for this window -->
+ <properties>
+ <!-- use the window renderer from the emptyRenderer renderSet -->
+ <property>
+ <name>theme.windowRendererId</name>
+ <value>emptyRenderer</value>
+ </property>
+ <!-- use the decoration renderer from the emptyRenderer renderSet -->
+ <property>
+ <name>theme.decorationRendererId</name>
+ <value>emptyRenderer</value>
+ </property>
+ <!-- use the portlet renderer from the emptyRenderer renderSet -->
+ <property>
+ <name>theme.portletRendererId</name>
+ <value>emptyRenderer</value>
+ </property>
+ </properties>
+ </window>
+
+ <window>
+ <window-name>JSFForumsPortletWindow</window-name>
+ <instance-ref>JSFForumsPortletInstance</instance-ref>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </page>
+ </deployment>
+
+ <deployment>
+ <if-exists>keep</if-exists>
+ <instance>
+ <instance-name>JSFForumsPortletInstance</instance-name>
+ <component-ref>forums.JSFForumsPortlet</component-ref>
+ </instance>
+ </deployment>
+
+</deployments>
More information about the jboss-svn-commits
mailing list