[jboss-user] [jBPM] - Re: How to Save jBPM 5.1 Process Definition Created via API?

Victor Lewis do-not-reply at jboss.com
Mon Dec 5 10:50:32 EST 2011


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&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111205/d34ccf8b/attachment.html 


More information about the jboss-user mailing list