| 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 IncidentProblem 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_problem = ""; |
|---|
| 19 | private String init_problemCode = ""; |
|---|
| 20 | private String init_priority = ""; |
|---|
| 21 | |
|---|
| 22 | private String problem; |
|---|
| 23 | private String problemCode; |
|---|
| 24 | private String priority; |
|---|
| 25 | |
|---|
| 26 | /* |
|---|
| 27 | * Constructor. Initializes all objects to avoid null pointers. |
|---|
| 28 | */ |
|---|
| 29 | public IncidentProblem(String code, String prio) { |
|---|
| 30 | problem = ""; |
|---|
| 31 | setProblemCode(code); |
|---|
| 32 | setPriority(prio); |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | public IncidentProblem() { |
|---|
| 36 | problem = ""; |
|---|
| 37 | problemCode = ""; |
|---|
| 38 | priority = ""; |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | public void resetCADDataSimulation(){ |
|---|
| 42 | problem = init_problem; |
|---|
| 43 | problemCode = init_problemCode; |
|---|
| 44 | priority = init_priority; |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | public String getProblem() { |
|---|
| 48 | return problem; |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | public void setProblem(String problem) { |
|---|
| 52 | this.problem = problem; |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | public String getProblemCode() { |
|---|
| 56 | return problemCode; |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | public void setProblemCode(String problemCode) { |
|---|
| 60 | this.problemCode = problemCode; |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | public String getPriority() { |
|---|
| 64 | return priority; |
|---|
| 65 | } |
|---|
| 66 | |
|---|
| 67 | public void setPriority(String priority) { |
|---|
| 68 | this.priority = priority; |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | /* |
|---|
| 72 | * Called from the tmc.simulator.cadclient.data.Incident.java. Handles |
|---|
| 73 | * storing data based on script tag. |
|---|
| 74 | */ |
|---|
| 75 | public void readXMLNode(String tag_name, String value) { |
|---|
| 76 | if (tag_name.equals(CADDataEnums.INC_PROBLEM.PROBLEM.tag)) { |
|---|
| 77 | init_problem = value; |
|---|
| 78 | setProblem(value); |
|---|
| 79 | } else if (tag_name.equals(CADDataEnums.INC_PROBLEM.CODE.tag)) { |
|---|
| 80 | init_problemCode = value; |
|---|
| 81 | setProblemCode(value); |
|---|
| 82 | } else if (tag_name.equals(CADDataEnums.INC_PROBLEM.PRIORITY.tag)) { |
|---|
| 83 | init_priority = value; |
|---|
| 84 | setPriority(value); |
|---|
| 85 | } |
|---|
| 86 | } |
|---|
| 87 | |
|---|
| 88 | } |
|---|