[jboss-cvs] jboss-seam/src/main/org/jboss/seam/interceptors ...
Gavin King
gavin.king at jboss.com
Sun Oct 1 12:56:54 EDT 2006
User: gavin
Date: 06/10/01 12:56:54
Modified: src/main/org/jboss/seam/interceptors
BusinessProcessInterceptor.java
Added: src/main/org/jboss/seam/interceptors EventInterceptor.java
Log:
@RaiseEvent
Revision Changes Path
1.42 +5 -13 jboss-seam/src/main/org/jboss/seam/interceptors/BusinessProcessInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BusinessProcessInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/BusinessProcessInterceptor.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- BusinessProcessInterceptor.java 29 Sep 2006 22:48:50 -0000 1.41
+++ BusinessProcessInterceptor.java 1 Oct 2006 16:56:54 -0000 1.42
@@ -24,12 +24,13 @@
import org.jboss.seam.annotations.ResumeProcess;
import org.jboss.seam.annotations.StartTask;
import org.jboss.seam.core.BusinessProcess;
+import org.jboss.seam.core.ProcessInstance;
/**
* Interceptor which handles interpretation of jBPM-related annotations.
*
* @author <a href="mailto:steve at hibernate.org">Steve Ebersole </a>
- * @version $Revision: 1.41 $
+ * @version $Revision: 1.42 $
*/
@Interceptor(around={ValidationInterceptor.class, BijectionInterceptor.class, OutcomeInterceptor.class})
public class BusinessProcessInterceptor extends AbstractInterceptor
@@ -40,11 +41,6 @@
@AroundInvoke
public Object manageBusinessProcessContext(InvocationContext invocation) throws Exception
{
- /*Actor actor = Actor.instance();
- boolean isActor = actor!=null && actor.getId()!=null;
- if (isActor) JbpmAuthentication.pushAuthenticatedActorId( actor.getId() );
- try
- {*/
if ( !beforeInvocation(invocation) )
{
return null;
@@ -53,11 +49,6 @@
{
return afterInvocation( invocation, invocation.proceed() );
}
- /*}
- finally
- {
- if (isActor) JbpmAuthentication.popAuthenticatedActorId();
- }*/
}
private boolean beforeInvocation(InvocationContext invocationContext) {
@@ -115,8 +106,9 @@
if ( method.isAnnotationPresent(org.jboss.seam.annotations.Transition.class) )
{
log.trace( "encountered @Transition" );
- String name = method.getAnnotation(org.jboss.seam.annotations.Transition.class).value();
- org.jboss.seam.core.ProcessInstance.instance().signal(name);
+ String transitionName = method.getAnnotation(org.jboss.seam.annotations.Transition.class).value();
+ if ( "".equals(transitionName) ) transitionName = method.getName();
+ ProcessInstance.instance().signal(transitionName);
}
}
return result;
1.1 date: 2006/10/01 16:56:54; author: gavin; state: Exp;jboss-seam/src/main/org/jboss/seam/interceptors/EventInterceptor.java
Index: EventInterceptor.java
===================================================================
package org.jboss.seam.interceptors;
import java.lang.reflect.Method;
import javax.interceptor.AroundInvoke;
import javax.interceptor.InvocationContext;
import org.jboss.seam.annotations.Interceptor;
import org.jboss.seam.annotations.RaiseEvent;
import org.jboss.seam.core.Events;
/**
* Raises Seam events connected with a bean lifecycle.
*
* @author Gavin King
*
*/
@Interceptor(around={BijectionInterceptor.class, ConversationInterceptor.class, TransactionInterceptor.class,
BusinessProcessInterceptor.class, RollbackInterceptor.class, })
public class EventInterceptor extends AbstractInterceptor
{
/*@PostConstruct
public void postConstruct(InvocationContext ctx)
{
Events.instance().raiseEvent("org.jboss.seam.postConstruct." + component.getName());
}
@PreDestroy
public void preDestroy(InvocationContext ctx)
{
Events.instance().raiseEvent("org.jboss.seam.preDestroy." + component.getName());
}
@PrePassivate
public void prePassivate(InvocationContext ctx)
{
Events.instance().raiseEvent("org.jboss.seam.prePassivate." + component.getName());
}
@PostActivate
public void postActivate(InvocationContext ctx)
{
Events.instance().raiseEvent("org.jboss.seam.postActivate." + component.getName());
}*/
@AroundInvoke
public Object aroundInvoke(InvocationContext ctx) throws Exception
{
Object result = ctx.proceed();
Method method = ctx.getMethod();
if ( result!=null || method.getReturnType().equals(void.class) )
{
if ( method.isAnnotationPresent(RaiseEvent.class) )
{
String type = method.getAnnotation(RaiseEvent.class).value();
if ( "".equals(type) ) type = method.getName();
Events.instance().raiseEvent(type);
}
}
return result;
}
}
More information about the jboss-cvs-commits
mailing list