|
|
@@ -57,7 +57,7 @@ public final class CargoTrackingViewAdapter {
|
|
57
|
57
|
}
|
|
58
|
58
|
|
|
59
|
59
|
/**
|
|
60
|
|
- * @return A translated string describing the cargo status.
|
|
|
60
|
+ * @return A translated string describing the cargo status.
|
|
61
|
61
|
*/
|
|
62
|
62
|
public String getStatusText() {
|
|
63
|
63
|
final Delivery delivery = cargo.delivery();
|
|
|
@@ -66,10 +66,10 @@ public final class CargoTrackingViewAdapter {
|
|
66
|
66
|
final Object[] args;
|
|
67
|
67
|
switch (delivery.transportStatus()) {
|
|
68
|
68
|
case IN_PORT:
|
|
69
|
|
- args = new Object[] {getDisplayText(delivery.lastKnownLocation())};
|
|
|
69
|
+ args = new Object[]{getDisplayText(delivery.lastKnownLocation())};
|
|
70
|
70
|
break;
|
|
71
|
71
|
case ONBOARD_CARRIER:
|
|
72
|
|
- args = new Object[] {delivery.currentVoyage().voyageNumber().idString()};
|
|
|
72
|
+ args = new Object[]{delivery.currentVoyage().voyageNumber().idString()};
|
|
73
|
73
|
break;
|
|
74
|
74
|
case CLAIMED:
|
|
75
|
75
|
case NOT_RECEIVED:
|
|
|
@@ -78,7 +78,7 @@ public final class CargoTrackingViewAdapter {
|
|
78
|
78
|
args = null;
|
|
79
|
79
|
break;
|
|
80
|
80
|
}
|
|
81
|
|
-
|
|
|
81
|
+
|
|
82
|
82
|
return messageSource.getMessage(code, args, "[Unknown status]", locale);
|
|
83
|
83
|
}
|
|
84
|
84
|
|
|
|
@@ -107,33 +107,33 @@ public final class CargoTrackingViewAdapter {
|
|
107
|
107
|
Date eta = cargo.delivery().estimatedTimeOfArrival();
|
|
108
|
108
|
|
|
109
|
109
|
if (eta == null) return "?";
|
|
110
|
|
- else {
|
|
111
|
|
- Location destination = cargo.routeSpecification().destination();
|
|
112
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat(FORMAT);
|
|
113
|
|
- dateFormat.setTimeZone(destination.timeZone());
|
|
114
|
|
- return dateFormat.format(eta);
|
|
115
|
|
- }
|
|
|
110
|
+ else {
|
|
|
111
|
+ Location destination = cargo.routeSpecification().destination();
|
|
|
112
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat(FORMAT);
|
|
|
113
|
+ dateFormat.setTimeZone(destination.timeZone());
|
|
|
114
|
+ return dateFormat.format(eta);
|
|
|
115
|
+ }
|
|
116
|
116
|
}
|
|
117
|
117
|
|
|
118
|
118
|
public String getNextExpectedActivity() {
|
|
119
|
|
- HandlingActivity activity = cargo.delivery().nextExpectedActivity();
|
|
120
|
|
- if (activity == null) {
|
|
121
|
|
- return "";
|
|
122
|
|
- }
|
|
|
119
|
+ HandlingActivity activity = cargo.delivery().nextExpectedActivity();
|
|
|
120
|
+ if (activity == null) {
|
|
|
121
|
+ return "";
|
|
|
122
|
+ }
|
|
123
|
123
|
|
|
124
|
124
|
String text = "Next expected activity is to ";
|
|
125
|
125
|
HandlingEvent.Type type = activity.type();
|
|
126
|
126
|
if (type.sameValueAs(HandlingEvent.Type.LOAD)) {
|
|
127
|
|
- return
|
|
128
|
|
- text + type.name().toLowerCase() + " cargo onto voyage " + activity.voyage().voyageNumber() +
|
|
|
127
|
+ return
|
|
|
128
|
+ text + type.name().toLowerCase() + " cargo onto voyage " + activity.voyage().voyageNumber() +
|
|
129
|
129
|
" in " + activity.location().name();
|
|
130
|
|
- } else if (type.sameValueAs(HandlingEvent.Type.UNLOAD)) {
|
|
131
|
|
- return
|
|
132
|
|
- text + type.name().toLowerCase() + " cargo off of " + activity.voyage().voyageNumber() +
|
|
|
130
|
+ } else if (type.sameValueAs(HandlingEvent.Type.UNLOAD)) {
|
|
|
131
|
+ return
|
|
|
132
|
+ text + type.name().toLowerCase() + " cargo off of " + activity.voyage().voyageNumber() +
|
|
133
|
133
|
" in " + activity.location().name();
|
|
134
|
|
- } else {
|
|
135
|
|
- return text + type.name().toLowerCase() + " cargo in " + activity.location().name();
|
|
136
|
|
- }
|
|
|
134
|
+ } else {
|
|
|
135
|
+ return text + type.name().toLowerCase() + " cargo in " + activity.location().name();
|
|
|
136
|
+ }
|
|
137
|
137
|
}
|
|
138
|
138
|
|
|
139
|
139
|
/**
|
|
|
@@ -170,8 +170,8 @@ public final class CargoTrackingViewAdapter {
|
|
170
|
170
|
* @return Time when the event was completed.
|
|
171
|
171
|
*/
|
|
172
|
172
|
public String getTime() {
|
|
173
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat(FORMAT);
|
|
174
|
|
- dateFormat.setTimeZone(handlingEvent.location().timeZone());
|
|
|
173
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat(FORMAT);
|
|
|
174
|
+ dateFormat.setTimeZone(handlingEvent.location().timeZone());
|
|
175
|
175
|
|
|
176
|
176
|
return dateFormat.format(handlingEvent.completionTime());
|
|
177
|
177
|
}
|
|
|
@@ -204,7 +204,7 @@ public final class CargoTrackingViewAdapter {
|
|
204
|
204
|
switch (handlingEvent.type()) {
|
|
205
|
205
|
case LOAD:
|
|
206
|
206
|
case UNLOAD:
|
|
207
|
|
- args = new Object[] {
|
|
|
207
|
+ args = new Object[]{
|
|
208
|
208
|
handlingEvent.voyage().voyageNumber().idString(),
|
|
209
|
209
|
handlingEvent.location().name(),
|
|
210
|
210
|
handlingEvent.completionTime()
|
|
|
@@ -213,21 +213,21 @@ public final class CargoTrackingViewAdapter {
|
|
213
|
213
|
|
|
214
|
214
|
case RECEIVE:
|
|
215
|
215
|
case CLAIM:
|
|
216
|
|
- args = new Object[] {
|
|
|
216
|
+ args = new Object[]{
|
|
217
|
217
|
handlingEvent.location().name(),
|
|
218
|
218
|
handlingEvent.completionTime()
|
|
219
|
219
|
};
|
|
220
|
220
|
break;
|
|
221
|
221
|
|
|
222
|
222
|
default:
|
|
223
|
|
- args = new Object[] {};
|
|
|
223
|
+ args = new Object[]{};
|
|
224
|
224
|
}
|
|
225
|
225
|
|
|
226
|
226
|
String key = "deliveryHistory.eventDescription." + handlingEvent.type().name();
|
|
227
|
227
|
|
|
228
|
|
- return messageSource.getMessage(key,args,locale);
|
|
|
228
|
+ return messageSource.getMessage(key, args, locale);
|
|
229
|
229
|
}
|
|
230
|
230
|
|
|
231
|
231
|
}
|
|
232
|
|
-
|
|
|
232
|
+
|
|
233
|
233
|
}
|