bug4941 added resolving of boats and marks for use in QrCodePlace

This commit is contained in:
Kai Börnert committed 2019-04-01 16:19:32 +02:00
1 parent ab9f779465
commit 763a19f46b
3 files changed
+54 -1

No files matched your search

@@ -7,7 +7,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import com.google.gwt.user.client.rpc.RemoteService;
import com.sap.sailing.domain.abstractlog.Revokable;
import com.sap.sailing.domain.abstractlog.race.RaceLog;
@@ -937,4 +937,14 @@ public interface SailingService extends RemoteService, FileStorageManagementGwtS
Set<ImageDTO> resizeImage(ImageResizingTaskDTO imageResizingTask) throws Exception;
MailInvitationType getMailType();
/**
* Allows reading public Boats, or Boats that are registered in races belonging to the given regatta
*/
BoatDTO getBoat(UUID boatId, String regattaName, String regattaRegistrationLinkSecret);
/**
* Allows reading public Marks, or Marks that are registered in races belonging to the given regatta
*/
MarkDTO getMark(UUID markId, String regattaName, String regattaRegistrationLinkSecret);
}
@@ -1026,4 +1026,16 @@ public interface SailingServiceAsync extends ServerInfoRetriever, FileStorageMan
void resizeImage(ImageResizingTaskDTO imageResizingTask, AsyncCallback<Set<ImageDTO>> asyncCallback);
void getMailType(AsyncCallback<MailInvitationType> callback);
/**
* Allows reading public Boats, or Boats that are registered in races belonging to the given regatta
*/
void getBoat(UUID boatId, String regattaName, String regattaRegistrationLinkSecret,
AsyncCallback<BoatDTO> asyncCallback);
/**
* Allows reading public Marks, or Marks that are registered in races belonging to the given regatta
*/
void getMark(UUID markId, String regattaName, String regattaRegistrationLinkSecret,
AsyncCallback<MarkDTO> asyncCallback);
}
@@ -8168,4 +8168,35 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet
.valueOf(System.getProperty(MAILTYPE_PROPERTY, MailInvitationType.LEGACY.name()));
return type;
}
@Override
public BoatDTO getBoat(UUID boatId, String regattaName, String regattaRegistrationLinkSecret) {
BoatDTO result = null;
Regatta regatta = getService().getRegattaByName(regattaName);
for(Boat boat:regatta.getAllBoats()) {
// TODO add visibility check on permission-vertical here
if (Util.equalsWithNull(boatId, boat.getId())) {
result = getBaseDomainFactory().convertToBoatDTO(boat);
}
}
return result;
}
@Override
public MarkDTO getMark(UUID markId, String regattaName, String regattaRegistrationLinkSecret) {
// TODO add visibility check on permission-vertical here
MarkDTO result = null;
Leaderboard leaderboard = getService().getLeaderboardByName(regattaName);
if (leaderboard != null && leaderboard instanceof RegattaLeaderboard) {
for (final RaceColumn raceColumn : leaderboard.getRaceColumns()) {
for (final Mark availableMark : raceColumn.getAvailableMarks()) {
if (availableMark.getId().toString().equals(markId)) {
result = convertToMarkDTO((RegattaLeaderboard) leaderboard, availableMark);
break;
}
}
}
}
return result;
}
}