1 package org.jbpm.bpel.service.def; 2 3 import java.io.Serializable ; 4 import java.util.HashSet ; 5 import java.util.Set ; 6 7 import org.jbpm.context.exe.ContextInstance; 8 import org.jbpm.graph.exe.Token; 9 10 import org.jbpm.bpel.service.exe.CorrelationSetInstance; 11 import org.jbpm.bpel.wsdl.def.Property; 12 13 20 public class CorrelationSetDefinition implements Serializable { 21 22 long id; 23 private String name; 24 private Set properties; 25 26 private static final String CSET_PREFIX = "c_"; 27 private static final long serialVersionUID = 1L; 28 29 public String getName() { 30 return name; 31 } 32 33 public void setName(String name) { 34 this.name = name; 35 } 36 37 public void addProperty(Property property) { 38 if (properties == null) { 39 properties = new HashSet (); 40 } 41 properties.add(property); 42 } 43 44 public Set getProperties() { 45 return properties; 46 } 47 48 public void setProperties(Set properties) { 49 this.properties = properties; 50 } 51 52 public CorrelationSetInstance getInstance(Token token) { 53 ContextInstance context = token.getProcessInstance().getContextInstance(); 54 return (CorrelationSetInstance) context.getVariable(CSET_PREFIX + name, token); 55 } 56 57 public CorrelationSetInstance createInstance(Token token) { 58 CorrelationSetInstance instance = new CorrelationSetInstance(); 59 instance.setDefinition(this); 60 ContextInstance context = token.getProcessInstance().getContextInstance(); 61 context.createVariable(CSET_PREFIX + name, instance, token); 62 return instance; 63 } 64 } | Popular Tags |