Merge branch 'master' into ubilabs--ios--develop

This commit is contained in:
Axel Uhl committed 2016-04-01 14:16:03 +02:00
commit cbfc53dfcf
7 files changed
+43 -35

No files matched your search

@@ -23,6 +23,7 @@ public class CompetitorJsonConstants {
public static final String FIELD_DISPLAY_COLOR = "displayColor";
public static final String FIELD_EMAIL = "email";
public static final String FIELD_FLAG_IMAGE_URI = "flagImageUri";
public static final String FIELD_TEAM_IMAGE_URI = "teamImageUri";
public static final String FIELD_TIME_ON_TIME_FACTOR = "timeOnTimeFactor";
public static final String FIELD_TIME_ON_DISTANCE_ALLOWANCE_IN_SECONDS_PER_NAUTICAL_MILE = "timeOnDistanceAllowanceInSecondsPerNauticalMile";
}
@@ -1802,23 +1802,31 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
logger.log(Level.WARNING, "Could not load deviceId for RaceLogEvent", e);
e.printStackTrace();
}
final Serializable competitorId = (Serializable) dbObject.get(FieldNames.COMPETITOR_ID.name());
Competitor mappedTo = baseDomainFactory.getExistingCompetitorById(
(Serializable) dbObject.get(FieldNames.COMPETITOR_ID.name()));
@SuppressWarnings("deprecation") // used only for auto-migration; may be removed in future releases
final FieldNames deprecatedFromFieldName = FieldNames.RACE_LOG_FROM;
@SuppressWarnings("deprecation") // used only for auto-migration; may be removed in future releases
final FieldNames deprecatedToFieldName = FieldNames.RACE_LOG_TO;
Triple<TimePoint, TimePoint, Boolean> times = loadFromToTimePoint(dbObject, FieldNames.REGATTA_LOG_FROM, deprecatedFromFieldName, FieldNames.REGATTA_LOG_TO, deprecatedToFieldName);
final TimePoint from = times.getA();
final TimePoint to = times.getB();
final boolean needsMigration = times.getC();
final RegattaLogDeviceCompetitorMappingEventImpl result = new RegattaLogDeviceCompetitorMappingEventImpl(createdAt, logicalTimePoint, author, id, mappedTo, device, from, to);
if (needsMigration) {
// remove old version of mapping event
WriteResult removeResult = database.getCollection(CollectionNames.REGATTA_LOGS.name()).remove(outerDBObject);
assert removeResult.getN() == 1;
// and then insert using the fixed storage implementation
new MongoObjectFactoryImpl(database, serviceFinderFactory).storeRegattaLogEvent(regattaLogIdentifier, result);
competitorId);
final RegattaLogDeviceCompetitorMappingEventImpl result;
if (mappedTo == null) {
logger.severe("Found a "+RegattaLogDeviceCompetitorMappingEventImpl.class.getName()+
" event but couldn't find competitor with ID "+competitorId);
result = null;
} else {
@SuppressWarnings("deprecation") // used only for auto-migration; may be removed in future releases
final FieldNames deprecatedFromFieldName = FieldNames.RACE_LOG_FROM;
@SuppressWarnings("deprecation") // used only for auto-migration; may be removed in future releases
final FieldNames deprecatedToFieldName = FieldNames.RACE_LOG_TO;
Triple<TimePoint, TimePoint, Boolean> times = loadFromToTimePoint(dbObject, FieldNames.REGATTA_LOG_FROM, deprecatedFromFieldName, FieldNames.REGATTA_LOG_TO, deprecatedToFieldName);
final TimePoint from = times.getA();
final TimePoint to = times.getB();
final boolean needsMigration = times.getC();
result = new RegattaLogDeviceCompetitorMappingEventImpl(createdAt, logicalTimePoint, author, id, mappedTo, device, from, to);
if (needsMigration) {
// remove old version of mapping event
WriteResult removeResult = database.getCollection(CollectionNames.REGATTA_LOGS.name()).remove(outerDBObject);
assert removeResult.getN() == 1;
// and then insert using the fixed storage implementation
new MongoObjectFactoryImpl(database, serviceFinderFactory).storeRegattaLogEvent(regattaLogIdentifier, result);
}
}
return result;
}
@@ -447,6 +447,7 @@ import com.sap.sse.common.TypeBasedServiceFinderFactory;
import com.sap.sse.common.Util;
import com.sap.sse.common.Util.Pair;
import com.sap.sse.common.Util.Triple;
import com.sap.sse.common.WithID;
import com.sap.sse.common.impl.MillisecondsTimePoint;
import com.sap.sse.common.impl.TimeRangeImpl;
import com.sap.sse.common.mail.MailException;
@@ -5356,12 +5357,15 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
Date to = mapping.getTimeRange().to() == null || mapping.getTimeRange().to().asMillis() == Long.MAX_VALUE ?
null : mapping.getTimeRange().to().asDate();
MappableToDevice item = null;
if (mapping.getMappedTo() instanceof Competitor) {
final WithID mappedTo = mapping.getMappedTo();
if (mappedTo == null) {
throw new RuntimeException("Device mapping not mapped to any object");
} else if (mappedTo instanceof Competitor) {
item = baseDomainFactory.convertToCompetitorDTO((Competitor) mapping.getMappedTo());
} else if (mapping.getMappedTo() instanceof Mark) {
} else if (mappedTo instanceof Mark) {
item = convertToMarkDTO((Mark) mapping.getMappedTo(), null);
} else {
throw new RuntimeException("Can only handle Competitor or Mark as mapped item type");
throw new RuntimeException("Can only handle Competitor or Mark as mapped item type, but not "+mappedTo.getClass().getName());
}
//Only deal with UUIDs - otherwise we would have to pass Serializable to browser context - which
//has a large performance implact for GWT.
@@ -17,7 +17,6 @@ import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceCompeti
import com.sap.sailing.domain.abstractlog.regatta.events.impl.RegattaLogDeviceCompetitorMappingEventImpl;
import com.sap.sailing.domain.base.Competitor;
import com.sap.sailing.domain.base.DomainFactory;
import com.sap.sailing.domain.base.impl.CompetitorImpl;
import com.sap.sailing.domain.common.racelog.tracking.TransformationException;
import com.sap.sailing.domain.persistence.PersistenceFactory;
import com.sap.sailing.domain.persistence.impl.DomainObjectFactoryImpl;
@@ -49,7 +48,7 @@ public class StoreAndLoadDeviceIdentifierTest extends AbstractMongoDBTest {
protected MongoObjectFactoryImpl mongoFactory;
protected DomainObjectFactoryImpl domainFactory;
protected RegattaLog RegattaLog;
protected RegattaLog regattaLog;
private TimePoint now() {
return MillisecondsTimePoint.now();
@@ -71,35 +70,28 @@ public class StoreAndLoadDeviceIdentifierTest extends AbstractMongoDBTest {
.getMongoObjectFactory(getMongoService(), factory);
domainFactory = (DomainObjectFactoryImpl) PersistenceFactory.INSTANCE
.getDomainObjectFactory(getMongoService(), DomainFactory.INSTANCE, factory);
RegattaLog = loadRegattaLog();
regattaLog = loadRegattaLog();
}
private DeviceIdentifier storeAndLoad(DeviceIdentifier device, TypeBasedServiceFinderFactory forStoring, TypeBasedServiceFinderFactory forLoading) {
createFactories(forStoring);
Competitor c = new CompetitorImpl("a", "a", null, null, null, null, null, /* timeOnTimeFactor */ null, /* timeOnDistanceAllowancePerNauticalMile */ null);
RegattaLog.add(new RegattaLogDeviceCompetitorMappingEventImpl(now(), now(), author, 0,
Competitor c = DomainFactory.INSTANCE.getOrCreateCompetitor("a", "a", null, null, null, null, null, /* timeOnTimeFactor */ null, /* timeOnDistanceAllowancePerNauticalMile */ null);
regattaLog.add(new RegattaLogDeviceCompetitorMappingEventImpl(now(), now(), author, 0,
c, device, now(), now()));
createFactories(forLoading);
RegattaLog loadedRegattaLog = loadRegattaLog();
loadedRegattaLog.lockForRead();
assertEquals(1, Util.size(loadedRegattaLog.getRawFixes()));
RegattaLogDeviceCompetitorMappingEvent mapping = (RegattaLogDeviceCompetitorMappingEvent) loadedRegattaLog.getRawFixes().iterator().next();
loadedRegattaLog.unlockAfterRead();
return mapping.getDevice();
}
@Test
public void testNormal() throws TransformationException, NoCorrespondingServiceRegisteredException {
TypeBasedServiceFinderFactory factory = new MockSmartphoneImeiServiceFinderFactory();
DeviceIdentifier smartphone = new SmartphoneImeiIdentifier("abc");
DeviceIdentifier loaded = storeAndLoad(smartphone, factory, factory);
assertEquals(smartphone, loaded);
}
@@ -58,9 +58,12 @@ public class CompetitorsResource extends AbstractSailingServerResource {
json.put(CompetitorJsonConstants.FIELD_COUNTRY_CODE, nationality==null?null:nationality.getCountryCode().getTwoLetterISOCode());
json.put(CompetitorJsonConstants.FIELD_BOAT_CLASS_NAME, competitor.getBoat().getBoatClass().getName());
json.put(CompetitorJsonConstants.FIELD_COLOR, competitor.getColor() != null ? competitor.getColor().getAsHtml() : null);
if(competitor.getFlagImage() != null) {
if (competitor.getFlagImage() != null) {
json.put(CompetitorJsonConstants.FIELD_FLAG_IMAGE, competitor.getFlagImage().toString());
}
if (competitor.getTeam().getImage() != null) {
json.put(CompetitorJsonConstants.FIELD_TEAM_IMAGE_URI, competitor.getTeam().getImage().toString());
}
return json;
}
@@ -202,18 +202,16 @@ public class CheckinManager {
private void getCompetitorFromServer(HttpGetRequest getCompetitorRequest, final URLData urlData, final String leaderboardName) {
NetworkHelper.getInstance(activity)
.executeHttpJsonRequestAsync(getCompetitorRequest, new NetworkHelper.NetworkHelperSuccessListener() {
@Override
public void performAction(JSONObject response) {
activity.dismissProgressDialog();
try {
// TODO review constants
urlData.competitorName = response.getString(CompetitorJsonConstants.FIELD_NAME);
urlData.competitorId = response.getString(CompetitorJsonConstants.FIELD_ID);
urlData.competitorSailId = response.getString(CompetitorJsonConstants.FIELD_SAIL_ID);
urlData.competitorNationality = response.getString(CompetitorJsonConstants.FIELD_NATIONALITY);
urlData.competitorCountryCode = response.getString(CompetitorJsonConstants.FIELD_COUNTRY_CODE);
// TODO Bug 3358: get optional team image from CompetitorJsonConstants.FIELD_TEAM_IMAGE_URI
} catch (JSONException e) {
ExLog.e(activity, TAG, "Error getting data from call on URL: " + urlData.competitorUrl + ", Error: " + e.getMessage());
handleApiError();
+2
View File
@@ -105,6 +105,8 @@ Also note that once released to Nexus, the next release build will have to use a
Make sure to replace `x.y.z` by the version to which you want to set your files. Then remember to uncomment the `<parent>` specification again.
Next, make sure to upgrade the versions in the `AndroidManifest.xml` files of the three apps we're currently shipping. The `android:versionCode` specifier is relevant for the PlayStore pushing the update to the users. The `android:versionName` is just a symbolic name which users will see (other than the `android:versionCode` which is not usually displayed to users). For the `android:versionName` we try to use a reasonable versioning scheme that should be independent of our internal rel-x.y numbering and the sequential, technical versionCode. Example: 1.1.
In order to get the Android release branch merged into the ``rel-x.y`` branch, the same process as explained above for the merge of iOS branches into ``fa/rel-x.y`` is required. In particular, this means that a Java Correction Workbench Correction Request [needs to be created](https://css.wdf.sap.corp/sap/bc/bsp/spn/jcwb/default.htm?newCMForProject=sapsailingcapture&newCMComponentName=SV-COE-MSO-CDP) and the latest commit to be pushed to ``refs/for/rel-x.y`` needs to be amended so that it contains a valid ``Change-Id:`` and ``CR-Id:`` line. Then, the commit needs to be voted on. Other than for the MiOS branches under ``fa/rel-x.y`` it seems to be required that _another_ committer votes with +2 to enable a merge. Once this has been done, the blue ``Submit`` button will appear on your change page (something like [https://git.wdf.sap.corp/#/c/1436212/](https://git.wdf.sap.corp/#/c/1436212/)) that you can use to technically get the commit merged into the ``rel-x.y`` branch.
Once this is done, a [Customer release build can be started](https://xmake-ldi.wdf.sap.corp:8443/view/SAPSail/job/sapsailingcapture-Release/). Select ``customer`` as the ``RELEASE_MODE`` and enter the ``rel-x.y`` branch name in the "TREEISH" field, make sure the Maven version 3.1.1 is selected and click the "Build" button. If the build succeeds, Final Assembly should be able to _promote_ the build artifact, such as the ``.apk`` files which should have been signed using the SAP certificate.