001package ca.uhn.hl7v2.conf.spec;
002
003import ca.uhn.hl7v2.conf.spec.usecase.UseCase;
004import ca.uhn.hl7v2.conf.spec.message.StaticDef;
005import ca.uhn.hl7v2.conf.ProfileException;
006
007/**
008 * A conformance specification (see HL7 2.5 section 2.12).  
009 * @author Bryan Tripp
010 */
011public class RuntimeProfile {
012    
013    private Conformance conformance;
014    /** Holds value of property conformanceType. */
015    private String conformanceType;
016    private Encoding[] encodings;
017    /** Holds value of property HL7OID. */
018    private String HL7OID;
019    /** Holds value of property HL7Version. */
020    private String HL7Version;
021        
022    private String impNote;
023    
024    /** Holds value of property message. */
025    private StaticDef message;
026    
027    /** Holds value of property orgName. */
028    private String orgName;
029    
030    /** Utility field used by bound properties. */
031    private java.beans.PropertyChangeSupport propertyChangeSupport =  new java.beans.PropertyChangeSupport(this);
032    
033    /** Holds value of property role. */
034    private String role;
035    
036    /** Holds value of property specName. */
037    private String specName;
038    
039    /** Holds value of property specVersion. */
040    private String specVersion;
041    
042    private StaticDef StaticDef;
043    
044    /** Holds value of property status. */
045    private String status;
046    
047    private UseCase useCase;
048    
049    /** Utility field used by constrained properties. */
050    private java.beans.VetoableChangeSupport vetoableChangeSupport =  new java.beans.VetoableChangeSupport(this);
051        private String name;
052    
053    /** Creates a new instance of Specification */
054    public RuntimeProfile() {
055    }
056    
057    /** Adds a PropertyChangeListener to the listener list.
058     * @param l The listener to add.
059     */
060    public void addPropertyChangeListener(java.beans.PropertyChangeListener l) {
061        propertyChangeSupport.addPropertyChangeListener(l);
062    }
063    
064    /** Adds a VetoableChangeListener to the listener list.
065     * @param l The listener to add.
066     */
067    public void addVetoableChangeListener(java.beans.VetoableChangeListener l) {
068        vetoableChangeSupport.addVetoableChangeListener(l);
069    }
070    
071    /** Getter for property conformance.
072     * @return Value of property conformance.
073     */
074    public Conformance getConformance() {
075        return this.conformance;
076    }
077    
078    /** Getter for property conformanceType.
079     * @return Value of property conformanceType.
080     */
081    public String getConformanceType() {
082        return this.conformanceType;
083    }
084    
085    /** Indexed getter for property encodings.
086     * @param index Index of the property.
087     * @return Value of the property at <CODE>index</CODE>.
088     */
089    public Encoding getEncodings(int index) {
090        return this.encodings[index];
091    }
092    
093    /** Getter for property HL7OID.
094     * @return Value of property HL7OID.
095     */
096    public String getHL7OID() {
097        return this.HL7OID;
098    }
099    
100    /** Getter for property HL7Version.
101     * @return Value of property HL7Version.
102     */
103    public String getHL7Version() {
104        return this.HL7Version;
105    }
106    
107    /** Getter for property impNote.
108     * @return Value of property impNote.
109     */
110    public String getImpNote() {
111        return this.impNote;
112    }
113    
114    /** Getter for property message.
115     * @return Value of property message.
116     */
117    public StaticDef getMessage() {
118        return this.message;
119    }
120    
121    /** Getter for property orgName.
122     * @return Value of property orgName.
123     */
124    public String getOrgName() {
125        return this.orgName;
126    }
127    
128    /** Getter for property role.
129     * @return Value of property role.
130     */
131    public String getRole() {
132        return this.role;
133    }
134    
135    /** Getter for property specName.
136     * @return Value of property specName.
137     */
138    public String getSpecName() {
139        return this.specName;
140    }
141    
142    /** Getter for property specVersion.
143     * @return Value of property specVersion.
144     */
145    public String getSpecVersion() {
146        return this.specVersion;
147    }
148    
149    /** Getter for property status.
150     * @return Value of property status.
151     */
152    public String getStatus() {
153        return this.status;
154    }
155    
156    /** Getter for property useCase.
157     * @return Value of property useCase.
158     */
159    public UseCase getUseCase() {
160        return this.useCase;
161    }
162    
163    /** Removes a PropertyChangeListener from the listener list.
164     * @param l The listener to remove.
165     */
166    public void removePropertyChangeListener(java.beans.PropertyChangeListener l) {
167        propertyChangeSupport.removePropertyChangeListener(l);
168    }
169    
170    /** Removes a VetoableChangeListener from the listener list.
171     * @param l The listener to remove.
172     */
173    public void removeVetoableChangeListener(java.beans.VetoableChangeListener l) {
174        vetoableChangeSupport.removeVetoableChangeListener(l);
175    }
176    
177    /** Setter for property conformance.
178     * @param conformance New value of property conformance.
179     *
180     * @throws ProfileException
181     */
182    public void setConformance(Conformance conformance) throws ProfileException {
183        Conformance oldConformance = this.conformance;
184        try {
185            vetoableChangeSupport.fireVetoableChange("conformance", oldConformance, conformance);
186        } catch (Exception e) {
187            throw new ProfileException(null, e);
188        }
189        this.conformance = conformance;
190        propertyChangeSupport.firePropertyChange("conformance", oldConformance, conformance);
191    }
192    
193    /** Setter for property conformanceType.
194     * @param conformanceType New value of property conformanceType.
195     *
196     * @throws ProfileException
197     */
198    public void setConformanceType(String conformanceType) throws ProfileException {
199        String oldConformanceType = this.conformanceType;
200        try {
201            vetoableChangeSupport.fireVetoableChange("conformanceType", oldConformanceType, conformanceType);
202        } catch (Exception e) {
203            throw new ProfileException(null, e);
204        }
205        this.conformanceType = conformanceType;
206        propertyChangeSupport.firePropertyChange("conformanceType", oldConformanceType, conformanceType);
207    }
208    
209    /** Indexed setter for property encodings.
210     * @param index Index of the property.
211     * @param encodings New value of the property at <CODE>index</CODE>.
212     *
213     * @throws ProfileException
214     */
215    public void setEncodings(int index, Encoding encodings) throws ProfileException {
216        Encoding oldEncodings = this.encodings[index];
217        this.encodings[index] = encodings;
218        try {
219            vetoableChangeSupport.fireVetoableChange("encodings", null, null );
220        }
221        catch(java.beans.PropertyVetoException vetoException ) {
222            this.encodings[index] = oldEncodings;
223            throw new ProfileException(null, vetoException);
224        }
225        propertyChangeSupport.firePropertyChange("encodings", null, null );
226    }
227    
228    /** Setter for property HL7OID.
229     * @param HL7OID New value of property HL7OID.
230     *
231     * @throws ProfileException
232     */
233    public void setHL7OID(String HL7OID) throws ProfileException {
234        String oldHL7OID = this.HL7OID;
235        try {
236            vetoableChangeSupport.fireVetoableChange("HL7OID", oldHL7OID, HL7OID);
237        } catch (Exception e) {
238            throw new ProfileException(null, e);
239        }
240        this.HL7OID = HL7OID;
241        propertyChangeSupport.firePropertyChange("HL7OID", oldHL7OID, HL7OID);
242    }
243    
244    /** Setter for property HL7Version.
245     * @param HL7Version New value of property HL7Version.
246     *
247     * @throws ProfileException
248     */
249    public void setHL7Version(String HL7Version) throws ProfileException {
250        String oldHL7Version = this.HL7Version;
251        try {
252            vetoableChangeSupport.fireVetoableChange("HL7Version", oldHL7Version, HL7Version);
253        } catch (Exception e) {
254            throw new ProfileException(null, e);
255        }
256        this.HL7Version = HL7Version;
257        propertyChangeSupport.firePropertyChange("HL7Version", oldHL7Version, HL7Version);
258    }
259    
260    /** Setter for property impNote.
261     * @param impNote New value of property impNote.
262     *
263     * @throws ProfileException
264     */
265    public void setImpNote(String impNote) throws ProfileException {
266        String oldImpNote = this.impNote;
267        try {
268            vetoableChangeSupport.fireVetoableChange("impNote", oldImpNote, impNote);
269        } catch (Exception e) {
270            throw new ProfileException(null, e);
271        }
272        this.impNote = impNote;
273        propertyChangeSupport.firePropertyChange("impNote", oldImpNote, impNote);
274    }
275    
276    /** Setter for property message.
277     * @param message New value of property message.
278     *
279     * @throws ProfileException
280     */
281    public void setMessage(StaticDef message) throws ProfileException {
282        StaticDef oldMessage = this.message;
283        try {
284            vetoableChangeSupport.fireVetoableChange("message", oldMessage, message);
285        } catch (Exception e) {
286            throw new ProfileException(null, e);
287        }
288        this.message = message;
289        propertyChangeSupport.firePropertyChange("message", oldMessage, message);
290    }
291    
292    public void setName(String theName) throws ProfileException {
293        String oldOrgName = this.name;
294        try {
295            vetoableChangeSupport.fireVetoableChange("name", oldOrgName, theName);
296        } catch (Exception e) {
297            throw new ProfileException(null, e);
298        }
299        this.name = theName;
300        propertyChangeSupport.firePropertyChange("name", oldOrgName, theName);
301        }
302    
303    /**
304         * @return the name for this profile (as drawn from the MetaData tag within the overall profile tag)
305         */
306        public String getName() {
307                return name;
308        }
309
310        /** Setter for property orgName.
311     * @param orgName New value of property orgName.
312     *
313     * @throws ProfileException
314     */
315    public void setOrgName(String orgName) throws ProfileException {
316        String oldOrgName = this.orgName;
317        try {
318            vetoableChangeSupport.fireVetoableChange("orgName", oldOrgName, orgName);
319        } catch (Exception e) {
320            throw new ProfileException(null, e);
321        }
322        this.orgName = orgName;
323        propertyChangeSupport.firePropertyChange("orgName", oldOrgName, orgName);
324    }
325    
326    /** Setter for property role.
327     * @param role New value of property role.
328     *
329     * @throws ProfileException
330     */
331    public void setRole(String role) throws ProfileException {
332        String oldRole = this.role;
333        try {
334            vetoableChangeSupport.fireVetoableChange("role", oldRole, role);
335        } catch (Exception e) {
336            throw new ProfileException(null, e);
337        }
338        this.role = role;
339        propertyChangeSupport.firePropertyChange("role", oldRole, role);
340    }
341    
342    /** Setter for property specName.
343     * @param specName New value of property specName.
344     *
345     * @throws ProfileException
346     */
347    public void setSpecName(String specName) throws ProfileException {
348        String oldSpecName = this.specName;
349        try {
350            vetoableChangeSupport.fireVetoableChange("specName", oldSpecName, specName);
351        } catch (Exception e) {
352            throw new ProfileException(null, e);
353        }
354        this.specName = specName;
355        propertyChangeSupport.firePropertyChange("specName", oldSpecName, specName);
356    }
357    
358    /** Setter for property specVersion.
359     * @param specVersion New value of property specVersion.
360     *
361     * @throws ProfileException
362     */
363    public void setSpecVersion(String specVersion) throws ProfileException {
364        String oldSpecVersion = this.specVersion;
365        try {
366            vetoableChangeSupport.fireVetoableChange("specVersion", oldSpecVersion, specVersion);
367        } catch (Exception e) {
368            throw new ProfileException(null, e);
369        }
370        this.specVersion = specVersion;
371        propertyChangeSupport.firePropertyChange("specVersion", oldSpecVersion, specVersion);
372    }
373    
374    /** Setter for property status.
375     * @param status New value of property status.
376     *
377     * @throws ProfileException
378     */
379    public void setStatus(String status) throws ProfileException {
380        String oldStatus = this.status;
381        try {
382            vetoableChangeSupport.fireVetoableChange("status", oldStatus, status);
383        } catch (Exception e) {
384            throw new ProfileException(null, e);
385        }
386        this.status = status;
387        propertyChangeSupport.firePropertyChange("status", oldStatus, status);
388    }
389
390        /** Setter for property useCase.
391     * @param useCase New value of property useCase.
392     *
393     * @throws ProfileException
394     */
395    public void setUseCase(UseCase useCase) throws ProfileException {
396        UseCase oldUseCase = this.useCase;
397        try {
398            vetoableChangeSupport.fireVetoableChange("useCase", oldUseCase, useCase);
399        } catch (Exception e) {
400            throw new ProfileException(null, e);
401        }
402        this.useCase = useCase;
403        propertyChangeSupport.firePropertyChange("useCase", oldUseCase, useCase);
404    }
405    
406}