Bug 4104: Renamed latestReceivedTagTime on server side to searchSince to match role.

This commit is contained in:
Henri Kohlberg committed 2018-09-21 12:16:58 +02:00
1 parent d1461376df
commit ee9238541a
5 files changed
+33 -33

No files matched your search

@@ -12,6 +12,7 @@ import com.google.gwt.user.client.rpc.RemoteService;
import com.sap.sailing.domain.abstractlog.Revokable;
import com.sap.sailing.domain.abstractlog.race.RaceLog;
import com.sap.sailing.domain.abstractlog.race.RaceLogTagEvent;
import com.sap.sailing.domain.abstractlog.race.state.ReadonlyRaceState;
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogDenoteForTrackingEvent;
import com.sap.sailing.domain.base.RaceColumn;
import com.sap.sailing.domain.common.CompetitorDescriptor;
@@ -64,6 +65,7 @@ import com.sap.sailing.expeditionconnector.ExpeditionDeviceConfiguration;
import com.sap.sailing.gwt.ui.adminconsole.RaceLogSetTrackingTimesDTO;
import com.sap.sailing.gwt.ui.client.shared.charts.MarkPositionService.MarkTrackDTO;
import com.sap.sailing.gwt.ui.client.shared.charts.MarkPositionService.MarkTracksDTO;
import com.sap.sailing.gwt.ui.server.RaceLogTagEvents;
import com.sap.sailing.gwt.ui.shared.BulkScoreCorrectionDTO;
import com.sap.sailing.gwt.ui.shared.CompactBoatPositionsDTO;
import com.sap.sailing.gwt.ui.shared.CompactRaceMapDataDTO;
@@ -197,13 +199,23 @@ public interface SailingService extends RemoteService, FileStorageManagementGwtS
RaceTimesInfoDTO getRaceTimesInfo(RegattaAndRaceIdentifier raceIdentifier);
RaceTimesInfoDTO getRaceTimesInfoIncludingTags(RegattaAndRaceIdentifier raceIdentifier,
TimePoint latestReceivedTagTime);
/**
* Returns {@link RaceTimesInfoDTO race times info} for specified race (<code>raceIdentifier</code>) including
* {@link RaceLogTagEvent tag events} since received timestamp (<code>searchSince</code>). Loads tags from
* {@link ReadonlyRaceState cache} instead of scanning the whole {@link RaceLog} every request.
*/
RaceTimesInfoDTO getRaceTimesInfoIncludingTags(RegattaAndRaceIdentifier raceIdentifier, TimePoint searchSince);
List<RaceTimesInfoDTO> getRaceTimesInfos(Collection<RegattaAndRaceIdentifier> raceIdentifiers);
/**
* Collects besides {@link RaceTimesInfoDTO race times infos} public {@link RaceLogTagEvent tag events} from
* {@link ReadonlyRaceState cache} and compares the <code>createdAt</code> timepoint to the received
* <code>searchSince</code> timepoint. Returns {@link RaceTimesInfoDTO race times infos} including
* {@link RaceLogTagEvents public tag events} since the latest client-side received tag.
*/
List<RaceTimesInfoDTO> getRaceTimesInfosIncludingTags(Collection<RegattaAndRaceIdentifier> raceIdentifiers,
Map<RegattaAndRaceIdentifier, TimePoint> latestReceivedTagTimes);
Map<RegattaAndRaceIdentifier, TimePoint> searchSinceMap);
CoursePositionsDTO getCoursePositions(RegattaAndRaceIdentifier raceIdentifier, Date date);
@@ -240,15 +240,14 @@ public interface SailingServiceAsync extends ServerInfoRetriever, FileStorageMan
void getRaceTimesInfo(RegattaAndRaceIdentifier raceIdentifier, AsyncCallback<RaceTimesInfoDTO> callback);
void getRaceTimesInfoIncludingTags(RegattaAndRaceIdentifier raceIdentifier, TimePoint latestReceivedTagTime,
void getRaceTimesInfoIncludingTags(RegattaAndRaceIdentifier raceIdentifier, TimePoint searchSince,
AsyncCallback<RaceTimesInfoDTO> callback);
void getRaceTimesInfos(Collection<RegattaAndRaceIdentifier> raceIdentifiers,
AsyncCallback<List<RaceTimesInfoDTO>> callback);
void getRaceTimesInfosIncludingTags(Collection<RegattaAndRaceIdentifier> raceIdentifiers,
Map<RegattaAndRaceIdentifier, TimePoint> latestReceivedTagTimes,
AsyncCallback<List<RaceTimesInfoDTO>> callback);
Map<RegattaAndRaceIdentifier, TimePoint> searchSinceMap, AsyncCallback<List<RaceTimesInfoDTO>> callback);
void getCoursePositions(RegattaAndRaceIdentifier raceIdentifier, Date date,
AsyncCallback<CoursePositionsDTO> asyncCallback);
@@ -2234,17 +2234,11 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet
return raceTimesInfo;
}
/**
* Returns {@link RaceTimesInfoDTO race times info} for specified race (<code>raceIdentifier</code>) including
* {@link RaceLogTagEvent tag events} since received timestamp (<code>latestReceivedTagTime</code>). Loads tags from
* {@link ReadonlyRaceState cache} instead of scanning the whole {@link RaceLog} every request.
*/
// TODO: rename latestReceivedTagTime to match role
@Override
public RaceTimesInfoDTO getRaceTimesInfoIncludingTags(RegattaAndRaceIdentifier raceIdentifier,
TimePoint latestReceivedTagTime) {
TimePoint searchSince) {
RaceTimesInfoDTO raceTimesInfo = getRaceTimesInfo(raceIdentifier);
raceTimesInfo.setTags(getService().getTaggingService().getPublicTags(raceIdentifier, latestReceivedTagTime));
raceTimesInfo.setTags(getService().getTaggingService().getPublicTags(raceIdentifier, searchSince));
return raceTimesInfo;
}
@@ -2260,19 +2254,13 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet
return raceTimesInfos;
}
/**
* Collects besides {@link RaceTimesInfoDTO race times infos} public {@link RaceLogTagEvent tag events} from
* {@link ReadonlyRaceState cache} and compares the <code>createdAt</code> timepoint to the received latest tag
* creation timepoint. Returns {@link RaceTimesInfoDTO race times infos} including {@link RaceLogTagEvents public
* tag events} since the latest client-side received tag.
*/
@Override
public List<RaceTimesInfoDTO> getRaceTimesInfosIncludingTags(Collection<RegattaAndRaceIdentifier> raceIdentifiers,
Map<RegattaAndRaceIdentifier, TimePoint> latestReceivedTagTimes) {
Map<RegattaAndRaceIdentifier, TimePoint> searchSinceMap) {
List<RaceTimesInfoDTO> raceTimesInfos = new ArrayList<RaceTimesInfoDTO>();
for (RegattaAndRaceIdentifier raceIdentifier : raceIdentifiers) {
RaceTimesInfoDTO raceTimesInfo = getRaceTimesInfoIncludingTags(raceIdentifier,
latestReceivedTagTimes.get(raceIdentifier));
searchSinceMap.get(raceIdentifier));
if (raceTimesInfo != null) {
raceTimesInfos.add(raceTimesInfo);
}
@@ -9,7 +9,6 @@ import com.sap.sse.common.TimePoint;
// TODO: Replace error handling by throwing exceptions, see "topleveltranslations.json"
// TODO: CommentTooLong
// TODO: rename latestReceivedTagTime to match role
// TODO: remove entry in settings if there are no private tags for this race anymore
// TODO: rename keys to naming pattern (ssailing.tags....)
// TODO: use document settings id for tags/tag-buttons/... as race identifier
@@ -119,8 +118,8 @@ public interface TaggingService {
* new privacy status
* @return <code>true</code> if tag was updated successfully, otherwise <code>false</code>
*/
boolean updateTag(String leaderboardName, String raceColumnName, String fleetName, TagDTO tagToUpdate,
String tag, String comment, String imageURL, boolean visibleForPublic);
boolean updateTag(String leaderboardName, String raceColumnName, String fleetName, TagDTO tagToUpdate, String tag,
String comment, String imageURL, boolean visibleForPublic);
/**
* Returns all public tags for the specified race.
@@ -137,14 +136,16 @@ public interface TaggingService {
List<TagDTO> getPublicTags(String leaderboardName, String raceColumnName, String fleetName);
/**
* Returns all public tags since the given <code>latestReceivedTagTime</code> for the specified race.
* Returns all public tags since the given <code>searchSinceTimePoint</code> for the specified race.
*
* @param raceIdentifier
* required to identify {@link RaceLog}, must <b>NOT</b> be <code>null</code>
* @param searchSince
* tags will only be returned if they got created after this time point
* @return list of {@link TagDTO tags}, empty list in case an error occurs or there are no tags available but
* <b>never null</b>!
*/
List<TagDTO> getPublicTags(RegattaAndRaceIdentifier raceIdentifier, TimePoint latestReceivedTagTime);
List<TagDTO> getPublicTags(RegattaAndRaceIdentifier raceIdentifier, TimePoint searchSince);
/**
* Returns all private tags of current user for the specified race.
@@ -280,7 +280,7 @@ public class TaggingServiceImpl implements TaggingService {
}
@Override
public List<TagDTO> getPublicTags(RegattaAndRaceIdentifier raceIdentifier, TimePoint latestReceivedTagTime) {
public List<TagDTO> getPublicTags(RegattaAndRaceIdentifier raceIdentifier, TimePoint searchSince) {
final List<TagDTO> result = new ArrayList<TagDTO>();
TrackedRace trackedRace = racingService.getExistingTrackedRace(raceIdentifier);
Iterable<RaceLog> raceLogs = trackedRace.getAttachedRaceLogs();
@@ -288,11 +288,11 @@ public class TaggingServiceImpl implements TaggingService {
ReadonlyRaceState raceState = ReadonlyRaceStateImpl.getOrCreate(racingService, raceLog);
Iterable<RaceLogTagEvent> foundTagEvents = raceState.getTagEvents();
for (RaceLogTagEvent tagEvent : foundTagEvents) {
if ((latestReceivedTagTime == null && tagEvent.getRevokedAt() == null)
|| (latestReceivedTagTime != null && tagEvent.getRevokedAt() == null
&& tagEvent.getCreatedAt().after(latestReceivedTagTime))
|| (latestReceivedTagTime != null && tagEvent.getRevokedAt() != null
&& tagEvent.getRevokedAt().after(latestReceivedTagTime))) {
if ((searchSince == null && tagEvent.getRevokedAt() == null)
|| (searchSince != null && tagEvent.getRevokedAt() == null
&& tagEvent.getCreatedAt().after(searchSince))
|| (searchSince != null && tagEvent.getRevokedAt() != null
&& tagEvent.getRevokedAt().after(searchSince))) {
result.add(new TagDTO(tagEvent.getTag(), tagEvent.getComment(), tagEvent.getImageURL(),
true, tagEvent.getUsername(), tagEvent.getLogicalTimePoint(), tagEvent.getCreatedAt(),
tagEvent.getRevokedAt()));