| 1 | package tmcsim.client.cadclientgui.data; |
|---|
| 2 | |
|---|
| 3 | import java.io.Serializable; |
|---|
| 4 | |
|---|
| 5 | import tmcsim.client.cadclientgui.enums.CADDataEnums; |
|---|
| 6 | |
|---|
| 7 | /** |
|---|
| 8 | * This class is a further subdivision of Incident to hold data. |
|---|
| 9 | * |
|---|
| 10 | * @author Vincent |
|---|
| 11 | * |
|---|
| 12 | */ |
|---|
| 13 | public class IncidentCaller implements Serializable { |
|---|
| 14 | |
|---|
| 15 | /* The init variables are set only from the XML script (readXMLNode method) |
|---|
| 16 | * and are only used for resetCADDataSimulation purposes |
|---|
| 17 | */ |
|---|
| 18 | private String init_callerType = ""; |
|---|
| 19 | private String init_callerName = ""; |
|---|
| 20 | private String init_phone = ""; |
|---|
| 21 | private String init_ext = ""; |
|---|
| 22 | |
|---|
| 23 | private String callerType; |
|---|
| 24 | private String callerName; |
|---|
| 25 | private String phone; |
|---|
| 26 | private String ext; |
|---|
| 27 | |
|---|
| 28 | /* |
|---|
| 29 | * Constructor. Initializes all objects to avoid null pointers. |
|---|
| 30 | */ |
|---|
| 31 | public IncidentCaller(String type, String name) { |
|---|
| 32 | setCallerType(type); |
|---|
| 33 | setCallerName(name); |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | public IncidentCaller() { |
|---|
| 37 | callerType = ""; |
|---|
| 38 | callerName = ""; |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | public void resetCADDataSimulation(){ |
|---|
| 42 | callerType = init_callerType; |
|---|
| 43 | callerName = init_callerName; |
|---|
| 44 | phone = init_phone; |
|---|
| 45 | ext = init_ext; |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | public String getCallerType() { |
|---|
| 49 | return callerType; |
|---|
| 50 | } |
|---|
| 51 | |
|---|
| 52 | public void setCallerType(String callerType) { |
|---|
| 53 | this.callerType = callerType; |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | public String getCallerName() { |
|---|
| 57 | return callerName; |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | public void setCallerName(String callerName) { |
|---|
| 61 | this.callerName = callerName; |
|---|
| 62 | } |
|---|
| 63 | |
|---|
| 64 | public String getPhone() { |
|---|
| 65 | return phone; |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | public void setPhone(String phone) { |
|---|
| 69 | this.phone = phone; |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | public String getExt() { |
|---|
| 73 | return ext; |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | public void setExt(String ext) { |
|---|
| 77 | this.ext = ext; |
|---|
| 78 | } |
|---|
| 79 | |
|---|
| 80 | /* |
|---|
| 81 | * Called from the tmc.simulator.cadclient.data.Incident.java. Handles |
|---|
| 82 | * storing data based on script tag. |
|---|
| 83 | */ |
|---|
| 84 | public void readXMLNode(String tag_name, String value) { |
|---|
| 85 | if (tag_name.equals(CADDataEnums.INC_CALLER.TYPE.tag)) { |
|---|
| 86 | init_callerType = value; |
|---|
| 87 | setCallerType(value); |
|---|
| 88 | } else if (tag_name.equals(CADDataEnums.INC_CALLER.NAME.tag)) { |
|---|
| 89 | init_callerName = value; |
|---|
| 90 | setCallerName(value); |
|---|
| 91 | } else if (tag_name.equals(CADDataEnums.INC_CALLER.PHONE.tag)) { |
|---|
| 92 | init_phone = value; |
|---|
| 93 | setPhone(value); |
|---|
| 94 | } else if (tag_name.equals(CADDataEnums.INC_CALLER.EXT.tag)) { |
|---|
| 95 | init_ext = value; |
|---|
| 96 | setExt(value); |
|---|
| 97 | } |
|---|
| 98 | } |
|---|
| 99 | } |
|---|