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    /** Holds value of property status. */
043    private String status;
044    
045    private UseCase useCase;
046    
047    /** Utility field used by constrained properties. */
048    private java.beans.VetoableChangeSupport vetoableChangeSupport =  new java.beans.VetoableChangeSupport(this);
049        private String name;
050    
051    /** Creates a new instance of Specification */
052    public RuntimeProfile() {
053    }
054    
055    /** Adds a PropertyChangeListener to the listener list.
056     * @param l The listener to add.
057     */
058    public void addPropertyChangeListener(java.beans.PropertyChangeListener l) {
059        propertyChangeSupport.addPropertyChangeListener(l);
060    }
061    
062    /** Adds a VetoableChangeListener to the listener list.
063     * @param l The listener to add.
064     */
065    public void addVetoableChangeListener(java.beans.VetoableChangeListener l) {
066        vetoableChangeSupport.addVetoableChangeListener(l);
067    }
068    
069    /** Getter for property conformance.
070     * @return Value of property conformance.
071     */
072    public Conformance getConformance() {
073        return this.conformance;
074    }
075    
076    /** Getter for property conformanceType.
077     * @return Value of property conformanceType.
078     */
079    public String getConformanceType() {
080        return this.conformanceType;
081    }
082    
083    /** Indexed getter for property encodings.
084     * @param index Index of the property.
085     * @return Value of the property at <CODE>index</CODE>.
086     */
087    public Encoding getEncodings(int index) {
088        return this.encodings[index];
089    }
090    
091    /** Getter for property HL7OID.
092     * @return Value of property HL7OID.
093     */
094    public String getHL7OID() {
095        return this.HL7OID;
096    }
097    
098    /** Getter for property HL7Version.
099     * @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}