You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by im...@apache.org on 2007/11/14 19:23:32 UTC

svn commit: r595003 - /myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationUtils.java

Author: imario
Date: Wed Nov 14 10:23:31 2007
New Revision: 595003

URL: http://svn.apache.org/viewvc?rev=595003&view=rev
Log:
added a helper method which allows you to get the proxied version of the current conversation-scoped-backing-bean-instance. Use this instance instead of "this" or implicit-this-of-non-static-inner-classes if you have to call a method from "outside" of the current bean, e.g. wrapper-objects for lists.

Modified:
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationUtils.java

Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationUtils.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationUtils.java?rev=595003&r1=595002&r2=595003&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationUtils.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationUtils.java Wed Nov 14 10:23:31 2007
@@ -54,6 +54,24 @@
 	}
 
 	/**
+	 * returns the bean instance of the bean you are working in which is seen by the "outer"
+	 * framework.
+	 * TODO: find better words to describe what this methods is good for, Simon?
+	 */
+	public static Object getCurrentBean()
+	{
+		CurrentConversationInfo currentConversationInfo = Conversation.getCurrentInstanceInfo();
+		if (currentConversationInfo == null)
+		{
+			return null;
+		}
+
+		String name = currentConversationInfo.getBeanName();
+
+		return FrameworkAdapter.getCurrentInstance().getBean(name);
+	}
+
+	/**
 	 * End and restart the current conversation.
 	 * <p>
 	 * In contrast to {@link #invalidateAndRestart(Conversation)} this