001: package salomeTMF_plug.mantis.sqlWrapper;
002:
003: import java.sql.Date;
004: import java.text.SimpleDateFormat;
005:
006: import salomeTMF_plug.mantis.MantisPlugin;
007: import salomeTMF_plug.mantis.languages.Language;
008:
009: public class HistoryWrapper {
010: int id;
011: Date pDate;
012: String username;
013: String field_name;
014: String old_value;
015: String new_value;
016: int code;
017:
018: /* For to String */
019: String field;
020: String change;
021:
022: public int getCode() {
023: return code;
024: }
025:
026: public void setCode(int code) {
027: this .code = code;
028: }
029:
030: public String getField_name() {
031: return field_name;
032: }
033:
034: public void setField_name(String field_name) {
035: this .field_name = field_name;
036: }
037:
038: public int getId() {
039: return id;
040: }
041:
042: public void setId(int id) {
043: this .id = id;
044: }
045:
046: public String getNew_value() {
047: return new_value;
048: }
049:
050: public void setNew_value(String new_value) {
051: this .new_value = new_value;
052: }
053:
054: public String getOld_value() {
055: return old_value;
056: }
057:
058: public void setOld_value(String old_value) {
059: this .old_value = old_value;
060: }
061:
062: public Date getPDate() {
063: return pDate;
064: }
065:
066: public void setPDate(Date date) {
067: pDate = date;
068: }
069:
070: public String getUsername() {
071: return username;
072: }
073:
074: public void setUsername(String username) {
075: this .username = username;
076: }
077:
078: public String getDate() {
079: SimpleDateFormat formater = new SimpleDateFormat(
080: "dd/MM/yyyy HH:mm");
081: return formater.format(pDate).toString();
082: }
083:
084: public String getField() {
085: String ret = "";
086: if (code == 0) {
087: ret = field_name;
088: } else if (code == 1) {
089: ret = Language.getInstance().getText("New"); //local
090: } else if (code == 18) {
091: ret = Language.getInstance().getText("Relationship_added"); //local
092: } else if (code == 19) {
093: ret = Language.getInstance()
094: .getText("Relationship_deleted"); //local
095: } else {
096: /* Not yet Implemented */
097: ret = field_name;
098: }
099: return ret;
100: }
101:
102: public String getChange(MantisPlugin pMantisPlugin) {
103: String ret = "";
104: if (code == 0) {
105: if (field_name.equals("handler_id")) {
106: ret = old_value + " => " + new_value;
107: } else if (field_name.equals("status")) {
108: Integer I_old_value = new Integer(old_value);
109: Integer I_new_value = new Integer(new_value);
110: ret = pMantisPlugin.statusByID.get(I_old_value)
111: + " => "
112: + pMantisPlugin.statusByID.get(I_new_value);
113: } else if (field_name.equals("priority")) {
114: Integer I_old_value = new Integer(old_value);
115: Integer I_new_value = new Integer(new_value);
116: ret = pMantisPlugin.priorityByID.get(I_old_value)
117: + " => "
118: + pMantisPlugin.priorityByID.get(I_new_value);
119: } else if (field_name.equals("severity")) {
120: Integer I_old_value = new Integer(old_value);
121: Integer I_new_value = new Integer(new_value);
122: ret = pMantisPlugin.severityByID.get(I_old_value)
123: + " => "
124: + pMantisPlugin.severityByID.get(I_new_value);
125: } else if (field_name.equals("reproducibility")) {
126: Integer I_old_value = new Integer(old_value);
127: Integer I_new_value = new Integer(new_value);
128: ret = pMantisPlugin.reproductibilityByID
129: .get(I_old_value)
130: + " => "
131: + pMantisPlugin.reproductibilityByID
132: .get(I_new_value);
133: } else if (field_name.equals("resolution")) {
134: Integer I_old_value = new Integer(old_value);
135: Integer I_new_value = new Integer(new_value);
136: ret = pMantisPlugin.resolutionByID.get(I_old_value)
137: + " => "
138: + pMantisPlugin.resolutionByID.get(I_new_value);
139: } else {
140: ret = old_value + " => " + new_value;
141: }
142: } else if (code == 1) {
143: ret = ""; //local
144: } else if (code == 18) {
145: ret = Language.getInstance().getText("related_to") + " "
146: + new_value; //local
147: } else if (code == 19) {
148: ret = Language.getInstance().getText("related_to") + " "
149: + new_value; //local
150: } else {
151: /* Not yet Implemented */
152: ret = old_value + " => " + new_value;
153: }
154: return ret;
155: }
156: /*if (code == 0){
157: //Update
158: SimpleDateFormat formater = new SimpleDateFormat("dd/MM/yyyy HH:mm");
159: formater.format // toString
160: }*/
161: }
|