1 package org.jbpm.bpel.data.def; 2 3 import java.io.Serializable ; 4 5 import org.jbpm.context.exe.ContextInstance; 6 import org.jbpm.graph.exe.Token; 7 8 import org.jbpm.bpel.data.exe.VariableInstance; 9 10 18 public class VariableDefinition implements Serializable { 19 20 long id; 21 private String name; 22 private VariableTypeInfo typeInfo; 23 24 private static final long serialVersionUID = 1L; 25 26 public VariableDefinition() { 27 } 28 29 public VariableDefinition(String name) { 30 this.name = name; 31 } 32 33 public String getName() { 34 return name; 35 } 36 37 public void setName(String name) { 38 this.name = name; 39 } 40 41 public VariableTypeInfo getTypeInfo() { 42 return typeInfo; 43 } 44 45 public void setTypeInfo(VariableTypeInfo type) { 46 this.typeInfo = type; 47 } 48 49 54 public VariableInstance createInstance(Token token) { 55 VariableInstance instance = typeInfo.createVariableInstance(); 56 instance.setDefinition(this); 57 ContextInstance contextInstance = token.getProcessInstance().getContextInstance(); 58 contextInstance.createVariable(name, instance, token); 59 return instance; 60 } 61 62 67 public VariableInstance getInstance(Token token) { 68 ContextInstance context = token.getProcessInstance().getContextInstance(); 69 return (VariableInstance) context.getVariable(name, token); 70 } 71 } 72 | Popular Tags |