View Javadoc

1   package ca.uhn.hl7v2.conf.spec;
2   
3   import ca.uhn.hl7v2.conf.spec.usecase.UseCase;
4   import ca.uhn.hl7v2.conf.spec.message.StaticDef;
5   import ca.uhn.hl7v2.conf.ProfileException;
6   
7   /**
8    * A conformance specification (see HL7 2.5 section 2.12).  
9    * @author Bryan Tripp
10   */
11  public class RuntimeProfile {
12      
13      private Conformance conformance;
14      /** Holds value of property conformanceType. */
15      private String conformanceType;
16      private Encoding[] encodings;
17      /** Holds value of property HL7OID. */
18      private String HL7OID;
19      /** Holds value of property HL7Version. */
20      private String HL7Version;
21          
22      private String impNote;
23      
24      /** Holds value of property message. */
25      private StaticDef message;
26      
27      /** Holds value of property orgName. */
28      private String orgName;
29      
30      /** Utility field used by bound properties. */
31      private java.beans.PropertyChangeSupport propertyChangeSupport =  new java.beans.PropertyChangeSupport(this);
32      
33      /** Holds value of property role. */
34      private String role;
35      
36      /** Holds value of property specName. */
37      private String specName;
38      
39      /** Holds value of property specVersion. */
40      private String specVersion;
41      
42      /** Holds value of property status. */
43      private String status;
44      
45      private UseCase useCase;
46      
47      /** Utility field used by constrained properties. */
48      private java.beans.VetoableChangeSupport vetoableChangeSupport =  new java.beans.VetoableChangeSupport(this);
49  	private String name;
50      
51      /** Creates a new instance of Specification */
52      public RuntimeProfile() {
53      }
54      
55      /** Adds a PropertyChangeListener to the listener list.
56       * @param l The listener to add.
57       */
58      public void addPropertyChangeListener(java.beans.PropertyChangeListener l) {
59          propertyChangeSupport.addPropertyChangeListener(l);
60      }
61      
62      /** Adds a VetoableChangeListener to the listener list.
63       * @param l The listener to add.
64       */
65      public void addVetoableChangeListener(java.beans.VetoableChangeListener l) {
66          vetoableChangeSupport.addVetoableChangeListener(l);
67      }
68      
69      /** Getter for property conformance.
70       * @return Value of property conformance.
71       */
72      public Conformance getConformance() {
73          return this.conformance;
74      }
75      
76      /** Getter for property conformanceType.
77       * @return Value of property conformanceType.
78       */
79      public String getConformanceType() {
80          return this.conformanceType;
81      }
82      
83      /** Indexed getter for property encodings.
84       * @param index Index of the property.
85       * @return Value of the property at <CODE>index</CODE>.
86       */
87      public Encoding getEncodings(int index) {
88          return this.encodings[index];
89      }
90      
91      /** Getter for property HL7OID.
92       * @return Value of property HL7OID.
93       */
94      public String getHL7OID() {
95          return this.HL7OID;
96      }
97      
98      /** Getter for property HL7Version.
99       * @return Value of property HL7Version.
100      */
101     public String getHL7Version() {
102         return this.HL7Version;
103     }
104     
105     /** Getter for property impNote.
106      * @return Value of property impNote.
107      */
108     public String getImpNote() {
109         return this.impNote;
110     }
111     
112     /** Getter for property message.
113      * @return Value of property message.
114      */
115     public StaticDef getMessage() {
116         return this.message;
117     }
118     
119     /** Getter for property orgName.
120      * @return Value of property orgName.
121      */
122     public String getOrgName() {
123         return this.orgName;
124     }
125     
126     /** Getter for property role.
127      * @return Value of property role.
128      */
129     public String getRole() {
130         return this.role;
131     }
132     
133     /** Getter for property specName.
134      * @return Value of property specName.
135      */
136     public String getSpecName() {
137         return this.specName;
138     }
139     
140     /** Getter for property specVersion.
141      * @return Value of property specVersion.
142      */
143     public String getSpecVersion() {
144         return this.specVersion;
145     }
146     
147     /** Getter for property status.
148      * @return Value of property status.
149      */
150     public String getStatus() {
151         return this.status;
152     }
153     
154     /** Getter for property useCase.
155      * @return Value of property useCase.
156      */
157     public UseCase getUseCase() {
158         return this.useCase;
159     }
160     
161     /** Removes a PropertyChangeListener from the listener list.
162      * @param l The listener to remove.
163      */
164     public void removePropertyChangeListener(java.beans.PropertyChangeListener l) {
165         propertyChangeSupport.removePropertyChangeListener(l);
166     }
167     
168     /** Removes a VetoableChangeListener from the listener list.
169      * @param l The listener to remove.
170      */
171     public void removeVetoableChangeListener(java.beans.VetoableChangeListener l) {
172         vetoableChangeSupport.removeVetoableChangeListener(l);
173     }
174     
175     /** Setter for property conformance.
176      * @param conformance New value of property conformance.
177      *
178      * @throws ProfileException
179      */
180     public void setConformance(Conformance conformance) throws ProfileException {
181         Conformance oldConformance = this.conformance;
182         try {
183             vetoableChangeSupport.fireVetoableChange("conformance", oldConformance, conformance);
184         } catch (Exception e) {
185             throw new ProfileException(null, e);
186         }
187         this.conformance = conformance;
188         propertyChangeSupport.firePropertyChange("conformance", oldConformance, conformance);
189     }
190     
191     /** Setter for property conformanceType.
192      * @param conformanceType New value of property conformanceType.
193      *
194      * @throws ProfileException
195      */
196     public void setConformanceType(String conformanceType) throws ProfileException {
197         String oldConformanceType = this.conformanceType;
198         try {
199             vetoableChangeSupport.fireVetoableChange("conformanceType", oldConformanceType, conformanceType);
200         } catch (Exception e) {
201             throw new ProfileException(null, e);
202         }
203         this.conformanceType = conformanceType;
204         propertyChangeSupport.firePropertyChange("conformanceType", oldConformanceType, conformanceType);
205     }
206     
207     /** Indexed setter for property encodings.
208      * @param index Index of the property.
209      * @param encodings New value of the property at <CODE>index</CODE>.
210      *
211      * @throws ProfileException
212      */
213     public void setEncodings(int index, Encoding encodings) throws ProfileException {
214         Encoding oldEncodings = this.encodings[index];
215         this.encodings[index] = encodings;
216         try {
217             vetoableChangeSupport.fireVetoableChange("encodings", null, null );
218         }
219         catch(java.beans.PropertyVetoException vetoException ) {
220             this.encodings[index] = oldEncodings;
221             throw new ProfileException(null, vetoException);
222         }
223         propertyChangeSupport.firePropertyChange("encodings", null, null );
224     }
225     
226     /** Setter for property HL7OID.
227      * @param HL7OID New value of property HL7OID.
228      *
229      * @throws ProfileException
230      */
231     public void setHL7OID(String HL7OID) throws ProfileException {
232         String oldHL7OID = this.HL7OID;
233         try {
234             vetoableChangeSupport.fireVetoableChange("HL7OID", oldHL7OID, HL7OID);
235         } catch (Exception e) {
236             throw new ProfileException(null, e);
237         }
238         this.HL7OID = HL7OID;
239         propertyChangeSupport.firePropertyChange("HL7OID", oldHL7OID, HL7OID);
240     }
241     
242     /** Setter for property HL7Version.
243      * @param HL7Version New value of property HL7Version.
244      *
245      * @throws ProfileException
246      */
247     public void setHL7Version(String HL7Version) throws ProfileException {
248         String oldHL7Version = this.HL7Version;
249         try {
250             vetoableChangeSupport.fireVetoableChange("HL7Version", oldHL7Version, HL7Version);
251         } catch (Exception e) {
252             throw new ProfileException(null, e);
253         }
254         this.HL7Version = HL7Version;
255         propertyChangeSupport.firePropertyChange("HL7Version", oldHL7Version, HL7Version);
256     }
257     
258     /** Setter for property impNote.
259      * @param impNote New value of property impNote.
260      *
261      * @throws ProfileException
262      */
263     public void setImpNote(String impNote) throws ProfileException {
264         String oldImpNote = this.impNote;
265         try {
266             vetoableChangeSupport.fireVetoableChange("impNote", oldImpNote, impNote);
267         } catch (Exception e) {
268             throw new ProfileException(null, e);
269         }
270         this.impNote = impNote;
271         propertyChangeSupport.firePropertyChange("impNote", oldImpNote, impNote);
272     }
273     
274     /** Setter for property message.
275      * @param message New value of property message.
276      *
277      * @throws ProfileException
278      */
279     public void setMessage(StaticDef message) throws ProfileException {
280         StaticDef oldMessage = this.message;
281         try {
282             vetoableChangeSupport.fireVetoableChange("message", oldMessage, message);
283         } catch (Exception e) {
284             throw new ProfileException(null, e);
285         }
286         this.message = message;
287         propertyChangeSupport.firePropertyChange("message", oldMessage, message);
288     }
289     
290     public void setName(String theName) throws ProfileException {
291         String oldOrgName = this.name;
292         try {
293             vetoableChangeSupport.fireVetoableChange("name", oldOrgName, theName);
294         } catch (Exception e) {
295             throw new ProfileException(null, e);
296         }
297         this.name = theName;
298         propertyChangeSupport.firePropertyChange("name", oldOrgName, theName);
299 	}
300     
301     /**
302 	 * @return the name for this profile (as drawn from the MetaData tag within the overall profile tag)
303 	 */
304 	public String getName() {
305 		return name;
306 	}
307 
308 	/** Setter for property orgName.
309      * @param orgName New value of property orgName.
310      *
311      * @throws ProfileException
312      */
313     public void setOrgName(String orgName) throws ProfileException {
314         String oldOrgName = this.orgName;
315         try {
316             vetoableChangeSupport.fireVetoableChange("orgName", oldOrgName, orgName);
317         } catch (Exception e) {
318             throw new ProfileException(null, e);
319         }
320         this.orgName = orgName;
321         propertyChangeSupport.firePropertyChange("orgName", oldOrgName, orgName);
322     }
323     
324     /** Setter for property role.
325      * @param role New value of property role.
326      *
327      * @throws ProfileException
328      */
329     public void setRole(String role) throws ProfileException {
330         String oldRole = this.role;
331         try {
332             vetoableChangeSupport.fireVetoableChange("role", oldRole, role);
333         } catch (Exception e) {
334             throw new ProfileException(null, e);
335         }
336         this.role = role;
337         propertyChangeSupport.firePropertyChange("role", oldRole, role);
338     }
339     
340     /** Setter for property specName.
341      * @param specName New value of property specName.
342      *
343      * @throws ProfileException
344      */
345     public void setSpecName(String specName) throws ProfileException {
346         String oldSpecName = this.specName;
347         try {
348             vetoableChangeSupport.fireVetoableChange("specName", oldSpecName, specName);
349         } catch (Exception e) {
350             throw new ProfileException(null, e);
351         }
352         this.specName = specName;
353         propertyChangeSupport.firePropertyChange("specName", oldSpecName, specName);
354     }
355     
356     /** Setter for property specVersion.
357      * @param specVersion New value of property specVersion.
358      *
359      * @throws ProfileException
360      */
361     public void setSpecVersion(String specVersion) throws ProfileException {
362         String oldSpecVersion = this.specVersion;
363         try {
364             vetoableChangeSupport.fireVetoableChange("specVersion", oldSpecVersion, specVersion);
365         } catch (Exception e) {
366             throw new ProfileException(null, e);
367         }
368         this.specVersion = specVersion;
369         propertyChangeSupport.firePropertyChange("specVersion", oldSpecVersion, specVersion);
370     }
371     
372     /** Setter for property status.
373      * @param status New value of property status.
374      *
375      * @throws ProfileException
376      */
377     public void setStatus(String status) throws ProfileException {
378         String oldStatus = this.status;
379         try {
380             vetoableChangeSupport.fireVetoableChange("status", oldStatus, status);
381         } catch (Exception e) {
382             throw new ProfileException(null, e);
383         }
384         this.status = status;
385         propertyChangeSupport.firePropertyChange("status", oldStatus, status);
386     }
387 
388 	/** Setter for property useCase.
389      * @param useCase New value of property useCase.
390      *
391      * @throws ProfileException
392      */
393     public void setUseCase(UseCase useCase) throws ProfileException {
394         UseCase oldUseCase = this.useCase;
395         try {
396             vetoableChangeSupport.fireVetoableChange("useCase", oldUseCase, useCase);
397         } catch (Exception e) {
398             throw new ProfileException(null, e);
399         }
400         this.useCase = useCase;
401         propertyChangeSupport.firePropertyChange("useCase", oldUseCase, useCase);
402     }
403     
404 }