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