mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-15 08:41:01 +00:00
Implemented redirects for places that are invalid for specific events
This commit is contained in:
1 parent
3f5976cd9a
commit
58b4f89fd8
1 file changed
+28
-6
+28
-6
@@ -8,9 +8,11 @@ import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
|
||||
import com.sap.sailing.gwt.home.client.place.event.EventClientFactory;
|
||||
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.AbstractMultiregattaEventPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.EventMultiregattaActivity;
|
||||
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.tabs.MultiregattaMediaPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.tabs.MultiregattaRegattasPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event2.regatta.AbstractEventRegattaPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event2.regatta.EventRegattaActivity;
|
||||
import com.sap.sailing.gwt.home.client.place.event2.regatta.tabs.RegattaMediaPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event2.regatta.tabs.RegattaRacesPlace;
|
||||
import com.sap.sailing.gwt.ui.shared.eventview.EventViewDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.eventview.EventViewDTO.EventType;
|
||||
@@ -67,6 +69,7 @@ public class EventActivityProxy extends AbstractActivityProxy {
|
||||
if(place instanceof EventDefaultPlace) {
|
||||
place = getRealPlace();
|
||||
}
|
||||
place = verifyAndAdjustPlace();
|
||||
|
||||
loadRegattaStructureIfNeeded();
|
||||
}
|
||||
@@ -130,12 +133,7 @@ public class EventActivityProxy extends AbstractActivityProxy {
|
||||
|
||||
private AbstractEventPlace getRealPlace() {
|
||||
EventViewDTO event = ctx.getEventDTO();
|
||||
if(event.getType() == EventType.SERIES_EVENT) {
|
||||
// TODO Overview isn't implemented yet
|
||||
// return new RegattaOverviewPlace(new EventContext(ctx.getEventDTO()));
|
||||
return new RegattaRacesPlace(new EventContext(ctx).withRegattaId(null));
|
||||
}
|
||||
if(event.getType() == EventType.SINGLE_REGATTA) {
|
||||
if(event.getType() == EventType.SERIES_EVENT || event.getType() == EventType.SINGLE_REGATTA) {
|
||||
// TODO Overview isn't implemented yet
|
||||
// return new RegattaOverviewPlace(new EventContext(ctx.getEventDTO()));
|
||||
return new RegattaRacesPlace(new EventContext(ctx).withRegattaId(null));
|
||||
@@ -144,4 +142,28 @@ public class EventActivityProxy extends AbstractActivityProxy {
|
||||
// return new MultiregattaOverviewPlace(place.getCtx());
|
||||
return new MultiregattaRegattasPlace(place.getCtx());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the place is valid for the given event.
|
||||
* If not, the place is automatically being adjusted.
|
||||
*/
|
||||
private AbstractEventPlace verifyAndAdjustPlace() {
|
||||
if(place instanceof AbstractMultiregattaEventPlace && ctx.getEventDTO().getType() != EventType.MULTI_REGATTA) {
|
||||
EventContext ctxToUse = new EventContext(ctx).withRegattaId(null);
|
||||
if(place instanceof MultiregattaRegattasPlace) {
|
||||
return new RegattaRacesPlace(ctxToUse);
|
||||
}
|
||||
if(place instanceof MultiregattaMediaPlace) {
|
||||
return new RegattaMediaPlace(ctxToUse);
|
||||
}
|
||||
// TODO Overview isn't implemented yet
|
||||
// return new RegattaOverviewPlace(ctxToUse);
|
||||
return new RegattaRacesPlace(ctxToUse);
|
||||
}
|
||||
if(place instanceof RegattaMediaPlace && ctx.getEventDTO().getType() == EventType.MULTI_REGATTA) {
|
||||
return new MultiregattaMediaPlace(new EventContext(ctx).withRegattaId(null));
|
||||
}
|
||||
// no adjustment necessary
|
||||
return place;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user