001package ca.uhn.hl7v2.conf.spec.usecase; 002 003/** 004 * An abstraction of the parts of a use case (eg EventFlow), all of which have a name and a body. 005 * @author Bryan Tripp 006 */ 007public class AbstractUseCaseComponent { 008 009 /** Holds value of property name. */ 010 private String name; 011 012 /** Utility field used by bound properties. */ 013 private java.beans.PropertyChangeSupport propertyChangeSupport = new java.beans.PropertyChangeSupport(this); 014 015 /** Utility field used by constrained properties. */ 016 private java.beans.VetoableChangeSupport vetoableChangeSupport = new java.beans.VetoableChangeSupport(this); 017 018 /** Holds value of property body. */ 019 private String body; 020 021 /** Creates a new instance of AbstractUseCaseComponent */ 022 public AbstractUseCaseComponent() { 023 } 024 025 /** Adds a PropertyChangeListener to the listener list. 026 * @param l The listener to add. 027 */ 028 public void addPropertyChangeListener(java.beans.PropertyChangeListener l) { 029 propertyChangeSupport.addPropertyChangeListener(l); 030 } 031 032 /** Removes a PropertyChangeListener from the listener list. 033 * @param l The listener to remove. 034 */ 035 public void removePropertyChangeListener(java.beans.PropertyChangeListener l) { 036 propertyChangeSupport.removePropertyChangeListener(l); 037 } 038 039 /** Adds a VetoableChangeListener to the listener list. 040 * @param l The listener to add. 041 */ 042 public void addVetoableChangeListener(java.beans.VetoableChangeListener l) { 043 vetoableChangeSupport.addVetoableChangeListener(l); 044 } 045 046 /** Removes a VetoableChangeListener from the listener list. 047 * @param l The listener to remove. 048 */ 049 public void removeVetoableChangeListener(java.beans.VetoableChangeListener l) { 050 vetoableChangeSupport.removeVetoableChangeListener(l); 051 } 052 053 /** Getter for property name. 054 * @return Value of property name. 055 */ 056 public String getName() { 057 return this.name; 058 } 059 060 /** Setter for property name. 061 * @param name New value of property name. 062 * 063 * @throws PropertyVetoException 064 */ 065 public void setName(String name) throws java.beans.PropertyVetoException { 066 String oldName = this.name; 067 vetoableChangeSupport.fireVetoableChange("name", oldName, name); 068 this.name = name; 069 propertyChangeSupport.firePropertyChange("name", oldName, name); 070 } 071 072 /** Getter for property body. 073 * @return Value of property body. 074 */ 075 public String getBody() { 076 return this.body; 077 } 078 079 /** Setter for property body. 080 * @param body New value of property body. 081 * 082 * @throws PropertyVetoException 083 */ 084 public void setBody(String body) throws java.beans.PropertyVetoException { 085 String oldBody = this.body; 086 vetoableChangeSupport.fireVetoableChange("body", oldBody, body); 087 this.body = body; 088 propertyChangeSupport.firePropertyChange("body", oldBody, body); 089 } 090 091}