001    package ca.uhn.hl7v2.conf.spec.message;
002    
003    import ca.uhn.hl7v2.conf.ProfileException;
004    import ca.uhn.hl7v2.conf.spec.MetaData;
005    
006    
007    /**
008     * <p>A "static message profile" (see HL7 2.5 section 2.12).  Message profiles are 
009     * a precise method of documenting message constraints, using a standard XML syntax 
010     * defined by HL7 (introduced in version 2.5).  XML message profiles define
011     * constraints on message content and structure in a well-defined manner, so that 
012     * the conformance of a certain message to a certain profile can be tested automatically.  
013     * There are several types of profiles: 
014     * <ul><li>HL7 Profiles - the standard messages (relatively loosely constrained)</li>
015     * <li>Implementable Profiles - profiles with additional constraints such that all optionality 
016     *      has been removed (e.g. optional fields marked as "required" or "not supported").   
017     * <li>Constrainable Profiles - any profile with optionality that can be further constrained.</li></ul>
018     * Thus profiles can constrain other profiles.  A typical case would be for a country to create a 
019     * constrainable profile based on an HL7 profile, for a vendor to create a different constrainable 
020     * profile based on the same HL7 profile, and for a hospital to create an implementable profile for 
021     * a particular implementation that constrains both.  </p>
022     * <p>The MessageProfile class is a parsed object representation of the XML profile.</p>
023     * @author Bryan Tripp
024     */
025    public class StaticDef extends AbstractSegmentContainer {
026        
027        private MetaData metaData; 
028        private String msgType;
029        private String eventType;
030        private String msgStructID;
031        private String orderControl;
032        private String eventDesc;
033        private String identifier;
034        private String role;
035        
036        /** Utility field used by bound properties. */
037        private java.beans.PropertyChangeSupport propertyChangeSupport =  new java.beans.PropertyChangeSupport(this);
038        
039        /** Utility field used by constrained properties. */
040        private java.beans.VetoableChangeSupport vetoableChangeSupport =  new java.beans.VetoableChangeSupport(this);
041        
042        /** Creates a new instance of MessageProfile */
043        public StaticDef() {
044        }
045        
046        /** Adds a PropertyChangeListener to the listener list.
047         * @param l The listener to add.
048         */
049        public void addPropertyChangeListener(java.beans.PropertyChangeListener l) {
050            propertyChangeSupport.addPropertyChangeListener(l);
051        }    
052        
053        /** Removes a PropertyChangeListener from the listener list.
054         * @param l The listener to remove.
055         */
056        public void removePropertyChangeListener(java.beans.PropertyChangeListener l) {
057            propertyChangeSupport.removePropertyChangeListener(l);
058        }
059        
060        /** Adds a VetoableChangeListener to the listener list.
061         * @param l The listener to add.
062         */
063        public void addVetoableChangeListener(java.beans.VetoableChangeListener l) {
064            vetoableChangeSupport.addVetoableChangeListener(l);
065        }
066        
067        /** Removes a VetoableChangeListener from the listener list.
068         * @param l The listener to remove.
069         */
070        public void removeVetoableChangeListener(java.beans.VetoableChangeListener l) {
071            vetoableChangeSupport.removeVetoableChangeListener(l);
072        }
073        
074        /** Getter for property metaData.
075         * @return Value of property metaData.
076         */
077        public MetaData getMetaData() {
078            return this.metaData;
079        }
080        
081        /** Setter for property metaData.
082         * @param msgType New value of property metaData.
083         *
084         * @throws ProfileException
085         */
086        public void setMetaData(MetaData metaData) throws ProfileException {
087            MetaData oldMetaData = this.metaData;
088            try {
089                vetoableChangeSupport.fireVetoableChange("metaData", oldMetaData, metaData);
090            } catch (Exception e) {
091                throw new ProfileException(null, e);
092            }
093            this.metaData = metaData;
094            propertyChangeSupport.firePropertyChange("metaData", oldMetaData, metaData);
095        }
096        
097        /** Getter for property msgType.
098         * @return Value of property msgType.
099         */
100        public String getMsgType() {
101            return this.msgType;
102        }
103        
104        /** Setter for property msgType.
105         * @param msgType New value of property msgType.
106         *
107         * @throws ProfileException
108         */
109        public void setMsgType(String msgType) throws ProfileException {
110            String oldMsgType = this.msgType;
111            try {
112                vetoableChangeSupport.fireVetoableChange("msgType", oldMsgType, msgType);
113            } catch (Exception e) {
114                throw new ProfileException(null, e);
115            }
116            this.msgType = msgType;
117            propertyChangeSupport.firePropertyChange("msgType", oldMsgType, msgType);
118        }
119        
120        /** Getter for property eventType.
121         * @return Value of property eventType.
122         */
123        public String getEventType() {
124            return this.eventType;
125        }
126        
127        /** Setter for property eventType.
128         * @param eventType New value of property eventType.
129         *
130         * @throws ProfileException
131         */
132        public void setEventType(String eventType) throws ProfileException {
133            String oldEventType = this.eventType;
134            try {
135                vetoableChangeSupport.fireVetoableChange("eventType", oldEventType, eventType);
136            } catch (Exception e) {
137                throw new ProfileException(null, e);
138            }
139            this.eventType = eventType;
140            propertyChangeSupport.firePropertyChange("eventType", oldEventType, eventType);
141        }
142        
143        /** Getter for property msgStructID.
144         * @return Value of property msgStructID.
145         */
146        public String getMsgStructID() {
147            return this.msgStructID;
148        }
149        
150        /** Setter for property msgStructID.
151         * @param msgStructID New value of property msgStructID.
152         *
153         * @throws ProfileException
154         */
155        public void setMsgStructID(String msgStructID) throws ProfileException {
156            String oldMsgStructID = this.msgStructID;
157            try {
158                vetoableChangeSupport.fireVetoableChange("msgStructID", oldMsgStructID, msgStructID);
159            } catch (Exception e) {
160                throw new ProfileException(null, e);
161            }
162            this.msgStructID = msgStructID;
163            propertyChangeSupport.firePropertyChange("msgStructID", oldMsgStructID, msgStructID);
164        }
165        
166        /** Getter for property orderControl.
167         * @return Value of property orderControl.
168         */
169        public String getOrderControl() {
170            return this.orderControl;
171        }
172        
173        /** Setter for property orderControl.
174         * @param orderControl New value of property orderControl.
175         *
176         * @throws ProfileException
177         */
178        public void setOrderControl(String orderControl) throws ProfileException {
179            String oldOrderControl = this.orderControl;
180            try {
181                vetoableChangeSupport.fireVetoableChange("orderControl", oldOrderControl, orderControl);
182            } catch (Exception e) {
183                throw new ProfileException(null, e);
184            }
185            this.orderControl = orderControl;
186            propertyChangeSupport.firePropertyChange("orderControl", oldOrderControl, orderControl);
187        }
188        
189        /** Getter for property eventDesc.
190         * @return Value of property eventDesc.
191         */
192        public String getEventDesc() {
193            return this.eventDesc;
194        }
195        
196        /** Setter for property eventDesc.
197         * @param eventDesc New value of property eventDesc.
198         *
199         * @throws ProfileException
200         */
201        public void setEventDesc(String eventDesc) throws ProfileException {
202            String oldEventDesc = this.eventDesc;
203            try {
204                vetoableChangeSupport.fireVetoableChange("eventDesc", oldEventDesc, eventDesc);
205            } catch (Exception e) {
206                throw new ProfileException(null, e);
207            }
208            this.eventDesc = eventDesc;
209            propertyChangeSupport.firePropertyChange("eventDesc", oldEventDesc, eventDesc);
210        }
211        
212        /** Getter for property identifier.
213         * @return Value of property identifier.
214         */
215        public String getIdentifier() {
216            return this.identifier;
217        }
218        
219        /** Setter for property identifier.
220         * @param eventDesc New value of property identifier.
221         *
222         * @throws ProfileException
223         */
224        public void setIdentifier(String identifier) throws ProfileException {
225            String oldIdentifier = this.identifier;
226            try {
227                vetoableChangeSupport.fireVetoableChange("identifier", oldIdentifier, identifier);
228            } catch (Exception e) {
229                throw new ProfileException(null, e);
230            }
231            this.identifier = identifier;
232            propertyChangeSupport.firePropertyChange("identifier", oldIdentifier, identifier);
233        }
234        
235        /** Getter for property role.
236         * @return Value of property role.
237         */
238        public String getRole() {
239            return this.role;
240        }
241        
242        /** Setter for property role.
243         * @param eventDesc New value of property role.
244         *
245         * @throws ProfileException
246         */
247        public void setRole(String role) throws ProfileException {
248            String oldRole = this.role;
249            try {
250                vetoableChangeSupport.fireVetoableChange("role", oldRole, role);
251            } catch (Exception e) {
252                throw new ProfileException(null, e);
253            }
254            this.role = role;
255            propertyChangeSupport.firePropertyChange("role", oldRole, role);
256        }
257        
258    }