mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-05 03:43:52 +00:00
Caching eventslist
This commit is contained in:
1 parent
a125116086
commit
975bf08479
9 files changed
+53
-16
No files matched your search
+2
-1
@@ -7,6 +7,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.sap.sailing.gwt.home.shared.partials.placeholder.Placeholder;
|
||||
import com.sap.sailing.gwt.home.shared.places.events.EventsPlace;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.GetEventListViewAction;
|
||||
import com.sap.sailing.gwt.ui.shared.eventlist.EventListViewDTO;
|
||||
import com.sap.sse.gwt.client.mvp.ErrorView;
|
||||
|
||||
@@ -24,7 +25,7 @@ public class EventsActivity extends AbstractActivity {
|
||||
public void start(final AcceptsOneWidget panel, EventBus eventBus) {
|
||||
panel.setWidget(new Placeholder());
|
||||
|
||||
clientFactory.getHomeService().getEventListView(new AsyncCallback<EventListViewDTO>() {
|
||||
clientFactory.getDispatch().execute(new GetEventListViewAction(), new AsyncCallback<EventListViewDTO>() {
|
||||
@Override
|
||||
public void onSuccess(EventListViewDTO eventListView) {
|
||||
final EventsView eventsView = clientFactory.createEventsView();
|
||||
|
||||
+3
-1
@@ -14,6 +14,7 @@ import com.sap.sailing.gwt.home.mobile.app.MobilePlacesNavigator;
|
||||
import com.sap.sailing.gwt.home.mobile.places.events.EventsView.Presenter;
|
||||
import com.sap.sailing.gwt.home.shared.partials.placeholder.Placeholder;
|
||||
import com.sap.sailing.gwt.home.shared.places.events.EventsPlace;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.GetEventListViewAction;
|
||||
import com.sap.sailing.gwt.ui.shared.eventlist.EventListViewDTO;
|
||||
|
||||
public class EventsActivity extends AbstractActivity implements Presenter {
|
||||
@@ -31,7 +32,8 @@ public class EventsActivity extends AbstractActivity implements Presenter {
|
||||
panel.setWidget(new Placeholder());
|
||||
Window.setTitle(TextMessages.INSTANCE.events());
|
||||
final EventsView view = new EventsViewImpl(this);
|
||||
clientFactory.getHomeService().getEventListView(new AsyncCallback<EventListViewDTO>() {
|
||||
|
||||
clientFactory.getDispatch().execute(new GetEventListViewAction(), new AsyncCallback<EventListViewDTO>() {
|
||||
@Override
|
||||
public void onSuccess(EventListViewDTO eventListView) {
|
||||
panel.setWidget(view.asWidget());
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import com.sap.sse.common.Duration;
|
||||
public final class CachingDispatch implements DispatchAsync {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(CachingDispatch.class.getName());
|
||||
private final int DEFAULT_TIME_TO_LIVE_MILLIS = (int) Duration.ONE_SECOND.asMillis() * 30;
|
||||
private final int DEFAULT_TIME_TO_LIVE_MILLIS = (int) Duration.ONE_MINUTE.times(3).asMillis();
|
||||
private final CacheCleanupTask invalidationTask = new CacheCleanupTask();
|
||||
private final HashMap<String, ResultHolder> resultsCache = new HashMap<>();
|
||||
private final DispatchAsync dispatch;
|
||||
|
||||
+6
-7
@@ -19,7 +19,6 @@ import com.sap.sailing.domain.leaderboard.LeaderboardGroup;
|
||||
import com.sap.sailing.gwt.ui.client.HomeService;
|
||||
import com.sap.sailing.gwt.ui.server.Activator;
|
||||
import com.sap.sailing.gwt.ui.server.ProxiedRemoteServiceServlet;
|
||||
import com.sap.sailing.gwt.ui.shared.eventlist.EventListViewDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.fakeseries.EventSeriesViewDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.fakeseries.EventSeriesViewDTO.EventSeriesState;
|
||||
import com.sap.sailing.gwt.ui.shared.general.EventMetadataDTO;
|
||||
@@ -255,10 +254,10 @@ public class HomeServiceImpl extends ProxiedRemoteServiceServlet implements Home
|
||||
return getMediaForEvent(seriesId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventListViewDTO getEventListView() throws MalformedURLException {
|
||||
EventListDataCalculator eventListDataCalculator = new EventListDataCalculator(getService());
|
||||
HomeServiceUtil.forAllPublicEvents(getService(), getThreadLocalRequest(), eventListDataCalculator);
|
||||
return eventListDataCalculator.getResult();
|
||||
}
|
||||
// @Override
|
||||
// public EventListViewDTO getEventListView() throws MalformedURLException {
|
||||
// EventListDataCalculator eventListDataCalculator = new EventListDataCalculator(getService());
|
||||
// HomeServiceUtil.forAllPublicEvents(getService(), getThreadLocalRequest(), eventListDataCalculator);
|
||||
// return eventListDataCalculator.getResult();
|
||||
// }
|
||||
}
|
||||
+1
-2
@@ -3,7 +3,6 @@ package com.sap.sailing.gwt.ui.client;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
import com.sap.sailing.gwt.ui.shared.eventlist.EventListViewDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.fakeseries.EventSeriesViewDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.media.MediaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.start.StartViewDTO;
|
||||
@@ -15,7 +14,7 @@ public interface HomeService extends RemoteService {
|
||||
|
||||
MediaDTO getMediaForEventSeries(UUID seriesId);
|
||||
|
||||
EventListViewDTO getEventListView() throws Exception;
|
||||
// EventListViewDTO getEventListView() throws Exception;
|
||||
|
||||
StartViewDTO getStartView() throws Exception;
|
||||
}
|
||||
+1
-2
@@ -3,7 +3,6 @@ package com.sap.sailing.gwt.ui.client;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.gwt.ui.shared.eventlist.EventListViewDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.fakeseries.EventSeriesViewDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.media.MediaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.start.StartViewDTO;
|
||||
@@ -19,7 +18,7 @@ public interface HomeServiceAsync {
|
||||
|
||||
void getMediaForEventSeries(UUID seriesId, AsyncCallback<MediaDTO> callback);
|
||||
|
||||
void getEventListView(AsyncCallback<EventListViewDTO> callback);
|
||||
// void getEventListView(AsyncCallback<EventListViewDTO> callback);
|
||||
|
||||
void getStartView(AsyncCallback<StartViewDTO> callback);
|
||||
}
|
||||
+3
@@ -1,5 +1,6 @@
|
||||
package com.sap.sailing.gwt.ui.client;
|
||||
|
||||
import com.sap.sailing.gwt.home.shared.dispatch.DispatchSystem;
|
||||
import com.sap.sse.gwt.client.mvp.ClientFactory;
|
||||
import com.sap.sse.gwt.client.mvp.ErrorView;
|
||||
import com.sap.sse.security.ui.client.UserManagementServiceAsync;
|
||||
@@ -23,4 +24,6 @@ public interface SailingClientFactory extends ClientFactory {
|
||||
UserService getUserService();
|
||||
|
||||
ErrorView createErrorView(String errorMessage, Throwable errorReason);
|
||||
|
||||
DispatchSystem getDispatch();
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.sap.sailing.gwt.ui.shared.dispatch.event;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import com.google.gwt.core.shared.GwtIncompatible;
|
||||
import com.sap.sailing.gwt.home.shared.dispatch.IsClientCacheable;
|
||||
import com.sap.sailing.gwt.server.EventListDataCalculator;
|
||||
import com.sap.sailing.gwt.server.HomeServiceUtil;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.Action;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.DispatchContext;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.DispatchException;
|
||||
import com.sap.sailing.gwt.ui.shared.eventlist.EventListViewDTO;
|
||||
|
||||
public class GetEventListViewAction implements Action<EventListViewDTO>, IsClientCacheable {
|
||||
@Override
|
||||
@GwtIncompatible
|
||||
public EventListViewDTO execute(DispatchContext context) {
|
||||
try {
|
||||
EventListDataCalculator eventListDataCalculator = new EventListDataCalculator(
|
||||
context.getRacingEventService());
|
||||
HomeServiceUtil.forAllPublicEvents(context.getRacingEventService(), context.getRequest(),
|
||||
eventListDataCalculator);
|
||||
return eventListDataCalculator.getResult();
|
||||
|
||||
} catch (MalformedURLException e) {
|
||||
throw new DispatchException("Could not load event list");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cacheInstanceKey(StringBuilder key) {
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -2,10 +2,11 @@ package com.sap.sailing.gwt.ui.shared.eventlist;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.DTO;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.Result;
|
||||
import com.sap.sailing.gwt.ui.shared.general.EventState;
|
||||
|
||||
public class EventListViewDTO implements IsSerializable {
|
||||
public class EventListViewDTO implements DTO, Result {
|
||||
|
||||
private ArrayList<EventListEventDTO> upcomingEvents = new ArrayList<>();
|
||||
private ArrayList<EventListYearDTO> recentEvents = new ArrayList<>();
|
||||
|
||||
Reference in new issue
Block a user