-
1. Re: WorkflowProcessInstanceUpgrader throwing ClassCastException: ...CommandBasedStatefulKnowledgeSession cannot be cast to ...InternalKnowledgeRuntime
zabalet Jan 11, 2013 8:44 AM (in response to zabalet)Ok, have sense... CommandBasedStatefulKnowledgeSession is more like a wrapper. So, this works, although I´m not sure about so much casting...
CommandBasedStatefulKnowledgeSession commandBasedKSession = (CommandBasedStatefulKnowledgeSession) knowledgeSession;
CommandService commandService = commandBasedKSession.getCommandService();
SingleSessionCommandService singleSessionCommandService = (SingleSessionCommandService) commandService;
StatefulKnowledgeSession statefulKnowledgeSession = singleSessionCommandService.getStatefulKnowledgeSession();
WorkflowProcessInstanceUpgrader.upgradeProcessInstance(statefulKnowledgeSession , processInstance.getId(), targetProcessDefinitionId, mapping);
-
2. Re: WorkflowProcessInstanceUpgrader throwing ClassCastException: ...CommandBasedStatefulKnowledgeSession cannot be cast to ...InternalKnowledgeRuntime
swiderski.maciej Jan 11, 2013 10:20 AM (in response to zabalet)Marcelo, maybe you could try something like this instead of all this casts:
StatefulKnowledgeSession ks = ksession.execute(new GenericCommand<StatefulKnowledgeSession>() {
public StatefulKnowledgeSession execute(Context context) {
return ((KnowledgeCommandContext) context).getStatefulKnowledgesession();
}
});
where ksession is CommandBasedStatefulKnowledgeSession and ks will be its undelying InternalKnowledgeRuntime.
HTH
-
3. Re: WorkflowProcessInstanceUpgrader throwing ClassCastException: ...CommandBasedStatefulKnowledgeSession cannot be cast to ...InternalKnowledgeRuntime
zabalet Jan 11, 2013 10:39 AM (in response to swiderski.maciej)Ah! I see it now, this and the other post . Thanks a lot Maciej.