-
Aug 31st, 2008, 06:29 AM
#11
bit of progress
I have come up with a solution for this in my project and thought I would post for anyone who has the same problem. The Class is declared ServletContextAware. The portfolio is the object i am reading and writing out. Hopefully this is clear enough. Bit of a bugger to figure out until i come accross the ExternalContextHolder method which is what i was missing at first.
write to flowscope
public void setPortfolio(String key, Portfolio portfolio, HttpServletRequest req) {
ExternalContextHolder.setExternalContext(new ServletExternalContext(servletContext, req, null));
FlowExecutionRepository executionRepository = ((FlowExecutorImpl) flowExecutor).getExecutionRepository();
FlowExecution flowExecution = executionRepository.getFlowExecution(executionRepo sitory.parseFlowExecutionKey(key));
FlowSession flowSession = flowExecution.getActiveSession();
flowSession.getScope().put("Portfolio", portfolio);
executionRepository.putFlowExecution(flowExecution );
}
Read from flowscope
public Portfolio getPortfolio(String key, HttpServletRequest req) {
ExternalContextHolder.setExternalContext(new ServletExternalContext(servletContext, req, null));
FlowExecutionRepository executionRepository = ((FlowExecutorImpl) flowExecutor).getExecutionRepository();
FlowExecution flowExecution = executionRepository.getFlowExecution(executionRepo sitory.parseFlowExecutionKey(key));
FlowSession flowSession = flowExecution.getActiveSession();
flowSession.getScope().get("Portfolio");
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules