Victor Lewis [
http://community.jboss.org/people/victor.lewis] created the discussion
"Re: How to Save jBPM 5.1 Process Definition Created via API?"
To view the discussion, visit:
http://community.jboss.org/message/639861#639861
--------------------------------------------------------------
Estelle,
The exception you show isn't complaining about your cast to a WorkflowProcess but
looks to be deeper in the call to dump (although I cannot tell because you cut off the
stack trace). It says you have an instance of org.jbpm.context.def.ContextDefinition that
is trying to be cast to org.drools.process.core.Context. I don't know where the
org.jbpm.context.def.ContextDefinition is being created but it probably a part of
processDefinition. The stack trace with the exception should tell you where the cast is
being done.
Here is the code I use to get thet XML:
protected String xmlForProcess(ProcessDefinitionDTO procDef, List<WorkflowNode>
nodes, RPCResult result) {
RuleFlowProcessFactory factory =
processDefinitionService.createProcesFactory(procDef.getIdString());
factory.version("1");
factory.packageName("com.stuff.pbm");
factory.name(procDef.getName());
addNodesToProcess(nodes, factory);
addLinksToProcess(procDef, factory);
RuleFlowProcess process = factory.getProcess();
ProcessValidationError[] errors =
RuleFlowProcessValidator.getInstance().validateProcess(process);
for (ProcessValidationError e : errors) {
result.addMessage(new MessageDTO(MessageCategory.WARNING, e.getMessage()));
}
String asXml = XmlBPMNProcessDumper.INSTANCE.dump(process,
XmlBPMNProcessDumper.NO_META_DATA);
return asXml;
}
where
processDefinitionService.createProcessFactory
returns a
org.jbpm.ruleflow.core.RuleFlowProcessFactory
.
I hope this helps.
-Victor
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/639861#639861]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]