1
2
3
4
5
6 package pt.digitalis.dif.controller.objects;
7
8 import java.util.Date;
9
10 import pt.digitalis.dif.controller.interfaces.IDIFSession;
11 import pt.digitalis.dif.utils.ObjectFormatter;
12
13
14
15
16
17
18
19 public class Breadcrumb {
20
21
22 private IDIFSession difSession;
23
24
25 private String parameterPassed;
26
27
28 private String stageID;
29
30
31 private Date timestamp;
32
33
34
35
36 public Breadcrumb(String stageID)
37 {
38 this.stageID = stageID;
39 this.timestamp = new Date();
40 }
41
42
43
44
45
46
47 public IDIFSession getDifSession()
48 {
49 return difSession;
50 }
51
52
53
54
55
56
57 public String getParameterPassed()
58 {
59 return parameterPassed;
60 }
61
62
63
64
65
66
67 public String getStageID()
68 {
69 return stageID;
70 }
71
72
73
74
75
76
77 public Date getTimestamp()
78 {
79 return timestamp;
80 }
81
82
83
84
85 public boolean hasParameters()
86 {
87 return (parameterPassed != null && !"".equals(parameterPassed));
88 }
89
90
91
92
93
94
95 public boolean hasSessionSnapshot()
96 {
97 return (difSession != null);
98 }
99
100
101
102
103
104
105
106 public void setDifSession(IDIFSession difSession)
107 {
108 this.difSession = difSession;
109 }
110
111
112
113
114
115
116
117 public void setParameterPassed(String parameterPassed)
118 {
119 this.parameterPassed = parameterPassed;
120 }
121
122
123
124
125
126
127
128 public void setStageID(String stageID)
129 {
130 this.stageID = stageID;
131 }
132
133
134
135
136
137
138
139 public void setTimestamp(Date timestamp)
140 {
141 this.timestamp = timestamp;
142 }
143
144
145
146
147
148
149 @Override
150 public String toString()
151 {
152 ObjectFormatter formatter = new ObjectFormatter();
153 formatter.addItem("StageID", stageID);
154 formatter.addItem("Parameters", parameterPassed);
155 formatter.addItem("Timestamp", timestamp);
156 formatter.addItem("Session", difSession);
157
158 return formatter.getFormatedObject();
159 }
160 }