ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package org.jbpm.jpdl.internal.rules;
 
import org.drools.runtime.Globals;
import org.jbpm.api.Execution;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.model.ExecutionImpl;
 
public class ExecutionGlobals implements Globals {
  
  private static final Log log = Log.getLog(ExecutionGlobals.class.getName());
 
  ExecutionImpl execution;
  Outcome outcome = new Outcome();
  
  public ExecutionGlobals(Execution execution) {
    this.execution = (ExecutionImpl) execution;
  }
 
  public Object get(String variableName) {
    if ("execution".equals(variableName)) {
      log.info("returning execution");
      return execution;
    }
    if ("outcome".equals(variableName)) {
      log.info("returning outcome");
      return outcome;
    }
    Object variableValue = execution.getVariable(variableName);
    log.info("returning variable "+variableName+": "+variableValue);
    return variableValue;
  }
 
  public void set(String variableName, Object value) {
    throw new UnsupportedOperationException();
  }
 
  public void setDelegate(Globals globals) {
    throw new UnsupportedOperationException();
  }
  public Outcome getOutcome() {
    return outcome;
  }
}