Advertisement
jdalbey

IncidentProblem.java

May 8th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.31 KB | None | 0 0
  1. import java.io.Serializable;
  2. /**
  3.  * This class is a further subdivision of Incident to hold data.
  4.  *
  5.  * @author Vincent
  6.  *
  7.  */
  8. public class IncidentProblem implements Serializable
  9. {
  10.  
  11.     enum INC_PROBLEM
  12.     {
  13.         PROBLEM, CODE, PRIORITY;
  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.     {
  31.         problem = "";
  32.         setProblemCode(code);
  33.         setPriority(prio);
  34.     }
  35.  
  36.     public IncidentProblem()
  37.     {
  38.         problem = "";
  39.         problemCode = "";
  40.         priority = "";
  41.     }
  42.  
  43.     public void resetCADDataSimulation()
  44.     {
  45.         problem = init_problem;
  46.         problemCode = init_problemCode;
  47.         priority = init_priority;
  48.     }
  49.  
  50.     public String getProblem()
  51.     {
  52.         return problem;
  53.     }
  54.  
  55.     public void setProblem(String problem)
  56.     {
  57.         this.problem = problem;
  58.     }
  59.  
  60.     public String getProblemCode()
  61.     {
  62.         return problemCode;
  63.     }
  64.  
  65.     public void setProblemCode(String problemCode)
  66.     {
  67.         this.problemCode = problemCode;
  68.     }
  69.  
  70.     public String getPriority()
  71.     {
  72.         return priority;
  73.     }
  74.  
  75.     public void setPriority(String priority)
  76.     {
  77.         this.priority = priority;
  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.     {
  86.         if (tag_name.equals(INC_PROBLEM.PROBLEM.toString()))
  87.         {
  88.             init_problem = value;
  89.             setProblem(value);
  90.         } else if (tag_name.equals(INC_PROBLEM.CODE.toString()))
  91.         {
  92.             init_problemCode = value;
  93.             setProblemCode(value);
  94.         } else if (tag_name.equals(INC_PROBLEM.PRIORITY.toString()))
  95.         {
  96.             init_priority = value;
  97.             setPriority(value);
  98.         }
  99.     }
  100.  
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement