-
1. Re: Calling a @CreateProcess method
pmuir Aug 31, 2006 4:36 AM (in response to dgallego)Can you post the relevant section of the session bean code?
-
2. Re: Calling a @CreateProcess method
dgallego Aug 31, 2006 4:50 AM (in response to dgallego)This is the bean invoked within the transition in the pageflow. The method "isMessageSent" is used to redirect (evaluate decision in pageflow) to different webpages if the message has been successfully sent.
import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.*; import org.jboss.seam.core.Actor; import org.jboss.seam.InterceptionType; @Name("contactAction") @Scope(ScopeType.EVENT) @Intercept(InterceptionType.ALWAYS) @Transactional public class ContactAction { @In(create=true) private Actor actor; private String name; private String email; private String message; @Out(scope=ScopeType.BUSINESS_PROCESS) private int messageId; private boolean messageSent; @Create @Begin(join=true, pageflow="Contact") public void begin() { messageSent = false; } public void sendMessage() { System.out.println("Hibernate..."); messageSent = true; // hibernate doesn't fail, we suppose in the example.... if (messageSent) startProcessDefinition(); } @CreateProcess(definition="MessageContact") public void startProcessDefinition() { System.out.println("Creating process instance"); // If this method is invoked from a button, perfect. But I want to create a process instance if the message is successfully sent (in sendMessage(). } public boolean isMessageSent() { return messageSent; } public void doAction() { System.out.println("doAction!!"); } public String getDescription() { return "Nuevo Mensaje"; } @Destroy public void destroy() { System.out.println("Destroy"); } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
A solution could be:
Add @CreateProcess to sendMessage() method, but I don't want a process instance to be created when the user sends a message.
I want to create the process instance when the message is successfully sent, i mean, I want to decide its creation.
Thanks for the replies. -
3. Re: Calling a @CreateProcess method
pmuir Aug 31, 2006 5:01 AM (in response to dgallego)Calls to this.methodName() aren't intercepted so the @CreateProcess annotation isn't used.
-
4. Re: Calling a @CreateProcess method
dgallego Aug 31, 2006 5:07 AM (in response to dgallego)And how could I create a process instance manually from sendMessage()?
-
5. Re: Calling a @CreateProcess method
pmuir Aug 31, 2006 6:09 PM (in response to dgallego)After hunting through the source code
@In(create=true) BusinessProcess businessProcess; businessProcess.createProcess("myProcessName");
orBusinessProcess.instance().createProcess("processName");
-
6. Re: Calling a @CreateProcess method
dgallego Sep 1, 2006 3:14 AM (in response to dgallego)I can't see the BusinessProcess class, only the BusinessProcessContext.
If I try to inject the businessProcessContext built-in seam component, it fails.
But businessProcessContext can't create process instances.
Thanks. -
7. Re: Calling a @CreateProcess method
pmuir Sep 1, 2006 4:19 AM (in response to dgallego)Ah. I was at home and looking at the cvs head not at 1.0.1.GA. So if you want it either wait for 1.1 or grab cvs.
-
8. Re: Calling a @CreateProcess method
dgallego Sep 1, 2006 4:25 AM (in response to dgallego)Thanks.
I'll wait for the new Seam version.