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