Ok, I got it by having a FlowService bean, knowing the default flowRegistry. It got this method:
Code:
public void register(String id, String path) {
FileSystemResource resource=new FileSystemResource(servletContext.getRealPath(path));
System.out.println("PATH:::::::::::::::::::::::::::::::::::::::::"+
servletContext.getRealPath("/WEB-INF/flows/purchase-flow.xml")+" exists?: "+ resource.exists());
FlowDefinitionResource flowDefinitionResource = new FlowDefinitionResource(id, resource, null);
XmlFlowModelBuilder flowModelBuilder = new XmlFlowModelBuilder(flowDefinitionResource.getPath(), null);
DefaultFlowModelHolder flowModelHolder = new DefaultFlowModelHolder(flowModelBuilder);
FlowModelFlowBuilder flowBuilder=new FlowModelFlowBuilder(flowModelHolder);
//attributes=null .... ??
FlowBuilderContextImpl flowBuilderContext= new FlowBuilderContextImpl(path, CollectionUtils.EMPTY_ATTRIBUTE_MAP, flowRegistry, flowBuilderServices);
DefaultFlowHolder definitionHolder = new DefaultFlowHolder(new FlowAssembler(flowBuilder, flowBuilderContext));
flowRegistry.registerFlowDefinition(definitionHolder);
}
The init-method of FlowService is this one:
Code:
public void init() {
register("flow", "/WEB-INF/flows/purchase-flow.xml");
register("flow", "/WEB-INF/flows/addToBasket-flow.xml");
register("flow", "/WEB-INF/flows/trader-flow.xml");
System.out.println("FLOWIDS###############################################");
for(String s: flowRegistry.getFlowDefinitionIds()) {
System.out.println("FLOWID:::::::::::::::::::::::::"+s);
}
}
The sysout delivers:
[INFO] FLOWIDS########################################### ####
[INFO] FLOWID:::::::::::::::::::::::::/WEB-INF/flows/addToBasket-flow.xml
[INFO] FLOWID:::::::::::::::::::::::::/WEB-INF/flows/purchase-flow.xml
[INFO] FLOWID:::::::::::::::::::::::::/WEB-INF/flows/trader-flow.xml
How can I change the IDs of the flows (Since by now, my "String id" is pretty useless) ?
EDIT: Erased something useless.
Nils