View Javadoc
1   package ca.uhn.hl7v2.conf.spec.usecase;
2   
3   import java.beans.PropertyVetoException;
4   
5   /**
6    * An abstraction of the parts of a use case (eg EventFlow), all of which have a name and a body.  
7    * @author Bryan Tripp 
8    */
9   public class AbstractUseCaseComponent {
10      
11      /** Holds value of property name. */
12      private String name;
13      
14      /** Utility field used by bound properties. */
15      private final java.beans.PropertyChangeSupport propertyChangeSupport =  new java.beans.PropertyChangeSupport(this);
16      
17      /** Utility field used by constrained properties. */
18      private final java.beans.VetoableChangeSupport vetoableChangeSupport =  new java.beans.VetoableChangeSupport(this);
19      
20      /** Holds value of property body. */
21      private String body;
22      
23      /** Creates a new instance of AbstractUseCaseComponent */
24      public AbstractUseCaseComponent() {
25      }
26      
27      /** Adds a PropertyChangeListener to the listener list.
28       * @param l The listener to add.
29       */
30      public void addPropertyChangeListener(java.beans.PropertyChangeListener l) {
31          propertyChangeSupport.addPropertyChangeListener(l);
32      }
33      
34      /** Removes a PropertyChangeListener from the listener list.
35       * @param l The listener to remove.
36       */
37      public void removePropertyChangeListener(java.beans.PropertyChangeListener l) {
38          propertyChangeSupport.removePropertyChangeListener(l);
39      }
40      
41      /** Adds a VetoableChangeListener to the listener list.
42       * @param l The listener to add.
43       */
44      public void addVetoableChangeListener(java.beans.VetoableChangeListener l) {
45          vetoableChangeSupport.addVetoableChangeListener(l);
46      }
47      
48      /** Removes a VetoableChangeListener from the listener list.
49       * @param l The listener to remove.
50       */
51      public void removeVetoableChangeListener(java.beans.VetoableChangeListener l) {
52          vetoableChangeSupport.removeVetoableChangeListener(l);
53      }
54      
55      /** Getter for property name.
56       * @return Value of property name.
57       */
58      public String getName() {
59          return this.name;
60      }
61      
62      /** Setter for property name.
63       * @param name New value of property name.
64       *
65       * @throws PropertyVetoException
66       */
67      public void setName(String name) throws PropertyVetoException {
68          String oldName = this.name;
69          vetoableChangeSupport.fireVetoableChange("name", oldName, name);
70          this.name = name;
71          propertyChangeSupport.firePropertyChange("name", oldName, name);
72      }
73      
74      /** Getter for property body.
75       * @return Value of property body.
76       */
77      public String getBody() {
78          return this.body;
79      }
80      
81      /** Setter for property body.
82       * @param body New value of property body.
83       *
84       * @throws PropertyVetoException
85       */
86      public void setBody(String body) throws PropertyVetoException {
87          String oldBody = this.body;
88          vetoableChangeSupport.fireVetoableChange("body", oldBody, body);
89          this.body = body;
90          propertyChangeSupport.firePropertyChange("body", oldBody, body);
91      }
92      
93  }