blob: 3b11faaa8d8cfc0e11e9eda705484ab6a1b2950d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
/*******************************************************************************
* Copyright (c) 2003 University Of British Columbia and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* University Of British Columbia - initial API and implementation
*******************************************************************************/
package org.eclipse.mylar.internal.bugzilla.core.history;
import java.io.Serializable;
/**
* @author John Anvik
*/
public class TaskRevision implements Comparable<TaskRevision>, Serializable {
private static final long serialVersionUID = 7739060501945994522L;
protected final static String STATUS = "Status";
protected final static String RESOLUTION = "Resolution";
protected final static String ASSIGNMENT = "AssignedTo";
protected final static String ATTACHMENT = "Attachment";
protected String name;
protected String date;
protected String what;
protected String removed;
protected String added;
protected TaskRevision() {
this.added = "";
}
public static TaskRevision createEvent(String type, String change) {
TaskRevision event = new TaskRevision();
event.setWhat(type);
if (STATUS.equals(type)) {
event = new StatusEvent(StatusType.convert(change));
}
if (RESOLUTION.equals(type)) {
event = new ResolutionEvent(ResolutionType.convert(change));
}
if (ASSIGNMENT.equals(type)) {
event = new AssignmentEvent(change);
}
if (type.contains(ATTACHMENT) && type.contains("Flag")) {
event = new AttachmentEvent(AttachmentEvent.parseId(type), AttachmentEvent.parseFlags(change));
}
event.setAdded(change);
return event;
}
private void setAdded(String added) {
this.added = added;
}
public void setRemoved(String removed) {
this.removed = removed;
}
private void setWhat(String what) {
this.what = what;
}
public void setDate(String date) {
this.date = date;
}
public void setName(String name) {
this.name = name;
}
public String getAdded() {
return this.added;
}
public String getRemoved() {
return this.removed;
}
public String getWhat() {
return this.what;
}
public String getDate() {
return this.date;
}
public String getName() {
return this.name;
}
@Override
public String toString() {
return this.name + " | " + this.date + " | " + this.what + " | " + this.removed + " | " + this.added;
}
public int compareTo(TaskRevision o) {
return this.date.compareTo(o.getDate());
}
}
|