implemented SailingServerImpl remove reference handling; MigrateLeaderboardgroupResource not yet updated to use them

This commit is contained in:
Axel Uhl
2021-09-21 17:26:49 +02:00
parent b6e147f4fb
commit fe5f03631a
6 changed files with 231 additions and 28 deletions
@@ -9,4 +9,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: com.sap.sailing.server.gateway.interfaces
Import-Package: com.sap.sailing.domain.common,
com.sap.sse.common
Require-Bundle: org.json.simple
Require-Bundle: org.json.simple,
com.sap.sailing.domain,
com.sap.sse.shared.android,
org.apache.httpcomponents.httpclient
@@ -1,11 +1,17 @@
package com.sap.sailing.server.gateway.interfaces;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import org.apache.http.client.ClientProtocolException;
import org.json.simple.parser.ParseException;
import com.sap.sailing.domain.base.RemoteSailingServerReference;
import com.sap.sailing.domain.common.DataImportProgress;
import com.sap.sse.shared.json.JsonDeserializationException;
/**
* Represents a remote instance of a server process running the Sailing Analytics and exposes various methods as a
@@ -47,9 +53,55 @@ public interface SailingServer {
*/
CompareServersResult compareServers(Optional<SailingServer> a, SailingServer b, Optional<Iterable<UUID>> leaderboardGroupIds) throws Exception;
void addRemoteServerReference(SailingServer referencedServer, Optional<Set<UUID>> eventIds) throws Exception;
Iterable<RemoteSailingServerReference> getRemoteServerReferences() throws JsonDeserializationException,
MalformedURLException, ClientProtocolException, IOException, ParseException;
void removeRemoteServerReference(SailingServer referencedServer, Optional<Set<UUID>> eventIds) throws Exception;
/**
* Adds a remote sailing server reference to this server. If {@code includeSpecifiedEvents} is {@code true}, events
* must explicitly be specified in later calls to make the reference take effect. If {@code false}, all events on the
* remote server will be included by default, and event IDs can later be specified for individual exclusion.<p>
*
* Should a remote sailing server reference already exist to the {@code referencedServer} specified, no change is
* performed, even if the existing remote server reference has an "include/exclude" specification that deviates
* from {@code includeSpecifiedEvents}.
*
* @return the reference added or the existing reference found
*/
RemoteSailingServerReference addRemoteServerReference(SailingServer referencedServer,
boolean includeSpecifiedEvents)
throws JsonDeserializationException, ClientProtocolException, IOException, ParseException;
/**
* @return the reference removed, or {@code null} if no such reference was found
*/
RemoteSailingServerReference removeRemoteServerReference(SailingServer referencedServer) throws JsonDeserializationException, ClientProtocolException, IOException, ParseException;
/**
* Ensures that a remote sailing server reference to {@code referencedServer} exists and includes the events
* with the IDs specified in {@code eventIds}. If no remote sailing server reference to that server exists yet,
* a new one is created and configured to explicitly include only the events with the IDs from {@code eventIds}.<p>
*
* If a reference to {@code referencedServer} already exists, this method will ensure that the events with the IDs provided
* by {@code eventIds} are part of the exposed events, either if the reference is "inclusive" by ensuring those IDs are
* part of the event ID list, or if "exclusive" by ensuring they are <em>not</em> part of the event ID list excluded.
*
* @return the resulting remote sailing server reference
*/
RemoteSailingServerReference addRemoteServerEventReferences(SailingServer referencedServer, Iterable<UUID> eventIds) throws Exception;
/**
* Ensures that <em>no</em> remote sailing server reference to {@code referencedServer} exists that includes the
* events with the IDs specified in {@code eventIds}. If a remote sailing server reference to that server exists,
* this method will ensure that the events with the IDs provided by {@code eventIds} are not part of the exposed
* events, either if the reference is "inclusive" by ensuring those IDs are not part of the event ID list, or if
* "exclusive" by ensuring they <em>are</em> part of the event ID list excluded. If the event IDs are removed from
* an existing "inclusive" reference and this makes the reference expose no events anymore at all, the reference is
* removed.
*
* @return the resulting remote sailing server reference, or {@code null} if the remote sailing server reference was
* removed as a result of calling this method
*/
RemoteSailingServerReference removeRemoteServerEventReferences(SailingServer referencedServer, Iterable<UUID> eventIds) throws Exception;
String getBearerToken();
}