KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > xpdl > elements > Package


1 package org.enhydra.shark.xpdl.elements;
2
3 import java.util.Collection JavaDoc;
4 import java.util.Iterator JavaDoc;
5 import java.util.Map JavaDoc;
6
7 import org.enhydra.shark.utilities.SequencedHashMap;
8 import org.enhydra.shark.xpdl.XMLAttribute;
9 import org.enhydra.shark.xpdl.XMLComplexElement;
10
11 /**
12  * Represents coresponding element from XPDL schema.
13  *
14  * @author Sasa Bojanic
15  */

16 public class Package extends XMLComplexElement {
17
18    protected Namespaces namespaces;
19    protected String JavaDoc 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); // required
31
XMLAttribute attrName=new XMLAttribute(this,"Name", false);
32       PackageHeader refPackageHeader=new PackageHeader(this);
33       RedefinableHeader refRedefinableHeader=new RedefinableHeader(this); // min=0
34
ConformanceClass refConformanceClass=new ConformanceClass(this); // min=0
35
Script refScript=new Script (this); // min=0
36
ExternalPackages refExternalPackages=new ExternalPackages(this); // min=0
37
TypeDeclarations refTypeDeclarations=new TypeDeclarations(this); // min=0
38
Participants refParticipants=new Participants(this);
39       Applications refApplications=new Applications(this); // min=0
40
DataFields refDataFields=new DataFields(this); // min=0
41
WorkflowProcesses refWorkflowProcesses=new WorkflowProcesses(this); // min=0
42
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 JavaDoc getInternalVersion () {
60       return internalVersion;
61    }
62    
63    public void setInternalVersion (String JavaDoc internalVersion) {
64       this.internalVersion=internalVersion;
65    }
66
67    public void addExternalPackageMapping (String JavaDoc epRef,String JavaDoc epId) {
68       extPkgRefsToIds.put(epRef,epId);
69    }
70    
71    public String JavaDoc getExternalPackageId (String JavaDoc epRef) {
72       return (String JavaDoc)extPkgRefsToIds.get(epRef);
73    }
74    
75    public Collection JavaDoc getExternalPackageIds () {
76       return extPkgRefsToIds.values();
77    }
78    
79    public WorkflowProcess getWorkflowProcess(String JavaDoc Id) {
80       return getWorkflowProcesses().getWorkflowProcess(Id);
81    }
82
83    public Application getApplication (String JavaDoc Id) {
84       return getApplications().getApplication(Id);
85    }
86
87    public Participant getParticipant(String JavaDoc Id) {
88       return getParticipants().getParticipant(Id);
89    }
90
91    public DataField getDataField (String JavaDoc Id) {
92       return getDataFields().getDataField(Id);
93    }
94    
95    public TypeDeclaration getTypeDeclaration (String JavaDoc Id) {
96       return getTypeDeclarations().getTypeDeclaration(Id);
97    }
98    
99    public String JavaDoc getId() {
100       return get("Id").toValue();
101    }
102    public void setId(String JavaDoc id) {
103       set("Id",id);
104    }
105    public String JavaDoc getName() {
106       return get("Name").toValue();
107    }
108    public void setName(String JavaDoc 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 JavaDoc clone () {
149       Package JavaDoc d=(Package JavaDoc)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 JavaDoc e) {
158       boolean equals=super.equals(e);
159       if (equals) {
160          Package JavaDoc el=(Package JavaDoc)e;
161          return (this.namespaces.equals(el.namespaces) && this.internalVersion.equals(el.internalVersion));
162       }
163       return false;
164    }
165 }
166
167
Popular Tags