PDA

View Full Version : I need to select FlowFactoryBean with portlet preference...



garpinc2
Jun 3rd, 2005, 10:23 PM
I need to select FlowFactoryBean with portlet preference... Is that possible.

The reason I want do this for a portlet application that runs different flows dependent on the preference setting to avoid creating multiple portlets with all the redundant config. I just want one portlet that does different but similar things depending on the selected preference. I intend for these preferences to be read only but of course I could change that as per the portlet spec...

If it's not currently possible then please point me in the path that I can address that functionality.

garpinc2
Jun 3rd, 2005, 11:42 PM
I don't think this will work... Since I think these objects will be singletons...

So I guess this would have to be done at portlet initialization though
init-param

But I don't want to have to do the same thing over and over again in xml specified by contextConfigLocation. So what I need is a way to not have to do that...

A suggestion would be appreciated...

klr8
Jun 4th, 2005, 04:12 AM
So if I understand this correctly, you want to configure your portlet with the id of the flow it should use? I would say: just configure all your flows as in a normal case in the application context. Then have a custom PortletFlowController that looks at the config info to determine what flow to run.

Note that the fact that the flow definitions (created by the FlowFactoryBean) are singletons is of little importance. The flow definition is just a static object that can be shared by any numer of threads. The runtime information will be held in a FlowExecution/RequestContext!

Erwin

garpinc2
Jun 4th, 2005, 02:09 PM
PorletFlowControllers use flowExecutionManager to execute the flow. These are also singletons and are assigned to a flow right?

klr8
Jun 6th, 2005, 02:19 AM
The FlowExecutionManagers are singletons, because they are 'owned' by the singleton controllers (e.g. PortletFlowController).

I'm not sure what you mean with "are assigned to a flow right". The FlowExecutionManager starts and manages a FlowExecution for a Flow, it is not "assigned" to any particular flow, so a single FlowExecutionManager could be managing several FlowExecutions concurrently.

Erwin

garpinc2
Jun 6th, 2005, 05:59 PM
Well in PortletFlowController code I see:

public void setFlow(Flow flow) {
this.flowExecutionManager.setFlow(flow);
}

so the flow is assigned the the flowExecutionManager assigned to the PortletFlowController.

and in FlowExecutionManager there is only one flow member variable so I don't see what you mean by a flow execution manager having multiple flows... Please explain...

klr8
Jun 11th, 2005, 01:58 AM
The flow set by FlowExecutionManager.setFlow() is the "default top-level" flow. From the JavaDoc:


public void setFlow(Flow flow)
Set the flow whose executions will be managed if there is no alternate flow id specified in a "_flowId" event parameter.

The FlowExecutionManager doesn't keep track of a particular flow execution, so it is perfectly capable of managing several different flow executions, for different flows, concurrently.

Erwin

garpinc2
Jun 26th, 2005, 12:03 PM
Ok... Finally I understand... But I can't find a way to pass _flowId as a request parameter through custom PortletFlowController.. Can you help? request doesn't have any methods to allow you to set parameters... And that's the only way it seems to set flow... Seems like workflow code would need to change to look for _flowId in either request attributes or params...

garpinc2
Jun 26th, 2005, 11:05 PM
Ok... Finally I understand... But I can't find a way to pass _flowId as a request parameter through custom PortletFlowController.. Can you help? request doesn't have any methods to allow you to set parameters... And that's the only way it seems to set flow... Seems like workflow code would need to change to look for _flowId in either request attributes or params...

I opened JIRA on this issue:

http://opensource.atlassian.com/projects/spring/browse/SPR-1079