1 package org.enhydra.shark.xpdl.elements; 2 3 import java.util.HashMap ; 4 import java.util.Map ; 5 6 import org.enhydra.shark.xpdl.XMLAttribute; 7 import org.enhydra.shark.xpdl.XMLCollectionElement; 8 9 14 public class Transition extends XMLCollectionElement { 15 16 protected transient Activity toActivity; 17 protected transient Activity fromActivity; 18 19 public Transition (Transitions parent) { 20 super(parent, true); 21 } 22 23 protected void fillStructure () { 24 XMLAttribute attrFrom=new XMLAttribute(this,"From", true); XMLAttribute attrTo=new XMLAttribute(this,"To", true); XMLAttribute attrName=new XMLAttribute(this,"Name", false); 27 Condition refCondition=new Condition(this); Description refDescription=new Description(this); ExtendedAttributes refExtendedAttributes=new ExtendedAttributes(this); 31 32 super.fillStructure(); 33 add(attrName); 34 add(attrFrom); 35 add(attrTo); 36 add(refCondition); 37 add(refDescription); 38 add(refExtendedAttributes); 39 } 40 41 public void initCaches () { 42 super.initCaches(); 43 Activities acts; 44 if (getParent().getParent() instanceof WorkflowProcess) { 45 acts=((WorkflowProcess)getParent().getParent()).getActivities(); 46 } else { 47 acts=((ActivitySet)getParent().getParent()).getActivities(); 48 } 49 toActivity=acts.getActivity(getTo()); 50 fromActivity=acts.getActivity(getFrom()); 51 } 52 53 public void clearCaches () { 54 toActivity=null; 55 fromActivity=null; 56 super.clearCaches(); 57 } 58 59 public Activity getToActivity () { 60 if (!isReadOnly) { 61 throw new RuntimeException ("This method can be used only in read-only mode!"); 62 } 63 return toActivity; 64 } 65 66 public Activity getFromActivity () { 67 if (!isReadOnly) { 68 throw new RuntimeException ("This method can be used only in read-only mode!"); 69 } 70 return fromActivity; 71 } 72 73 public String getFrom() { 74 return get("From").toValue(); 75 } 76 public void setFrom(String from) { 77 set("From",from); 78 } 79 public String getTo() { 80 return get("To").toValue(); 81 } 82 public void setTo(String to) { 83 set("To",to); 84 } 85 public String getName() { 86 return get("Name").toValue(); 87 } 88 public void setName(String name) { 89 set("Name",name); 90 } 91 public String getDescription() { 92 return get("Description").toValue(); 93 } 94 public void setDescription(String description) { 95 set("Description",description); 96 } 97 public Condition getCondition() { 98 return (Condition)get("Condition"); 99 } 100 public ExtendedAttributes getExtendedAttributes() { 101 return (ExtendedAttributes)get("ExtendedAttributes"); 102 } 103 } 104 | Popular Tags |