001 package com.bea.medrec.entities;
002
003 import com.bea.medrec.utils.MedRecLog4jFactory;
004 import com.bea.medrec.value.VitalSigns;
005 import javax.ejb.CreateException;
006 import org.apache.log4j.Logger;
007 import weblogic.ejb.GenericEntityBean;
008 import weblogic.ejbgen.*;
009
010 /**
011 * <p>VitalSignsEJB is an Container Managed EntityBean that
012 * manipulates record persisted data.</p>
013 *
014 * @author Copyright (c) 2006 by BEA Systems. All Rights Reserved.
015 */
016 @AutomaticKeyGeneration(name = "VITAL_SIGNS_SEQ",
017 type = AutomaticKeyGeneration.AutomaticKeyGenerationType.SEQUENCE_TABLE,
018 cacheSize = "10")
019 @CreateDefaultDbmsTables(value = "Disabled")
020 @Entity(maxBeansInCache = "1000",
021 dataSourceName = "jdbc/MedRecTxDataSource",
022 transTimeoutSeconds = "0",
023 ejbName = "VitalSignsEJB",
024 reentrant = Constants.Bool.FALSE,
025 concurrencyStrategy = Constants.ConcurrencyStrategy.DATABASE,
026 delayDatabaseInsertUntil = Entity.DelayDatabaseInsertUntil.EJB_POST_CREATE,
027 tableName = "vital_signs",
028 readTimeoutSeconds = "600",
029 primKeyClass = "java.lang.Integer",
030 defaultTransaction = Constants.TransactionAttribute.MANDATORY,
031 abstractSchemaName = "VitalSignsEJB")
032 @FileGeneration(localClass = Constants.Bool.TRUE,
033 localHome = Constants.Bool.TRUE,
034 valueClass = Constants.Bool.FALSE)
035 @Relations({
036 @Relation(cascadeDelete = Constants.Bool.FALSE,
037 name = "Record-VitalSigns",
038 roleName = "VitalSigns-Has-Record",
039 multiplicity = Relation.Multiplicity.ONE,
040 targetEjb = "RecordEJB")
041 })
042 public abstract class VitalSignsEJB extends GenericEntityBean{
043 // Logger
044 private static Logger logger =
045 MedRecLog4jFactory.getLogger(VitalSignsEJB.class.getName());
046
047 // Container managed fields
048
049 @CmpField(column = "id",
050 orderingNumber = "1")
051 @LocalMethod()
052 @PrimkeyField()
053 public abstract Integer getId();
054
055
056 @LocalMethod()
057 public abstract void setId(Integer id);
058
059
060 @CmpField(column = "temperature",
061 orderingNumber = "2",
062 groupNames = "vitalSigns-group")
063 @LocalMethod()
064 public abstract String getTemperature();
065
066
067 @LocalMethod()
068 public abstract void setTemperature(String temperature);
069
070
071 @CmpField(column = "blood_pressure",
072 orderingNumber = "3",
073 groupNames = "vitalSigns-group")
074 @LocalMethod()
075 public abstract String getBloodPressure();
076
077 @LocalMethod()
078 public abstract void setBloodPressure(String bloodPressure);
079
080 @CmpField(column = "pulse",
081 orderingNumber = "4",
082 groupNames = "vitalSigns-group")
083 @LocalMethod()
084 public abstract String getPulse();
085
086 @LocalMethod()
087 public abstract void setPulse(String pulse);
088
089 @CmpField(column = "weight",
090 orderingNumber = "5",
091 groupNames = "vitalSigns-group")
092 @LocalMethod()
093 public abstract Integer getWeight();
094
095 @LocalMethod()
096 public abstract void setWeight(Integer weight);
097
098 @CmpField(column = "height",
099 orderingNumber = "6",
100 groupNames = "vitalSigns-group")
101 @LocalMethod()
102 public abstract Integer getHeight();
103
104 @LocalMethod()
105 public abstract void setHeight(Integer height);
106
107 @LocalMethod()
108 public VitalSigns getVitalSigns() {
109 VitalSigns vitals = new VitalSigns();
110 vitals.setId(getId());
111 vitals.setTemperature(getTemperature());
112 vitals.setBloodPressure(getBloodPressure());
113 vitals.setPulse(getPulse());
114 vitals.setWeight(getWeight());
115 vitals.setHeight(getHeight());
116 return vitals;
117 }
118
119 // Home methods
120 /**
121 * <p>Vitals create.</p>
122 */
123 public Object ejbCreate(String temperature,
124 String bloodPressure,
125 String pulse,
126 Integer weight,
127 Integer height) throws CreateException {
128 setTemperature(temperature);
129 setBloodPressure(bloodPressure);
130 setPulse(pulse);
131 setWeight(weight);
132 setHeight(height);
133 return null;
134 }
135
136 public void ejbPostCreate(String temperature,
137 String bloodPressure,
138 String pulse,
139 Integer weight,
140 Integer height) throws CreateException {
141 /* not implemented */
142 }
143
144 /**
145 * <p>Vitals create.</p>
146 */
147 public Object ejbCreate(VitalSigns vitalSigns) throws CreateException {
148 logger.debug("Creating vitalSigns: "+vitalSigns.toString());
149 setTemperature(vitalSigns.getTemperature());
150 setBloodPressure(vitalSigns.getBloodPressure());
151 setPulse(vitalSigns.getPulse());
152 setWeight(vitalSigns.getWeight());
153 setHeight(vitalSigns.getHeight());
154 return null;
155 }
156
157 public void ejbPostCreate(VitalSigns vitalSigns) throws CreateException {
158 /* not implemented */
159 }
160
161 @LocalMethod()
162 public String toString() {
163 StringBuffer str = new StringBuffer();
164 str.append("VITALSIGNS [Id: "+getId());
165 str.append(" | Temp: "+getTemperature());
166 str.append(" | BP: "+getBloodPressure());
167 str.append(" | Pulse: "+getPulse());
168 str.append(" | Weight: "+getWeight());
169 str.append(" | Height: "+getHeight());
170 str.append("]");
171 return str.toString();
172 }
173 }
|