1 package org.enhydra.shark.xpdl.elements; 2 3 import java.util.Collection ; 4 import java.util.Iterator ; 5 import java.util.Map ; 6 7 import org.enhydra.shark.utilities.SequencedHashMap; 8 import org.enhydra.shark.xpdl.XMLAttribute; 9 import org.enhydra.shark.xpdl.XMLComplexElement; 10 11 16 public class Package extends XMLComplexElement { 17 18 protected Namespaces namespaces; 19 protected String internalVersion; 20 21 protected SequencedHashMap extPkgRefsToIds=new SequencedHashMap(); 22 23 public Package () { 24 super(null, true); 25 namespaces=new Namespaces(this); 26 internalVersion="-1"; 27 } 28 29 protected void fillStructure () { 30 XMLAttribute attrId=new XMLAttribute(this,"Id", true); XMLAttribute attrName=new XMLAttribute(this,"Name", false); 32 PackageHeader refPackageHeader=new PackageHeader(this); 33 RedefinableHeader refRedefinableHeader=new RedefinableHeader(this); ConformanceClass refConformanceClass=new ConformanceClass(this); Script refScript=new Script (this); ExternalPackages refExternalPackages=new ExternalPackages(this); TypeDeclarations refTypeDeclarations=new TypeDeclarations(this); Participants refParticipants=new Participants(this); 39 Applications refApplications=new Applications(this); DataFields refDataFields=new DataFields(this); WorkflowProcesses refWorkflowProcesses=new WorkflowProcesses(this); ExtendedAttributes refExtendedAttributes=new ExtendedAttributes(this); 43 44 add(attrId); 45 add(attrName); 46 add(refPackageHeader); 47 add(refRedefinableHeader); 48 add(refConformanceClass); 49 add(refScript); 50 add(refExternalPackages); 51 add(refTypeDeclarations); 52 add(refParticipants); 53 add(refApplications); 54 add(refDataFields); 55 add(refWorkflowProcesses); 56 add(refExtendedAttributes); 57 } 58 59 public String getInternalVersion () { 60 return internalVersion; 61 } 62 63 public void setInternalVersion (String internalVersion) { 64 this.internalVersion=internalVersion; 65 } 66 67 public void addExternalPackageMapping (String epRef,String epId) { 68 extPkgRefsToIds.put(epRef,epId); 69 } 70 71 public String getExternalPackageId (String epRef) { 72 return (String )extPkgRefsToIds.get(epRef); 73 } 74 75 public Collection getExternalPackageIds () { 76 return extPkgRefsToIds.values(); 77 } 78 79 public WorkflowProcess getWorkflowProcess(String Id) { 80 return getWorkflowProcesses().getWorkflowProcess(Id); 81 } 82 83 public Application getApplication (String Id) { 84 return getApplications().getApplication(Id); 85 } 86 87 public Participant getParticipant(String Id) { 88 return getParticipants().getParticipant(Id); 89 } 90 91 public DataField getDataField (String Id) { 92 return getDataFields().getDataField(Id); 93 } 94 95 public TypeDeclaration getTypeDeclaration (String Id) { 96 return getTypeDeclarations().getTypeDeclaration(Id); 97 } 98 99 public String getId() { 100 return get("Id").toValue(); 101 } 102 public void setId(String id) { 103 set("Id",id); 104 } 105 public String getName() { 106 return get("Name").toValue(); 107 } 108 public void setName(String name) { 109 set("Name",name); 110 } 111 public Applications getApplications() { 112 return (Applications)get("Applications"); 113 } 114 public ConformanceClass getConformanceClass() { 115 return (ConformanceClass)get("ConformanceClass"); 116 } 117 public DataFields getDataFields() { 118 return (DataFields)get("DataFields"); 119 } 120 public ExtendedAttributes getExtendedAttributes() { 121 return (ExtendedAttributes)get("ExtendedAttributes"); 122 } 123 public ExternalPackages getExternalPackages() { 124 return (ExternalPackages)get("ExternalPackages"); 125 } 126 public PackageHeader getPackageHeader() { 127 return (PackageHeader)get("PackageHeader"); 128 } 129 public Participants getParticipants() { 130 return (Participants)get("Participants"); 131 } 132 public RedefinableHeader getRedefinableHeader() { 133 return (RedefinableHeader)get("RedefinableHeader"); 134 } 135 public Script getScript() { 136 return (Script)get("Script"); 137 } 138 public TypeDeclarations getTypeDeclarations() { 139 return (TypeDeclarations)get("TypeDeclarations"); 140 } 141 public WorkflowProcesses getWorkflowProcesses() { 142 return (WorkflowProcesses)get("WorkflowProcesses"); 143 } 144 public Namespaces getNamespaces() { 145 return namespaces; 146 } 147 148 public Object clone () { 149 Package d=(Package )super.clone(); 150 d.namespaces=(Namespaces)this.namespaces.clone(); 151 d.extPkgRefsToIds=new SequencedHashMap(extPkgRefsToIds); 152 d.clearCaches(); 153 if (d.isReadOnly) d.initCaches(); 154 return d; 155 } 156 157 public boolean equals (Object e) { 158 boolean equals=super.equals(e); 159 if (equals) { 160 Package el=(Package )e; 161 return (this.namespaces.equals(el.namespaces) && this.internalVersion.equals(el.internalVersion)); 162 } 163 return false; 164 } 165 } 166 167 | Popular Tags |