001package ca.uhn.hl7v2.conf.spec.message; 002 003import ca.uhn.hl7v2.conf.ProfileException; 004 005/** 006 * A specification for a segment group in a conformance profile. 007 * @author Bryan Tripp 008 */ 009public class SegGroup extends AbstractSegmentContainer implements ProfileStructure { 010 011 private String predicate; 012 private String name; 013 private String longName; 014 private String usage; 015 private short min; 016 private short max; 017 018 /** Utility field used by bound properties. */ 019 private java.beans.PropertyChangeSupport propertyChangeSupport = new java.beans.PropertyChangeSupport(this); 020 021 /** Utility field used by constrained properties. */ 022 private java.beans.VetoableChangeSupport vetoableChangeSupport = new java.beans.VetoableChangeSupport(this); 023 024 /** Creates a new instance of SegGroup */ 025 public SegGroup() { 026 } 027 028 /** 029 * {@inheritDoc} 030 */ 031 @Override 032 public String toString() { 033 return "SegGroup[" + getName() + "]"; 034 } 035 036 /** Adds a PropertyChangeListener to the listener list. 037 * @param l The listener to add. 038 */ 039 public void addPropertyChangeListener(java.beans.PropertyChangeListener l) { 040 propertyChangeSupport.addPropertyChangeListener(l); 041 } 042 043 /** Removes a PropertyChangeListener from the listener list. 044 * @param l The listener to remove. 045 */ 046 public void removePropertyChangeListener(java.beans.PropertyChangeListener l) { 047 propertyChangeSupport.removePropertyChangeListener(l); 048 } 049 050 /** Adds a VetoableChangeListener to the listener list. 051 * @param l The listener to add. 052 */ 053 public void addVetoableChangeListener(java.beans.VetoableChangeListener l) { 054 vetoableChangeSupport.addVetoableChangeListener(l); 055 } 056 057 /** Removes a VetoableChangeListener from the listener list. 058 * @param l The listener to remove. 059 */ 060 public void removeVetoableChangeListener(java.beans.VetoableChangeListener l) { 061 vetoableChangeSupport.removeVetoableChangeListener(l); 062 } 063 064 /** Getter for property predicate. 065 * @return Value of property predicate. 066 */ 067 public String getPredicate() { 068 return this.predicate; 069 } 070 071 /** Setter for property predicate. 072 * @param predicate New value of property predicate. 073 * 074 * @throws ProfileException 075 */ 076 public void setPredicate(String predicate) throws ProfileException { 077 String oldPredicate = this.predicate; 078 try { 079 vetoableChangeSupport.fireVetoableChange("predicate", oldPredicate, predicate); 080 } catch (Exception e) { 081 throw new ProfileException(null, e); 082 } 083 this.predicate = predicate; 084 propertyChangeSupport.firePropertyChange("predicate", oldPredicate, predicate); 085 } 086 087 /** Getter for property name. 088 * @return Value of property name. 089 */ 090 public String getName() { 091 return this.name; 092 } 093 094 /** Setter for property name. 095 * @param name New value of property name. 096 * 097 * @throws ProfileException 098 */ 099 public void setName(String name) throws ProfileException { 100 String oldName = this.name; 101 try { 102 vetoableChangeSupport.fireVetoableChange("name", oldName, name); 103 } catch (Exception e) { 104 throw new ProfileException(null, e); 105 } 106 this.name = name; 107 propertyChangeSupport.firePropertyChange("name", oldName, name); 108 } 109 110 /** Getter for property longName. 111 * @return Value of property longName. 112 */ 113 public String getLongName() { 114 return this.longName; 115 } 116 117 /** Setter for property longName. 118 * @param longName New value of property longName. 119 * 120 * @throws ProfileException 121 */ 122 public void setLongName(String longName) throws ProfileException { 123 String oldLongName = this.longName; 124 try { 125 vetoableChangeSupport.fireVetoableChange("longName", oldLongName, longName); 126 } catch (Exception e) { 127 throw new ProfileException(null, e); 128 } 129 this.longName = longName; 130 propertyChangeSupport.firePropertyChange("longName", oldLongName, longName); 131 } 132 133 /** Getter for property usage. 134 * @return Value of property usage. 135 */ 136 public String getUsage() { 137 return this.usage; 138 } 139 140 /** Setter for property usage. 141 * @param usage New value of property usage. 142 * 143 * @throws ProfileException 144 */ 145 public void setUsage(String usage) throws ProfileException { 146 String oldUsage = this.usage; 147 try { 148 vetoableChangeSupport.fireVetoableChange("usage", oldUsage, usage); 149 } catch (Exception e) { 150 throw new ProfileException(null, e); 151 } 152 this.usage = usage; 153 propertyChangeSupport.firePropertyChange("usage", oldUsage, usage); 154 } 155 156 /** Getter for property min. 157 * @return Value of property min. 158 */ 159 public short getMin() { 160 return this.min; 161 } 162 163 /** Setter for property min. 164 * @param min New value of property min. 165 * 166 * @throws ProfileException 167 */ 168 public void setMin(short min) throws ProfileException { 169 short oldMin = this.min; 170 try { 171 vetoableChangeSupport.fireVetoableChange("min", oldMin, min); 172 } catch (Exception e) { 173 throw new ProfileException(null, e); 174 } 175 this.min = min; 176 propertyChangeSupport.firePropertyChange("min", oldMin, min); 177 } 178 179 /** Getter for property max. 180 * @return Value of property max. 181 */ 182 public short getMax() { 183 return this.max; 184 } 185 186 /** Setter for property max. 187 * @param max New value of property max. 188 * 189 * @throws ProfileException 190 */ 191 public void setMax(short max) throws ProfileException { 192 short oldMax = this.max; 193 try { 194 vetoableChangeSupport.fireVetoableChange("max", new Short(oldMax), new Short(max)); 195 } catch (Exception e) { 196 throw new ProfileException(null, e); 197 } 198 this.max = max; 199 propertyChangeSupport.firePropertyChange("max", new Short(oldMax), new Short(max)); 200 } 201 202}