VitalSignsBean.java
001 package com.bea.medrec.beans;
002 
003 import com.bea.medrec.value.VitalSigns;
004 
005 /**
006  <p>Form bean for vital signs.
007  * This form has the following fields,
008  * with default values in square brackets:
009  <ul>
010  <li><b>tempature</b> - Entered temperature value
011  <li><b>pulse</b> - Entered pulse value
012  <li><b>blood pressure</b> - Entered blood pressure value
013  <li><b>weight</b> - Entered weight value
014  <li><b>height</b> - Entered height value
015  </ul>
016  </p>
017  *
018  @author Copyright (c) 2006 by BEA Systems. All Rights Reserved.
019  */
020 public final class VitalSignsBean extends BaseBean {
021   // Attributes
022   private String temperature = "";
023   private String bloodPressure = "";
024   private String pulse = "";
025   private String weight = "";
026   private String height = "";
027 
028   // Constructors
029   public VitalSignsBean() {
030   }
031 
032   public VitalSignsBean(VitalSigns vitals) {
033     if (vitals == nullreturn;
034     super.setId(vitals.getId());
035     this.temperature = vitals.getTemperature();
036     this.bloodPressure = vitals.getBloodPressure();
037     this.pulse = vitals.getPulse();
038     this.weight = toStr(vitals.getWeight());
039     this.height = toStr(vitals.getHeight());
040   }
041 
042   public VitalSignsBean(Integer id,
043                         String temperature,
044                         String bloodPressure,
045                         String pulse,
046                         Integer weight,
047                         Integer height) {
048     super.setId(id);
049     this.temperature = temperature;
050     this.bloodPressure = bloodPressure;
051     this.pulse = pulse;
052     this.weight = toStr(weight);
053     this.height = toStr(height);
054   }
055 
056   // Getters
057   public String getTemperature() {
058     return this.temperature;
059   }
060 
061   public String getBloodPressure() {
062     return this.bloodPressure;
063   }
064 
065   public String getPulse() {
066     return this.pulse;
067   }
068 
069   public String getWeight() {
070     return this.weight;
071   }
072 
073   public String getHeight() {
074     return this.height;
075   }
076 
077   // Setters
078   public void setTemperature(String temperature) {
079     this.temperature = temperature;
080   }
081 
082   public void setBloodPressure(String bloodPressure) {
083     this.bloodPressure = bloodPressure;
084   }
085 
086   public void setPulse(String pulse) {
087     this.pulse = pulse;
088   }
089 
090   public void setWeight(String weight) {
091     this.weight = weight;
092   }
093 
094   public void setHeight(String height) {
095     this.height = height;
096   }
097 
098   // Public Methods
099   public void reset() {
100     this.temperature = "";
101     this.bloodPressure = "";
102     this.pulse = "";
103     this.weight = "";
104     this.height = "";
105   }
106 
107   public void update(VitalSignsBean vitalSignsBean) {
108     this.temperature = vitalSignsBean.getTemperature();
109     this.bloodPressure = vitalSignsBean.getBloodPressure();
110     this.pulse = vitalSignsBean.getPulse();
111     this.weight = vitalSignsBean.getWeight();
112     this.height = vitalSignsBean.getHeight();
113   }
114 
115   /**
116    <p>Converts vital signs presentation bean to vital signs value object.</p>
117    *
118    @return VitalSignsWS
119    */
120   public VitalSigns toVitalSigns() {
121     return new VitalSigns(getTemperature(),
122         getBloodPressure(),
123         getPulse(),
124         getWeight(),
125         getHeight());
126   }
127 
128   // Utility
129   public String toString() {
130     StringBuffer str = new StringBuffer();
131     str.append("VitalSignsBean [");
132     str.append("Temp: "+temperature);
133     str.append(" | BP: "+bloodPressure);
134     str.append(" | Pulse: "+pulse);
135     str.append(" | Weight: "+weight);
136     str.append(" | Height: "+height);
137     str.append("]");
138 
139     return str.toString();
140   }
141 
142 }