현재로서는이 변수를 GenericCommand
으로 업데이트 중입니다.
kSession.execute(new GenericCommand<Boolean>() {
public Boolean execute(Context context) {
//Get session in the command context
StatefulKnowledgeSession ksession = ((KnowledgeCommandContext) context).getStatefulKnowledgesession();
//Get the process instance
ProcessInstance processInstance = (ProcessInstance) ksession.getProcessInstance(processInstanceId);
//Get variable scoprts
VariableScopeInstance variableScope = (VariableScopeInstance) processInstance.getContextInstance(VariableScope.VARIABLE_SCOPE);
Iterator<String> piStateItr=piStateVariables.keySet().iterator();
//Modify required variables
while(piStateItr.hasNext()){
String variableName=piStateItr.next();
String variableValue=piStateVariables.get(variableName);
logger.debug(">>> Setting State - key "+variableName +" , to "+variableValue);
variableScope.setVariable(variableName, variableValue);
}
return true;
}
});
익명의 GenericCommand가 정상적으로 작동합니다. –
안녕하세요, 귀하의 코드 주셔서 감사합니다, 나는 같은 문제에 직면하고있어. 'processInstanceId' 변수를 어떻게 가져 왔습니까? – ocramot
@ocramot, processInstanceId는 주어진 코드를 둘러싸고있는 메소드를 위해 입력된다. –