001package ca.uhn.hl7v2.conf.spec.message;
002
003import ca.uhn.hl7v2.conf.ProfileException;
004import 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 *
024 * @author Bryan Tripp
025 */
026public class StaticDef extends AbstractSegmentContainer {
027
028    private MetaData metaData;
029    private String msgType;
030    private String eventType;
031    private String msgStructID;
032    private String orderControl;
033    private String eventDesc;
034    private String identifier;
035    private String role;
036
037    /**
038     * Utility field used by bound properties.
039     */
040    private final java.beans.PropertyChangeSupport propertyChangeSupport = new java.beans.PropertyChangeSupport(this);
041
042    /**
043     * Utility field used by constrained properties.
044     */
045    private final java.beans.VetoableChangeSupport vetoableChangeSupport = new java.beans.VetoableChangeSupport(this);
046
047    /**
048     * Creates a new instance of MessageProfile
049     */
050    public StaticDef() {
051    }
052
053    /**
054     * Adds a PropertyChangeListener to the listener list.
055     *
056     * @param l The listener to add.
057     */
058    public void addPropertyChangeListener(java.beans.PropertyChangeListener l) {
059        propertyChangeSupport.addPropertyChangeListener(l);
060    }
061
062    /**
063     * Removes a PropertyChangeListener from the listener list.
064     *
065     * @param l The listener to remove.
066     */
067    public void removePropertyChangeListener(java.beans.PropertyChangeListener l) {
068        propertyChangeSupport.removePropertyChangeListener(l);
069    }
070
071    /**
072     * Adds a VetoableChangeListener to the listener list.
073     *
074     * @param l The listener to add.
075     */
076    public void addVetoableChangeListener(java.beans.VetoableChangeListener l) {
077        vetoableChangeSupport.addVetoableChangeListener(l);
078    }
079
080    /**
081     * Removes a VetoableChangeListener from the listener list.
082     *
083     * @param l The listener to remove.
084     */
085    public void removeVetoableChangeListener(java.beans.VetoableChangeListener l) {
086        vetoableChangeSupport.removeVetoableChangeListener(l);
087    }
088
089    /**
090     * Getter for property metaData.
091     *
092     * @return Value of property metaData.
093     */
094    public MetaData getMetaData() {
095        return this.metaData;
096    }
097
098    public void setMetaData(MetaData metaData) throws ProfileException {
099        MetaData oldMetaData = this.metaData;
100        try {
101            vetoableChangeSupport.fireVetoableChange("metaData", oldMetaData, metaData);
102        } catch (Exception e) {
103            throw new ProfileException(null, e);
104        }
105        this.metaData = metaData;
106        propertyChangeSupport.firePropertyChange("metaData", oldMetaData, metaData);
107    }
108
109    /**
110     * Getter for property msgType.
111     *
112     * @return Value of property msgType.
113     */
114    public String getMsgType() {
115        return this.msgType;
116    }
117
118    /**
119     * Setter for property msgType.
120     *
121     * @param msgType New value of property msgType.
122     * @throws ProfileException
123     */
124    public void setMsgType(String msgType) throws ProfileException {
125        String oldMsgType = this.msgType;
126        try {
127            vetoableChangeSupport.fireVetoableChange("msgType", oldMsgType, msgType);
128        } catch (Exception e) {
129            throw new ProfileException(null, e);
130        }
131        this.msgType = msgType;
132        propertyChangeSupport.firePropertyChange("msgType", oldMsgType, msgType);
133    }
134
135    /**
136     * Getter for property eventType.
137     *
138     * @return Value of property eventType.
139     */
140    public String getEventType() {
141        return this.eventType;
142    }
143
144    /**
145     * Setter for property eventType.
146     *
147     * @param eventType New value of property eventType.
148     * @throws ProfileException
149     */
150    public void setEventType(String eventType) throws ProfileException {
151        String oldEventType = this.eventType;
152        try {
153            vetoableChangeSupport.fireVetoableChange("eventType", oldEventType, eventType);
154        } catch (Exception e) {
155            throw new ProfileException(null, e);
156        }
157        this.eventType = eventType;
158        propertyChangeSupport.firePropertyChange("eventType", oldEventType, eventType);
159    }
160
161    /**
162     * Getter for property msgStructID.
163     *
164     * @return Value of property msgStructID.
165     */
166    public String getMsgStructID() {
167        return this.msgStructID;
168    }
169
170    /**
171     * Setter for property msgStructID.
172     *
173     * @param msgStructID New value of property msgStructID.
174     * @throws ProfileException
175     */
176    public void setMsgStructID(String msgStructID) throws ProfileException {
177        String oldMsgStructID = this.msgStructID;
178        try {
179            vetoableChangeSupport.fireVetoableChange("msgStructID", oldMsgStructID, msgStructID);
180        } catch (Exception e) {
181            throw new ProfileException(null, e);
182        }
183        this.msgStructID = msgStructID;
184        propertyChangeSupport.firePropertyChange("msgStructID", oldMsgStructID, msgStructID);
185    }
186
187    /**
188     * Getter for property orderControl.
189     *
190     * @return Value of property orderControl.
191     */
192    public String getOrderControl() {
193        return this.orderControl;
194    }
195
196    /**
197     * Setter for property orderControl.
198     *
199     * @param orderControl New value of property orderControl.
200     * @throws ProfileException
201     */
202    public void setOrderControl(String orderControl) throws ProfileException {
203        String oldOrderControl = this.orderControl;
204        try {
205            vetoableChangeSupport.fireVetoableChange("orderControl", oldOrderControl, orderControl);
206        } catch (Exception e) {
207            throw new ProfileException(null, e);
208        }
209        this.orderControl = orderControl;
210        propertyChangeSupport.firePropertyChange("orderControl", oldOrderControl, orderControl);
211    }
212
213    /**
214     * Getter for property eventDesc.
215     *
216     * @return Value of property eventDesc.
217     */
218    public String getEventDesc() {
219        return this.eventDesc;
220    }
221
222    /**
223     * Setter for property eventDesc.
224     *
225     * @param eventDesc New value of property eventDesc.
226     * @throws ProfileException
227     */
228    public void setEventDesc(String eventDesc) throws ProfileException {
229        String oldEventDesc = this.eventDesc;
230        try {
231            vetoableChangeSupport.fireVetoableChange("eventDesc", oldEventDesc, eventDesc);
232        } catch (Exception e) {
233            throw new ProfileException(null, e);
234        }
235        this.eventDesc = eventDesc;
236        propertyChangeSupport.firePropertyChange("eventDesc", oldEventDesc, eventDesc);
237    }
238
239    /**
240     * Getter for property identifier.
241     *
242     * @return Value of property identifier.
243     */
244    public String getIdentifier() {
245        return this.identifier;
246    }
247
248    /**
249     * Setter for property identifier.
250     *
251     * @param identifier New value of property identifier.
252     * @throws ProfileException
253     */
254    public void setIdentifier(String identifier) throws ProfileException {
255        String oldIdentifier = this.identifier;
256        try {
257            vetoableChangeSupport.fireVetoableChange("identifier", oldIdentifier, identifier);
258        } catch (Exception e) {
259            throw new ProfileException(null, e);
260        }
261        this.identifier = identifier;
262        propertyChangeSupport.firePropertyChange("identifier", oldIdentifier, identifier);
263    }
264
265    /**
266     * Getter for property role.
267     *
268     * @return Value of property role.
269     */
270    public String getRole() {
271        return this.role;
272    }
273
274    /**
275     * Setter for property role.
276     *
277     * @param eventDesc New value of property role.
278     * @throws ProfileException
279     */
280    public void setRole(String role) throws ProfileException {
281        String oldRole = this.role;
282        try {
283            vetoableChangeSupport.fireVetoableChange("role", oldRole, role);
284        } catch (Exception e) {
285            throw new ProfileException(null, e);
286        }
287        this.role = role;
288        propertyChangeSupport.firePropertyChange("role", oldRole, role);
289    }
290
291}