mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-04 18:20:14 +00:00
switched around deviceId serialization pair, 'prettified' device mapping table
This commit is contained in:
1 parent
49ca30c0a1
commit
1c81230e8c
12 files changed
+28
-21
No files matched your search
+5
@@ -113,4 +113,9 @@ public class TimeRangeImpl extends Pair<TimePoint, TimePoint> implements TimeRan
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return from() + "-" + to();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -12,7 +12,7 @@ public class SmartphoneImeiSerializationHandler {
|
||||
}
|
||||
|
||||
public Pair<String, String> serialize(DeviceIdentifier deviceIdentifier) throws TransformationException {
|
||||
return new Pair<String, String>(castIdentifier(deviceIdentifier).getImei(), SmartphoneImeiIdentifier.TYPE);
|
||||
return new Pair<String, String>(SmartphoneImeiIdentifier.TYPE, castIdentifier(deviceIdentifier).getImei());
|
||||
}
|
||||
|
||||
public DeviceIdentifier deserialize(String input, String type, String stringRep) {
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ public class PingDeviceIdentifierSerializationHandler {
|
||||
}
|
||||
|
||||
public Pair<String, String> serialize(DeviceIdentifier deviceIdentifier) throws TransformationException {
|
||||
return new Pair<String, String>(castIdentifier(deviceIdentifier).getId().toString(), PingDeviceIdentifier.TYPE);
|
||||
return new Pair<String, String>(PingDeviceIdentifier.TYPE, castIdentifier(deviceIdentifier).getId().toString());
|
||||
}
|
||||
|
||||
public DeviceIdentifier deserialize(String input, String type, String stringRep) {
|
||||
|
||||
+2
-2
@@ -49,7 +49,7 @@ public class TrackFileImportDeviceIdentifierJsonHandler implements DeviceIdentif
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<JSONObject, String> serialize(DeviceIdentifier deviceIdentifier) throws TransformationException {
|
||||
public Pair<String, JSONObject> serialize(DeviceIdentifier deviceIdentifier) throws TransformationException {
|
||||
TrackFileImportDeviceIdentifier id = TrackFileImportDeviceIdentifierImpl.cast(deviceIdentifier);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put(Fields.UUID.name(), id.getId().toString());
|
||||
@@ -59,7 +59,7 @@ public class TrackFileImportDeviceIdentifierJsonHandler implements DeviceIdentif
|
||||
result.put(Fields.FROM_MILLIS.name(), storeTimePoint(id.getFixesTimeRange().from()));
|
||||
result.put(Fields.TO_MILLIS.name(), storeTimePoint(id.getFixesTimeRange().to()));
|
||||
result.put(Fields.NUM_FIXES.name(), id.getNumberOfFixes());
|
||||
return new Pair<JSONObject, String>(result, TrackFileImportDeviceIdentifier.TYPE);
|
||||
return new Pair<String ,JSONObject>(TrackFileImportDeviceIdentifier.TYPE, result);
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -37,7 +37,7 @@ public class TrackFileImportDeviceIdentifierMongoHandler implements DeviceIdenti
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<DBObject, String> serialize(DeviceIdentifier deviceIdentifier) throws TransformationException {
|
||||
public Pair<String ,DBObject> serialize(DeviceIdentifier deviceIdentifier) throws TransformationException {
|
||||
TrackFileImportDeviceIdentifier id = TrackFileImportDeviceIdentifierImpl.cast(deviceIdentifier);
|
||||
DBObject result = new BasicDBObject();
|
||||
result.put(Fields.UUID.name(), id.getId().toString());
|
||||
@@ -50,7 +50,7 @@ public class TrackFileImportDeviceIdentifierMongoHandler implements DeviceIdenti
|
||||
result.put(Fields.TO_MILLIS.name(), TrackFileImportDeviceIdentifierJsonHandler.
|
||||
storeTimePoint(id.getFixesTimeRange().to()));
|
||||
result.put(Fields.NUM_FIXES.name(), id.getNumberOfFixes());
|
||||
return new Pair<DBObject, String>(result, TrackFileImportDeviceIdentifier.TYPE);
|
||||
return new Pair<String ,DBObject>(TrackFileImportDeviceIdentifier.TYPE, result);
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -15,7 +15,7 @@ public class TrackFileImportDeviceIdentifierStringSerializationHandler implement
|
||||
@Override
|
||||
public Pair<String, String> serialize(DeviceIdentifier deviceIdentifier) throws TransformationException {
|
||||
TrackFileImportDeviceIdentifier id = TrackFileImportDeviceIdentifierImpl.cast(deviceIdentifier);
|
||||
return new Pair<String, String>(id.toString(), TrackFileImportDeviceIdentifier.TYPE);
|
||||
return new Pair<String, String>(TrackFileImportDeviceIdentifier.TYPE, id.getStringRepresentation());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -27,9 +27,9 @@ public interface DeviceIdentifierSerializationHandler<T> {
|
||||
* serializer, that actually returns some generic serializiation (e.g. {@link PlaceHolderDeviceIdentifier}).
|
||||
*
|
||||
* @param deviceIdentifier
|
||||
* @return A pair consisting of the {@code serialized identifier} and the {@code device type}.
|
||||
* @return A pair: <{@code device type}, {@code serialized identifier}>
|
||||
*/
|
||||
Pair<? extends T, String> serialize(DeviceIdentifier deviceIdentifier) throws TransformationException;
|
||||
Pair<String, ? extends T> serialize(DeviceIdentifier deviceIdentifier) throws TransformationException;
|
||||
|
||||
/**
|
||||
* Deserialize the identifier. In case this is a fallback deserializer (e.g. for {@link PlaceHolderDeviceIdentifier}),
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ public class PlaceHolderDeviceIdentifierSerializationHandler {
|
||||
}
|
||||
|
||||
public Pair<String, String> serialize(DeviceIdentifier object) throws TransformationException {
|
||||
return new Pair<String, String>(object.getIdentifierType(), PlaceHolderDeviceIdentifier.TYPE);
|
||||
return new Pair<String, String>(object.getIdentifierType(), object.getStringRepresentation());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -206,3 +206,7 @@ select {
|
||||
.gwt-SuggestBoxPopup .item-selected {
|
||||
background-color: #ffc;
|
||||
}
|
||||
|
||||
.wrap-cols td div {
|
||||
white-space: normal;
|
||||
}
|
||||
+5
-1
@@ -3,6 +3,7 @@ package com.sap.sailing.gwt.ui.adminconsole;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
|
||||
import com.google.gwt.user.cellview.client.TextColumn;
|
||||
import com.google.gwt.view.client.SingleSelectionModel;
|
||||
@@ -18,6 +19,9 @@ public class DeviceMappingTableWrapper extends TableWrapper<DeviceMappingDTO, Si
|
||||
ErrorReporter errorReporter) {
|
||||
super(sailingService, stringMessages, errorReporter, new SingleSelectionModel<DeviceMappingDTO>());
|
||||
|
||||
table.setWidth("1000px", true);
|
||||
table.addStyleName("wrap-cols");
|
||||
|
||||
ListHandler<DeviceMappingDTO> listHandler = new ListHandler<DeviceMappingDTO>(dataProvider.getList());
|
||||
|
||||
TextColumn<DeviceMappingDTO> itemTypeCol = new TextColumn<DeviceMappingDTO>() {
|
||||
@@ -80,7 +84,7 @@ public class DeviceMappingTableWrapper extends TableWrapper<DeviceMappingDTO, Si
|
||||
}
|
||||
});
|
||||
table.addColumn(deviceIdCol, stringMessages.deviceId());
|
||||
table.setColumnWidth(deviceIdCol, "300px");
|
||||
table.setColumnWidth(deviceIdCol, 400, Unit.PX);
|
||||
|
||||
TextColumn<DeviceMappingDTO> fromCol = new TextColumn<DeviceMappingDTO>() {
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -4254,7 +4254,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
private String serializeDeviceIdentifier(DeviceIdentifier deviceId) throws TransformationException {
|
||||
return getDeviceIdentifierStringSerializerHandlerFinder(true).findService(
|
||||
deviceId.getIdentifierType()).serialize(deviceId).getA();
|
||||
deviceId.getIdentifierType()).serialize(deviceId).getB();
|
||||
}
|
||||
|
||||
private DeviceMappingDTO convertToDeviceMappingDTO(DeviceMapping<?> mapping) throws TransformationException {
|
||||
|
||||
+3
-9
@@ -1,7 +1,5 @@
|
||||
package com.sap.sailing.server.gateway.trackfiles;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -14,7 +12,6 @@ import com.sap.sailing.domain.racelog.tracking.DeviceIdentifier;
|
||||
|
||||
public class TrackFileImportDeviceIdentifierImpl implements TrackFileImportDeviceIdentifier {
|
||||
private static final long serialVersionUID = 552465264341485161L;
|
||||
private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
private final UUID id;
|
||||
private final String fileName;
|
||||
private final String trackName;
|
||||
@@ -57,16 +54,13 @@ public class TrackFileImportDeviceIdentifierImpl implements TrackFileImportDevic
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String from = dateFormat.format(timeRange.from().asDate());
|
||||
String to = dateFormat.format(timeRange.to().asDate());
|
||||
String uploaded = timePoint == null ? "" : dateFormat.format(timePoint.asDate());
|
||||
return String.format("%s: %s(%s-%s, %s fixes) @%s(uploaded %s)",
|
||||
id.toString(), trackName, from, to, numberOfFixes, fileName, uploaded);
|
||||
return id.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStringRepresentation() {
|
||||
return toString();
|
||||
return String.format("%s: %s(%s, %s fixes)\n @%s(uploaded %s)",
|
||||
id.toString(), trackName, timeRange, numberOfFixes, fileName, timePoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user