[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...
Gavin King
gavin.king at jboss.com
Fri Nov 3 18:38:27 EST 2006
User: gavin
Date: 06/11/03 18:38:27
Modified: src/main/org/jboss/seam/core Conversation.java
ConversationEntry.java Manager.java
Log:
fixed breakage of conversation list
Revision Changes Path
1.25 +25 -22 jboss-seam/src/main/org/jboss/seam/core/Conversation.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Conversation.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Conversation.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- Conversation.java 31 Oct 2006 20:09:21 -0000 1.24
+++ Conversation.java 3 Nov 2006 23:38:27 -0000 1.25
@@ -36,7 +36,9 @@
* @return the timeout in millis
*/
public Integer getTimeout() {
- return timeout;
+ return timeout==null ?
+ Manager.instance().getCurrentConversationTimeout() :
+ timeout;
}
/**
@@ -101,29 +103,30 @@
void flush()
{
//we need to flush this stuff asynchronously to handle
- //nested and temporary conversations nicely
- if ( description!=null || viewId!=null )
- {
- Manager manager = Manager.instance();
- if ( !manager.isLongRunningConversation() )
+ //nested and temporary conversations which have no
+ //ConversationEntry
+ if ( !Manager.instance().isLongRunningConversation() )
{
throw new IllegalStateException("only long-running conversation outcomes are switchable");
}
+
+ ConversationEntry entry = Manager.instance().getCurrentConversationEntry();
if (viewId!=null)
{
- manager.getCurrentConversationEntry().setViewId(viewId);
+ entry.setViewId(viewId);
}
if (description!=null)
{
- manager.getCurrentConversationEntry().setDescription(description);
+ entry.setDescription(description);
}
if (timeout!=null)
{
- manager.getCurrentConversationEntry().setTimeout(timeout);
+ entry.setTimeout(timeout);
}
+
description = null;
viewId = null;
- }
+ timeout = null;
}
/**
1.28 +36 -18 jboss-seam/src/main/org/jboss/seam/core/ConversationEntry.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ConversationEntry.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/ConversationEntry.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- ConversationEntry.java 2 Nov 2006 19:28:14 -0000 1.27
+++ ConversationEntry.java 3 Nov 2006 23:38:27 -0000 1.28
@@ -57,7 +57,8 @@
touch();
}
- public String getDescription() {
+ public String getDescription()
+ {
if ( isCurrent() )
{
String desc = Conversation.instance().description;
@@ -66,35 +67,42 @@
return description;
}
- void setDescription(String description) {
+ void setDescription(String description)
+ {
entries.setDirty(this.description, description);
this.description = description;
}
- public synchronized long getLastRequestTime() {
+ public synchronized long getLastRequestTime()
+ {
return lastRequestTime;
}
- synchronized void touch() {
+ synchronized void touch()
+ {
entries.setDirty();
lastRequestTime = System.currentTimeMillis();
lastDatetime = new Date();
}
- public String getId() {
+ public String getId()
+ {
return id;
}
- public Date getStartDatetime() {
+ public Date getStartDatetime()
+ {
return startDatetime;
}
- public void destroy() {
+ public void destroy()
+ {
boolean success = Manager.instance().switchConversation( getId() );
if (success) Manager.instance().endConversation(false);
}
- public void select() {
+ public void select()
+ {
switchConversation();
}
@@ -120,7 +128,8 @@
}
}
- void setViewId(String viewId) {
+ void setViewId(String viewId)
+ {
entries.setDirty(this.viewId, viewId);
this.viewId = viewId;
}
@@ -135,15 +144,18 @@
return viewId;
}
- public synchronized Date getLastDatetime() {
+ public synchronized Date getLastDatetime()
+ {
return lastDatetime;
}
- public List<String> getConversationIdStack() {
+ public List<String> getConversationIdStack()
+ {
return conversationIdStack;
}
- public String getInitiatorComponentName() {
+ public String getInitiatorComponentName()
+ {
return initiatorComponentName;
}
@@ -152,7 +164,8 @@
this.initiatorComponentName = ownerComponentName;
}
- public boolean isDisplayable() {
+ public boolean isDisplayable()
+ {
return !isEnded() && getDescription()!=null;
}
@@ -170,26 +183,31 @@
}
}
- public int compareTo(ConversationEntry entry) {
+ public int compareTo(ConversationEntry entry)
+ {
int result = new Long ( getLastRequestTime() ).compareTo( entry.getLastRequestTime() );
return - ( result==0 ? getId().compareTo( entry.getId() ) : result );
}
- public int getTimeout() {
+ public int getTimeout()
+ {
return timeout==null ?
Manager.instance().getConversationTimeout() : timeout;
}
- void setTimeout(int conversationTimeout) {
+ void setTimeout(int conversationTimeout)
+ {
entries.setDirty(this.timeout, timeout);
this.timeout = conversationTimeout;
}
- public boolean isRemoveAfterRedirect() {
+ public boolean isRemoveAfterRedirect()
+ {
return removeAfterRedirect;
}
- public void setRemoveAfterRedirect(boolean removeAfterRedirect) {
+ public void setRemoveAfterRedirect(boolean removeAfterRedirect)
+ {
entries.setDirty();
this.removeAfterRedirect = removeAfterRedirect;
}
1.111 +56 -44 jboss-seam/src/main/org/jboss/seam/core/Manager.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Manager.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Manager.java,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -b -r1.110 -r1.111
--- Manager.java 3 Nov 2006 22:47:24 -0000 1.110
+++ Manager.java 3 Nov 2006 23:38:27 -0000 1.111
@@ -41,7 +41,7 @@
*
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.110 $
+ * @version $Revision: 1.111 $
*/
@Scope(ScopeType.EVENT)
@Name("org.jboss.seam.core.manager")
@@ -177,6 +177,13 @@
return ce.getDescription();
}
+ public Integer getCurrentConversationTimeout()
+ {
+ ConversationEntry ce = getCurrentConversationEntry();
+ if ( ce==null ) return null;
+ return ce.getTimeout();
+ }
+
public String getCurrentConversationViewId()
{
ConversationEntry ce = getCurrentConversationEntry();
@@ -216,7 +223,8 @@
public boolean isNestedConversation()
{
- return currentConversationIdStack.size()>1;
+ return currentConversationIdStack!=null &&
+ currentConversationIdStack.size()>1;
}
public void setLongRunningConversation(boolean isLongRunningConversation)
@@ -297,9 +305,8 @@
}
/**
- * Touch the conversation stack and flush some state to the
- * conversation context, destroy ended conversations, and
- * timeout inactive conversations.
+ * Touch the conversation stack, destroy ended conversations,
+ * and timeout inactive conversations.
*/
public void endRequest(ContextAdaptor session)
{
@@ -310,7 +317,6 @@
log.debug("Storing conversation state: " + getCurrentConversationId());
}
touchConversationStack( getCurrentConversationIdStack() );
- Conversation.instance().flush();
}
else
{
@@ -909,22 +915,21 @@
* view id for the current page, to support conversation switching.
* Called just before the render phase.
*/
- public void prepareBackswitch(PhaseEvent event) {
- if ( isLongRunningConversation() )
- {
- //important: only do this stuff when a long-running
- // conversation exists, otherwise we would
- // force creation of a conversation entry
+ public void prepareBackswitch(FacesContext facesContext) {
Conversation conversation = Conversation.instance();
//stuff from jPDL takes precedence
- org.jboss.seam.pageflow.Page pageflowPage = Init.instance().isJbpmInstalled() && Pageflow.instance().isInProcess() ?
+ org.jboss.seam.pageflow.Page pageflowPage =
+ isLongRunningConversation() &&
+ Init.instance().isJbpmInstalled() &&
+ Pageflow.instance().isInProcess() ?
Pageflow.instance().getPage() : null;
+
if (pageflowPage==null)
{
//handle stuff defined in pages.xml
- String viewId = event.getFacesContext().getViewRoot().getViewId();
+ String viewId = facesContext.getViewRoot().getViewId();
Pages pages = Pages.instance();
if (pages!=null) //for tests
{
@@ -954,7 +959,14 @@
conversation.setTimeout( pageflowPage.getTimeout() );
}
+ if ( isLongRunningConversation() )
+ {
+ //important: only do this stuff when a long-running
+ // conversation exists, otherwise we would
+ // force creation of a conversation entry
+ conversation.flush();
}
+
}
public String getConversationIdParameter()
More information about the jboss-cvs-commits
mailing list