1 package org.jbpm.bpel.def; 2 3 import java.io.Serializable ; 4 import java.util.List ; 5 6 import org.jbpm.graph.exe.ExecutionContext; 7 import org.jbpm.graph.exe.Token; 8 9 16 public class Assign extends Activity { 17 18 private static final long serialVersionUID = 1L; 19 20 private List copies; 21 22 public Assign() { 23 super(); 24 } 25 26 public Assign(String name) { 27 super(name); 28 } 29 30 public void execute(ExecutionContext context) { 31 Token token = context.getToken(); 32 33 for (int i = 0, n = copies.size(); i < n; i++) { 34 ((Copy) copies.get(i)).copyValue(token); 35 } 36 leave(context); 37 } 38 39 public List getCopies() { 40 return copies; 41 } 42 43 public void setCopies(List copies) { 44 this.copies = copies; 45 } 46 47 public static class Copy implements Serializable { 48 49 private static final long serialVersionUID = 1L; 50 51 long id; 52 private From from; 53 private To to; 54 55 public From getFrom() { 56 return from; 57 } 58 59 public void setFrom(From from) { 60 this.from = from; 61 } 62 63 public To getTo() { 64 return to; 65 } 66 67 public void setTo(To to) { 68 this.to = to; 69 } 70 71 public void copyValue(Token token) { 72 to.assign(token, from.extract(token)); 73 } 74 } 75 76 public static abstract class From implements Serializable { 77 78 long id; 79 80 public abstract Object extract(Token token); 81 } 82 83 public static abstract class To implements Serializable { 84 85 long id; 86 87 public abstract void assign(Token token, Object value); 88 } 89 90 91 public void accept(BpelVisitor visitor) { 92 visitor.visit(this); 93 } 94 } 95 | Popular Tags |