mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-09 13:50:57 +00:00
further refactoring (AbstractLog): pass and involved competitors -> RaceLog, generalize RevokeEvent
This commit is contained in:
1 parent
82c788b66b
commit
d53e21ff0d
160 files changed
+1105
-930
No files matched your search
@@ -9,6 +9,7 @@ Require-Bundle: com.sap.sailing.domain.common;bundle-version="1.0.0",
|
||||
com.sap.sse.datamining.shared;bundle-version="1.0.0",
|
||||
com.sap.sse.common
|
||||
Export-Package: com.sap.sailing.domain.abstractlog,
|
||||
com.sap.sailing.domain.abstractlog.impl,
|
||||
com.sap.sailing.domain.abstractlog.race,
|
||||
com.sap.sailing.domain.abstractlog.race.analyzing.impl,
|
||||
com.sap.sailing.domain.abstractlog.race.impl,
|
||||
@@ -17,6 +18,8 @@ Export-Package: com.sap.sailing.domain.abstractlog,
|
||||
com.sap.sailing.domain.abstractlog.race.state,
|
||||
com.sap.sailing.domain.abstractlog.race.state.impl,
|
||||
com.sap.sailing.domain.abstractlog.race.state.racingprocedure,
|
||||
com.sap.sailing.domain.abstractlog.race.state.racingprocedure.basic,
|
||||
com.sap.sailing.domain.abstractlog.race.state.racingprocedure.basic.impl,
|
||||
com.sap.sailing.domain.abstractlog.race.state.racingprocedure.ess,
|
||||
com.sap.sailing.domain.abstractlog.race.state.racingprocedure.ess.impl,
|
||||
com.sap.sailing.domain.abstractlog.race.state.racingprocedure.gate,
|
||||
@@ -28,6 +31,8 @@ Export-Package: com.sap.sailing.domain.abstractlog,
|
||||
com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl,
|
||||
com.sap.sailing.domain.abstractlog.race.tracking.events,
|
||||
com.sap.sailing.domain.abstractlog.race.tracking.impl,
|
||||
com.sap.sailing.domain.abstractlog.regatta,
|
||||
com.sap.sailing.domain.abstractlog.regatta.impl,
|
||||
com.sap.sailing.domain.base,
|
||||
com.sap.sailing.domain.base.configuration,
|
||||
com.sap.sailing.domain.base.configuration.impl,
|
||||
|
||||
+43
-41
@@ -5,10 +5,9 @@ import java.util.HashSet;
|
||||
import java.util.NavigableSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.WithID;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.NotRevokableException;
|
||||
import com.sap.sailing.domain.tracking.Track;
|
||||
|
||||
/**
|
||||
@@ -16,114 +15,117 @@ import com.sap.sailing.domain.tracking.Track;
|
||||
*
|
||||
* <p>
|
||||
* Keeps track of the {@link AbstractLogEvent}'s pass and returns only the events of the current pass on
|
||||
* {@link RaceLog#getFixes()}. Use {@link RaceLog#getRawFixes()} to receive all events in a {@link RaceLog}.
|
||||
* {@link #getFixes()}. Use {@link #getRawFixes()} to receive all events in a {@link AbstractLog}.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Implementations should use the {@link AbstractLogEventComparator} for sorting its content.
|
||||
* </p>
|
||||
* The visitor pattern presents a problem in combination with the generic event type: such events
|
||||
* that
|
||||
*
|
||||
* @param <VisitorT> Event visitor type - must be able to visit all events of type {@link EventT}
|
||||
* @param <EventT> Event type
|
||||
*/
|
||||
public interface AbstractLog<T extends AbstractLogEvent> extends Track<T>, WithID {
|
||||
|
||||
public static final int DefaultPassId = 0;
|
||||
|
||||
/**
|
||||
* Gets the current pass id.
|
||||
*
|
||||
* @return the pass id.
|
||||
*/
|
||||
int getCurrentPassId();
|
||||
public interface AbstractLog<EventT extends AbstractLogEvent<VisitorT>, VisitorT>
|
||||
extends Track<EventT>, WithID {
|
||||
|
||||
/**
|
||||
* Adds a {@link AbstractLogEvent} to the {@link RaceLog}.
|
||||
* Adds a {@link AbstractLogEvent} to the AbstractLog.
|
||||
*
|
||||
* @param event
|
||||
* {@link AbstractLogEvent} to be added.
|
||||
* @return <code>true</code> if the element was added, <code>false</code> otherwise.
|
||||
*/
|
||||
boolean add(T event);
|
||||
boolean add(EventT event);
|
||||
|
||||
/**
|
||||
* Add a {@link RaceLogEventVisitor} as a listener for additions.
|
||||
* Add a {@link VisitorT} as a listener for additions.
|
||||
*/
|
||||
void addListener(RaceLogEventVisitor listener);
|
||||
void addListener(VisitorT listener);
|
||||
|
||||
/**
|
||||
* Remove a listener.
|
||||
*/
|
||||
void removeListener(RaceLogEventVisitor listener);
|
||||
void removeListener(VisitorT listener);
|
||||
|
||||
/**
|
||||
* Removes all listeners
|
||||
* @return
|
||||
*/
|
||||
HashSet<RaceLogEventVisitor> removeAllListeners();
|
||||
HashSet<VisitorT> removeAllListeners();
|
||||
|
||||
/**
|
||||
* Checks if the race log is empty.
|
||||
* Checks if the log is empty.
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
Iterable<T> getRawFixesDescending();
|
||||
Iterable<EventT> getRawFixesDescending();
|
||||
|
||||
Iterable<T> getFixesDescending();
|
||||
Iterable<EventT> getFixesDescending();
|
||||
|
||||
void addAllListeners(HashSet<RaceLogEventVisitor> listeners);
|
||||
void addAllListeners(HashSet<VisitorT> listeners);
|
||||
|
||||
Iterable<RaceLogEventVisitor> getAllListeners();
|
||||
Iterable<VisitorT> getAllListeners();
|
||||
|
||||
/**
|
||||
* Adds an event to this race log and returns {@link RaceLog#getEventsToDeliver(UUID)}
|
||||
* Adds an event to this log and returns {@link #getEventsToDeliver(UUID)}
|
||||
* (excluding the new <code>event</code>)
|
||||
*/
|
||||
Iterable<T> add(T event, UUID clientId);
|
||||
Iterable<EventT> add(EventT event, UUID clientId);
|
||||
|
||||
/**
|
||||
* Returns a superset of all race log events that were added to this race log but not yet returned to
|
||||
* Returns a superset of all log events that were added to this log but not yet returned to
|
||||
* the client with ID <code>clientId</code> by this method. In general, the list returned is not a true
|
||||
* superset but equals exactly those events not yet delivered to the client. However, if the server
|
||||
* was re-started since the client last called this method, and since the underlying data structures
|
||||
* are not durably stored, the entire set of all race log events would be delivered to the client once.
|
||||
* are not durably stored, the entire set of all log events would be delivered to the client once.
|
||||
*/
|
||||
Iterable<T> getEventsToDeliver(UUID clientId);
|
||||
Iterable<EventT> getEventsToDeliver(UUID clientId);
|
||||
|
||||
/**
|
||||
* Returns all {@link #getRawFixes() raw fixes} and marks them as delivered to the client identified by <code>clientId</code>
|
||||
* so that when that ID appears in a subsequent call to {@link #add(AbstractLogEvent, UUID)}, the fixes returned by this call
|
||||
* are already considered delivered to the client identified by <code>clientId</code>.
|
||||
*/
|
||||
Iterable<T> getRawFixes(UUID clientId);
|
||||
Iterable<EventT> getRawFixes(UUID clientId);
|
||||
|
||||
/**
|
||||
* Like {@link #add(AbstractLogEvent)}, only that no events are triggered. Use this method only when loading a race log,
|
||||
* Like {@link #add(AbstractLogEvent)}, only that no events are triggered. Use this method only when loading a log,
|
||||
* e.g., from a replication or master data import or when loading from the database.
|
||||
*
|
||||
* @return <code>true</code> if the event was actually added which is the case if there was no equal event contained
|
||||
* in this race log yet
|
||||
* in this log yet
|
||||
*/
|
||||
boolean load(T event);
|
||||
boolean load(EventT event);
|
||||
|
||||
/**
|
||||
* Search for the event by its {@link AbstractLogEvent#getId() id}.
|
||||
* Caller needs to hold the read lock.
|
||||
*/
|
||||
T getEventById(Serializable id);
|
||||
EventT getEventById(Serializable id);
|
||||
|
||||
/**
|
||||
* Get a {@link NavigableSet} of unrevoked events regardless of the {@code pass}. Events are sorted by
|
||||
* their {@link TimePoint} and the oldest is returned first.
|
||||
* @return
|
||||
*/
|
||||
NavigableSet<T> getUnrevokedEvents();
|
||||
NavigableSet<EventT> getUnrevokedEvents();
|
||||
|
||||
/**
|
||||
* Get a {@link NavigableSet} of unrevoked events regardless of the {@code pass}.
|
||||
* @return
|
||||
*/
|
||||
NavigableSet<T> getUnrevokedEventsDescending();
|
||||
NavigableSet<EventT> getUnrevokedEventsDescending();
|
||||
|
||||
/**
|
||||
* Merges all events from the <code>other</code> race log into this.
|
||||
* Merges all events from the <code>other</code> log into this.
|
||||
*/
|
||||
void merge(AbstractLog<T> other);
|
||||
void merge(AbstractLog<EventT, VisitorT> other);
|
||||
|
||||
/**
|
||||
* Inserts a {@link RevokeEvent} for {@code toRevoke}, if latter is revokable, exists in the racelog
|
||||
* and has not yet been revoked.
|
||||
*
|
||||
* @param author The author for the {@code RevokeEvent}.
|
||||
*/
|
||||
void revokeEvent(AbstractLogEventAuthor author, EventT toRevoke, String reason) throws NotRevokableException;
|
||||
void revokeEvent(AbstractLogEventAuthor author, EventT toRevoke) throws NotRevokableException;
|
||||
}
|
||||
+7
-30
@@ -1,19 +1,14 @@
|
||||
package com.sap.sailing.domain.abstractlog;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Timed;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.WithID;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* A {@link AbstractLogEvent} is an entry in a race's log (typically a {@link RaceLog}).
|
||||
* A {@link AbstractLogEvent} is an entry in an AbstractLog.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
@@ -47,13 +42,13 @@ import com.sap.sailing.domain.common.WithID;
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Race log events have an author that has a name and a priority assigned. This can be used to represent multiple
|
||||
* concurrent race log authors such as a device used on a starting vessel, another device used at the finish line and
|
||||
* AbstractLog events have an author that has a name and a priority assigned. This can be used to represent multiple
|
||||
* concurrent authors such as a device used on a starting vessel, another device used at the finish line and
|
||||
* yet another device used on shore. In case more than one device make a statement about something, such as the start
|
||||
* time or the start procedure, the statement from the device with the highest priority needs to take precedence.
|
||||
* </p>
|
||||
*/
|
||||
public interface AbstractLogEvent extends Timed, WithID, Serializable {
|
||||
public interface AbstractLogEvent<VisitorT> extends Timed, WithID, Serializable {
|
||||
|
||||
/**
|
||||
* Gets the {@link TimePoint} this event was created at.
|
||||
@@ -67,33 +62,15 @@ public interface AbstractLogEvent extends Timed, WithID, Serializable {
|
||||
*/
|
||||
TimePoint getLogicalTimePoint();
|
||||
|
||||
/**
|
||||
* Gets the event's pass identifier.
|
||||
*
|
||||
* Each {@link AbstractLogEvent} is associated to a certain pass. A pass is every attempt to start and run a race. A
|
||||
* new pass is initiated when a new start time is proposed (e.g. after the race was aborted). There might be certain
|
||||
* event type that are not strictly bound to its pass.
|
||||
*
|
||||
*/
|
||||
int getPassId();
|
||||
|
||||
/**
|
||||
* Gets the list of associated {@link Competitor}s.
|
||||
*
|
||||
* A {@link AbstractLogEvent} might be associated with a list of competitors, which are somehow relevant for this
|
||||
* kind of event. An example is a list of competitors who are marked for an individual recall.
|
||||
*/
|
||||
List<Competitor> getInvolvedBoats();
|
||||
|
||||
/**
|
||||
* Visitor pattern to implement certain {@link AbstractLogEvent} subclass specific behavior.
|
||||
*/
|
||||
void accept(RaceLogEventVisitor visitor);
|
||||
void accept(VisitorT visitor);
|
||||
|
||||
/**
|
||||
* Gets the {@link RaceLogEventAuthor} author of this event.
|
||||
* Gets the {@link AbstractLogEventAuthor} author of this event.
|
||||
*/
|
||||
RaceLogEventAuthor getAuthor();
|
||||
AbstractLogEventAuthor getAuthor();
|
||||
|
||||
/**
|
||||
* Gets a short info about the most relevant data of the event.
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
package com.sap.sailing.domain.abstractlog;
|
||||
|
||||
import com.sap.sse.common.Named;
|
||||
|
||||
/**
|
||||
* Multiple devices may concurrently post to a single {@link RaceLog}. In this case it is important to understand
|
||||
* Multiple devices may concurrently post to a single {@link AbstractLog}. In this case it is important to understand
|
||||
* who posted what. The "who" is described by instances of this class. In particular, an author has a name and a
|
||||
* priority which is then used to arbitrate between different posts on the same subject, such as a race's start time
|
||||
* or transitions from one race phase to another.
|
||||
@@ -11,7 +11,7 @@ import com.sap.sse.common.Named;
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public interface RaceLogEventAuthor extends Named, Comparable<RaceLogEventAuthor> {
|
||||
public interface AbstractLogEventAuthor extends Named, Comparable<AbstractLogEventAuthor> {
|
||||
|
||||
public static final int PRIORITY_COMPATIBILITY = 16;
|
||||
public static final String NAME_COMPATIBILITY = "Compatibility";
|
||||
+4
-1
@@ -1,4 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
package com.sap.sailing.domain.abstractlog;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
|
||||
|
||||
/**
|
||||
+4
-2
@@ -1,7 +1,9 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
package com.sap.sailing.domain.abstractlog;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
|
||||
/**
|
||||
* Revokes the event referenced by {@link #getRevokedEventId()}.
|
||||
* A {@link RevokeEvent} cannot itself be revoked. Instead, e.g. the original event should be resubmitted.
|
||||
@@ -9,7 +11,7 @@ import java.io.Serializable;
|
||||
* @see Revokable
|
||||
*
|
||||
*/
|
||||
public interface RevokeEvent extends RaceLogEvent {
|
||||
public interface RevokeEvent<VisitorT> extends AbstractLogEvent<VisitorT> {
|
||||
Serializable getRevokedEventId();
|
||||
|
||||
/**
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.sap.sailing.domain.abstractlog.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.base.Timed;
|
||||
import com.sap.sailing.domain.tracking.impl.TimedComparator;
|
||||
|
||||
/**
|
||||
* Comparator sorting by pass, then by {@link AbstractLogEventAuthor}, then by {@link RaceLogEvent#getCreatedAt()}
|
||||
* timestamp.
|
||||
*
|
||||
* If one of the passed objects is not a {@link RaceLogEvent}, sorting is done by {@link Timed#getTimePoint()}.
|
||||
*/
|
||||
public class AbstractLogEventComparator implements Comparator<Timed>, Serializable {
|
||||
private static final long serialVersionUID = -1337219742246147546L;
|
||||
private Comparator<Timed> timedComparator;
|
||||
|
||||
public AbstractLogEventComparator() {
|
||||
this.timedComparator = TimedComparator.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(Timed o1, Timed o2) {
|
||||
if (o1 instanceof RaceLogEvent && o2 instanceof RaceLogEvent) {
|
||||
return compareEvents((RaceLogEvent) o1, (RaceLogEvent) o2);
|
||||
}
|
||||
|
||||
// fallback to timed comparison
|
||||
return timedComparator.compare(o1, o2);
|
||||
}
|
||||
|
||||
protected int compareEvents(RaceLogEvent e1, RaceLogEvent e2) {
|
||||
//compare author priorities
|
||||
int result = e1.getAuthor().compareTo(e2.getAuthor());
|
||||
if (result != 0) return result;
|
||||
|
||||
//compare created at timepoints
|
||||
result = e1.getCreatedAt().compareTo(e2.getCreatedAt());
|
||||
if (result != 0) return result;
|
||||
|
||||
//compare logical timepoints
|
||||
result = e1.getLogicalTimePoint().compareTo(e2.getLogicalTimePoint());
|
||||
if (result != 0) return result;
|
||||
|
||||
//compare ids
|
||||
return e1.getId().toString().compareTo(e2.getId().toString());
|
||||
}
|
||||
}
|
||||
+7
-24
@@ -1,32 +1,26 @@
|
||||
package com.sap.sailing.domain.abstractlog.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
|
||||
public abstract class AbstractLogEventImpl implements AbstractLogEvent {
|
||||
public abstract class AbstractLogEventImpl<VisitorT> implements AbstractLogEvent<VisitorT> {
|
||||
|
||||
private static final long serialVersionUID = -5810258278984777732L;
|
||||
|
||||
private final TimePoint createdAt;
|
||||
private final TimePoint logicalTimePoint;
|
||||
private final Serializable id;
|
||||
private final List<Competitor> involvedBoats;
|
||||
private final int passId;
|
||||
private final RaceLogEventAuthor author;
|
||||
private final AbstractLogEventAuthor author;
|
||||
|
||||
public AbstractLogEventImpl(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, List<Competitor> pInvolvedBoats, int pPassId) {
|
||||
public AbstractLogEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId) {
|
||||
this.createdAt = createdAt;
|
||||
this.author = author;
|
||||
this.logicalTimePoint = logicalTimePoint;
|
||||
this.id = pId;
|
||||
this.involvedBoats = pInvolvedBoats;
|
||||
this.passId = pPassId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,27 +45,16 @@ public abstract class AbstractLogEventImpl implements AbstractLogEvent {
|
||||
public Serializable getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Competitor> getInvolvedBoats() {
|
||||
return involvedBoats;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPassId() {
|
||||
return passId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogEventAuthor getAuthor() {
|
||||
public AbstractLogEventAuthor getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + ": createdAt: " + getCreatedAt() + ", logicalTimePoint: " + getLogicalTimePoint()
|
||||
+ ", id: " + getId() + ", involvedBoats: " + getInvolvedBoats() + ", passId: " + getPassId() +
|
||||
", author: "+ getAuthor();
|
||||
+ ", id: " + getId() + ", author: "+ getAuthor();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+79
-92
@@ -3,6 +3,7 @@ package com.sap.sailing.domain.abstractlog.impl;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@@ -16,10 +17,10 @@ import java.util.logging.Logger;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLog;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.RevokeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.RevokeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventComparator;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogImpl;
|
||||
import com.sap.sailing.domain.base.Timed;
|
||||
@@ -43,7 +44,8 @@ import com.sap.sailing.util.impl.ArrayListNavigableSet;
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public class AbstractLogImpl<T extends AbstractLogEvent> extends TrackImpl<T> implements AbstractLog<T> {
|
||||
public abstract class AbstractLogImpl<EventT extends AbstractLogEvent<VisitorT>, VisitorT>
|
||||
extends TrackImpl<EventT> implements AbstractLog<EventT, VisitorT> {
|
||||
private static final long serialVersionUID = -176745401321893502L;
|
||||
private static final String DefaultLockName = AbstractLogImpl.class.getName() + ".lock";
|
||||
private final static Logger logger = Logger.getLogger(AbstractLogImpl.class.getName());
|
||||
@@ -52,19 +54,18 @@ public class AbstractLogImpl<T extends AbstractLogEvent> extends TrackImpl<T> im
|
||||
/**
|
||||
* Clients can use the {@link #add(RaceLogEvent, UUID)} method
|
||||
*/
|
||||
private transient Map<UUID, Set<T>> eventsDeliveredToClient = new HashMap<UUID, Set<T>>();
|
||||
private transient Map<UUID, Set<EventT>> eventsDeliveredToClient = new HashMap<UUID, Set<EventT>>();
|
||||
|
||||
private Map<Serializable, T> eventsById = new HashMap<Serializable, T>();
|
||||
private Map<Serializable, EventT> eventsById = new HashMap<Serializable, EventT>();
|
||||
|
||||
private final Serializable id;
|
||||
private transient Set<RaceLogEventVisitor> listeners;
|
||||
private int currentPassId;
|
||||
private transient Set<VisitorT> listeners;
|
||||
|
||||
/**
|
||||
* Initializes a new {@link RaceLogImpl} with the default lock name.
|
||||
*/
|
||||
public AbstractLogImpl(Serializable identifier) {
|
||||
this(DefaultLockName, identifier);
|
||||
public AbstractLogImpl(Serializable identifier, Comparator<Timed> comparator) {
|
||||
this(DefaultLockName, identifier, comparator);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,11 +74,10 @@ public class AbstractLogImpl<T extends AbstractLogEvent> extends TrackImpl<T> im
|
||||
* @param nameForReadWriteLock
|
||||
* name of lock.
|
||||
*/
|
||||
public AbstractLogImpl(String nameForReadWriteLock, Serializable identifier) {
|
||||
super(new ArrayListNavigableSet<Timed>(RaceLogEventComparator.INSTANCE), nameForReadWriteLock);
|
||||
public AbstractLogImpl(String nameForReadWriteLock, Serializable identifier, Comparator<Timed> comparator) {
|
||||
super(new ArrayListNavigableSet<Timed>(comparator), nameForReadWriteLock);
|
||||
|
||||
this.listeners = new HashSet<RaceLogEventVisitor>();
|
||||
this.currentPassId = DefaultPassId;
|
||||
this.listeners = new HashSet<VisitorT>();
|
||||
this.id = identifier;
|
||||
}
|
||||
|
||||
@@ -85,27 +85,9 @@ public class AbstractLogImpl<T extends AbstractLogEvent> extends TrackImpl<T> im
|
||||
public Serializable getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentPassId() {
|
||||
return currentPassId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a new active pass id. Ignored if new and current are equal.
|
||||
*
|
||||
* @param newPassId
|
||||
* to be set.
|
||||
*/
|
||||
public void setCurrentPassId(int newPassId) {
|
||||
if (newPassId != this.currentPassId) {
|
||||
logger.finer(String.format("Changing pass id to %d", newPassId));
|
||||
this.currentPassId = newPassId;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(T event) {
|
||||
public boolean add(EventT event) {
|
||||
boolean isAdded = false;
|
||||
lockForWrite();
|
||||
try {
|
||||
@@ -117,7 +99,6 @@ public class AbstractLogImpl<T extends AbstractLogEvent> extends TrackImpl<T> im
|
||||
logger.finer(String.format("%s (%s) was added to log %s.", event, event.getClass().getName(), getId()));
|
||||
// FIXME with out-of-order delivery would destroy currentPassId; need to check at least the createdAt time
|
||||
// point
|
||||
setCurrentPassId(Math.max(event.getPassId(), this.currentPassId));
|
||||
revokeIfNecessary(event);
|
||||
eventsById.put(event.getId(), event);
|
||||
notifyListenersAboutReceive(event);
|
||||
@@ -128,7 +109,7 @@ public class AbstractLogImpl<T extends AbstractLogEvent> extends TrackImpl<T> im
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean load(T event) {
|
||||
public boolean load(EventT event) {
|
||||
boolean isAdded = false;
|
||||
lockForWrite();
|
||||
try {
|
||||
@@ -138,7 +119,6 @@ public class AbstractLogImpl<T extends AbstractLogEvent> extends TrackImpl<T> im
|
||||
}
|
||||
if (isAdded) {
|
||||
logger.finer(String.format("%s (%s) was loaded into log.", event, event.getClass().getName()));
|
||||
setCurrentPassId(Math.max(event.getPassId(), this.currentPassId));
|
||||
revokeIfNecessary(event);
|
||||
eventsById.put(event.getId(), event);
|
||||
} else {
|
||||
@@ -148,9 +128,9 @@ public class AbstractLogImpl<T extends AbstractLogEvent> extends TrackImpl<T> im
|
||||
return isAdded;
|
||||
}
|
||||
|
||||
private void revokeIfNecessary(T newEvent) {
|
||||
private void revokeIfNecessary(EventT newEvent) {
|
||||
if (newEvent instanceof RevokeEvent) {
|
||||
RevokeEvent revokeEvent = (RevokeEvent) newEvent;
|
||||
RevokeEvent<?> revokeEvent = (RevokeEvent<?>) newEvent;
|
||||
try {
|
||||
checkIfSuccessfullyRevokes(revokeEvent);
|
||||
lockForWrite();
|
||||
@@ -162,9 +142,9 @@ public class AbstractLogImpl<T extends AbstractLogEvent> extends TrackImpl<T> im
|
||||
}
|
||||
}
|
||||
|
||||
private void checkIfSuccessfullyRevokes(RevokeEvent revokeEvent) throws NotRevokableException {
|
||||
private void checkIfSuccessfullyRevokes(RevokeEvent<?> revokeEvent) throws NotRevokableException {
|
||||
lockForRead();
|
||||
T revokedEvent = getEventById(revokeEvent.getRevokedEventId());
|
||||
EventT revokedEvent = getEventById(revokeEvent.getRevokedEventId());
|
||||
unlockAfterRead();
|
||||
|
||||
if (revokedEvent == null) {
|
||||
@@ -186,30 +166,30 @@ public class AbstractLogImpl<T extends AbstractLogEvent> extends TrackImpl<T> im
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<T> add(T event, UUID clientId) {
|
||||
public Iterable<EventT> add(EventT event, UUID clientId) {
|
||||
add(event);
|
||||
return getEventsToDeliver(clientId, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<T> getEventsToDeliver(UUID clientId) {
|
||||
public Iterable<EventT> getEventsToDeliver(UUID clientId) {
|
||||
return getEventsToDeliver(clientId, null);
|
||||
}
|
||||
|
||||
protected Iterable<T> getEventsToDeliver(UUID clientId, T suppressedEvent) {
|
||||
final LinkedHashSet<T> stillToDeliverToClient;
|
||||
protected Iterable<EventT> getEventsToDeliver(UUID clientId, EventT suppressedEvent) {
|
||||
final LinkedHashSet<EventT> stillToDeliverToClient;
|
||||
lockForRead();
|
||||
try {
|
||||
stillToDeliverToClient = new LinkedHashSet<T>(getInternalRawFixes());
|
||||
stillToDeliverToClient = new LinkedHashSet<EventT>(getInternalRawFixes());
|
||||
} finally {
|
||||
unlockAfterRead();
|
||||
}
|
||||
stillToDeliverToClient.remove(suppressedEvent);
|
||||
Set<T> deliveredToClient = eventsDeliveredToClient.get(clientId);
|
||||
Set<EventT> deliveredToClient = eventsDeliveredToClient.get(clientId);
|
||||
if (deliveredToClient != null) {
|
||||
stillToDeliverToClient.removeAll(deliveredToClient);
|
||||
} else {
|
||||
deliveredToClient = new HashSet<T>();
|
||||
deliveredToClient = new HashSet<EventT>();
|
||||
eventsDeliveredToClient.put(clientId, deliveredToClient);
|
||||
}
|
||||
deliveredToClient.addAll(stillToDeliverToClient);
|
||||
@@ -217,12 +197,12 @@ public class AbstractLogImpl<T extends AbstractLogEvent> extends TrackImpl<T> im
|
||||
return stillToDeliverToClient;
|
||||
}
|
||||
|
||||
protected void notifyListenersAboutReceive(T event) {
|
||||
Set<RaceLogEventVisitor> workingListeners = new HashSet<RaceLogEventVisitor>();
|
||||
protected void notifyListenersAboutReceive(EventT event) {
|
||||
Set<VisitorT> workingListeners = new HashSet<VisitorT>();
|
||||
synchronized (listeners) {
|
||||
workingListeners.addAll(listeners);
|
||||
}
|
||||
for (RaceLogEventVisitor listener : workingListeners) {
|
||||
for (VisitorT listener : workingListeners) {
|
||||
try {
|
||||
event.accept(listener);
|
||||
} catch (Throwable t) {
|
||||
@@ -239,29 +219,19 @@ public class AbstractLogImpl<T extends AbstractLogEvent> extends TrackImpl<T> im
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(RaceLogEventVisitor listener) {
|
||||
public void addListener(VisitorT listener) {
|
||||
synchronized (listeners) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(RaceLogEventVisitor listener) {
|
||||
public void removeListener(VisitorT listener) {
|
||||
synchronized (listeners) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NavigableSet<T> getInternalFixes() {
|
||||
return new PartialNavigableSetView<T>(super.getInternalFixes()) {
|
||||
@Override
|
||||
protected boolean isValid(T e) {
|
||||
return e.getPassId() == getCurrentPassId();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* When deserializing, needs to initialize empty set of listeners. Furthermore, as a migration effort, when the
|
||||
* {@link #eventsById} field was introduced, old clients get <code>null</code> as its value when deserializing which
|
||||
@@ -270,13 +240,13 @@ public class AbstractLogImpl<T extends AbstractLogEvent> extends TrackImpl<T> im
|
||||
*/
|
||||
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
|
||||
ois.defaultReadObject();
|
||||
listeners = new HashSet<RaceLogEventVisitor>();
|
||||
eventsDeliveredToClient = new HashMap<UUID, Set<T>>();
|
||||
listeners = new HashSet<VisitorT>();
|
||||
eventsDeliveredToClient = new HashMap<UUID, Set<EventT>>();
|
||||
if (eventsById == null) {
|
||||
eventsById = new HashMap<Serializable, T>();
|
||||
eventsById = new HashMap<Serializable, EventT>();
|
||||
lockForRead();
|
||||
try {
|
||||
for (T event : getRawFixes()) {
|
||||
for (EventT event : getRawFixes()) {
|
||||
eventsById.put(event.getId(), event);
|
||||
}
|
||||
} finally {
|
||||
@@ -287,9 +257,9 @@ public class AbstractLogImpl<T extends AbstractLogEvent> extends TrackImpl<T> im
|
||||
revokedEventIds = new HashSet<Serializable>();
|
||||
lockForRead();
|
||||
try {
|
||||
for (T event : getRawFixes()) {
|
||||
for (EventT event : getRawFixes()) {
|
||||
if (event instanceof RevokeEvent) {
|
||||
revokedEventIds.add(((RevokeEvent)event).getRevokedEventId());
|
||||
revokedEventIds.add(((RevokeEvent<?>)event).getRevokedEventId());
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
@@ -299,43 +269,43 @@ public class AbstractLogImpl<T extends AbstractLogEvent> extends TrackImpl<T> im
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<T> getRawFixesDescending() {
|
||||
public Iterable<EventT> getRawFixesDescending() {
|
||||
return getRawFixes().descendingSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<T> getFixesDescending() {
|
||||
public Iterable<EventT> getFixesDescending() {
|
||||
return getFixes().descendingSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<RaceLogEventVisitor> removeAllListeners() {
|
||||
public HashSet<VisitorT> removeAllListeners() {
|
||||
synchronized (listeners) {
|
||||
HashSet<RaceLogEventVisitor> clonedListeners = new HashSet<RaceLogEventVisitor>(listeners);
|
||||
listeners = new HashSet<RaceLogEventVisitor>();
|
||||
HashSet<VisitorT> clonedListeners = new HashSet<VisitorT>(listeners);
|
||||
listeners = new HashSet<VisitorT>();
|
||||
return clonedListeners;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAllListeners(HashSet<RaceLogEventVisitor> listeners) {
|
||||
public void addAllListeners(HashSet<VisitorT> listeners) {
|
||||
synchronized (listeners) {
|
||||
this.listeners.addAll(listeners);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<RaceLogEventVisitor> getAllListeners() {
|
||||
public Iterable<VisitorT> getAllListeners() {
|
||||
return this.listeners;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<T> getRawFixes(UUID clientId) {
|
||||
public Iterable<EventT> getRawFixes(UUID clientId) {
|
||||
assertReadLock();
|
||||
NavigableSet<T> result = getRawFixes();
|
||||
Set<T> edtc = eventsDeliveredToClient.get(clientId);
|
||||
NavigableSet<EventT> result = getRawFixes();
|
||||
Set<EventT> edtc = eventsDeliveredToClient.get(clientId);
|
||||
if (edtc == null) {
|
||||
edtc = new HashSet<T>();
|
||||
edtc = new HashSet<EventT>();
|
||||
eventsDeliveredToClient.put(clientId, edtc);
|
||||
}
|
||||
edtc.addAll(result);
|
||||
@@ -343,41 +313,41 @@ public class AbstractLogImpl<T extends AbstractLogEvent> extends TrackImpl<T> im
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getEventById(Serializable id) {
|
||||
public EventT getEventById(Serializable id) {
|
||||
assertReadLock();
|
||||
return eventsById.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableSet<T> getUnrevokedEvents() {
|
||||
return new PartialNavigableSetView<T>(super.getInternalFixes()) {
|
||||
public NavigableSet<EventT> getUnrevokedEvents() {
|
||||
return new PartialNavigableSetView<EventT>(super.getInternalFixes()) {
|
||||
@Override
|
||||
protected boolean isValid(T e) {
|
||||
protected boolean isValid(EventT e) {
|
||||
return ! (e instanceof RevokeEvent) && ! revokedEventIds.contains(e.getId());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableSet<T> getUnrevokedEventsDescending() {
|
||||
return new PartialNavigableSetView<T>(super.getInternalFixes().descendingSet()) {
|
||||
public NavigableSet<EventT> getUnrevokedEventsDescending() {
|
||||
return new PartialNavigableSetView<EventT>(super.getInternalFixes().descendingSet()) {
|
||||
@Override
|
||||
protected boolean isValid(T e) {
|
||||
protected boolean isValid(EventT e) {
|
||||
return ! (e instanceof RevokeEvent) && ! revokedEventIds.contains(e.getId());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void merge(AbstractLog<T> other) {
|
||||
public void merge(AbstractLog<EventT, VisitorT> other) {
|
||||
lockForWrite();
|
||||
other.lockForRead();
|
||||
try {
|
||||
RaceLogEventComparator comparator = RaceLogEventComparator.INSTANCE;
|
||||
Iterator<T> thisIter = getRawFixes().iterator();
|
||||
Iterator<T> otherIter = other.getRawFixes().iterator();
|
||||
T thisEvent = null;
|
||||
T otherEvent = null;
|
||||
RaceLogEventComparator comparator = new RaceLogEventComparator();
|
||||
Iterator<EventT> thisIter = getRawFixes().iterator();
|
||||
Iterator<EventT> otherIter = other.getRawFixes().iterator();
|
||||
EventT thisEvent = null;
|
||||
EventT otherEvent = null;
|
||||
while (otherIter.hasNext() || otherEvent != null) {
|
||||
if (thisEvent == null && thisIter.hasNext()) {
|
||||
thisEvent = thisIter.next();
|
||||
@@ -411,4 +381,21 @@ public class AbstractLogImpl<T extends AbstractLogEvent> extends TrackImpl<T> im
|
||||
unlockAfterWrite();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revokeEvent(AbstractLogEventAuthor author, EventT toRevoke) throws NotRevokableException {
|
||||
revokeEvent(author, toRevoke, null);
|
||||
}
|
||||
|
||||
protected abstract EventT createRevokeEvent(AbstractLogEventAuthor author, EventT toRevoke, String reason);
|
||||
|
||||
@Override
|
||||
public void revokeEvent(AbstractLogEventAuthor author, EventT toRevoke, String reason) throws NotRevokableException {
|
||||
if (toRevoke == null) {
|
||||
throw new NotRevokableException("Received null as event to revoke");
|
||||
}
|
||||
EventT revokeEvent = createRevokeEvent(author, toRevoke, reason);
|
||||
checkIfSuccessfullyRevokes((RevokeEvent<?>) revokeEvent);
|
||||
add(revokeEvent);
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.sap.sailing.domain.abstractlog.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.RevokeEvent;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
|
||||
public abstract class RevokeEventImpl<VisitorT> extends AbstractLogEventImpl<VisitorT> implements RevokeEvent<VisitorT> {
|
||||
private static final long serialVersionUID = -30864810737555657L;
|
||||
|
||||
private final Serializable revokedEventId;
|
||||
private final String reason;
|
||||
private final String revokedEventType;
|
||||
private final String revokedEventShortInfo;
|
||||
|
||||
public RevokeEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, Serializable revokedEventId, String revokedEventType,
|
||||
String revokedEventShortInfo, String reason) {
|
||||
super(createdAt, author, logicalTimePoint, pId);
|
||||
this.revokedEventId = revokedEventId;
|
||||
this.reason = reason;
|
||||
this.revokedEventType = revokedEventType;
|
||||
this.revokedEventShortInfo = revokedEventShortInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getRevokedEventId() {
|
||||
return revokedEventId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
if (revokedEventShortInfo == null) {
|
||||
return "No event revoked";
|
||||
} else {
|
||||
return "Revoked " + revokedEventType + "(" + revokedEventShortInfo + ")"
|
||||
+ reason == null ? "" : (" due to " + reason);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRevokedEventType() {
|
||||
return revokedEventType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRevokedEventShortInfo() {
|
||||
return revokedEventShortInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
}
|
||||
+9
-16
@@ -1,22 +1,15 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventComparator;
|
||||
import com.sap.sailing.domain.common.WithID;
|
||||
import com.sap.sailing.domain.tracking.Track;
|
||||
|
||||
/**
|
||||
* Special kind of {@link Track} for recording {@link RaceLogEvent}s.
|
||||
*
|
||||
* <p>
|
||||
* Keeps track of the {@link RaceLogEvent}'s pass and returns only the events of the current pass on
|
||||
* {@link RaceLog#getFixes()}. Use {@link RaceLog#getRawFixes()} to receive all events in a {@link RaceLog}.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Implementations should use the {@link RaceLogEventComparator} for sorting its content.
|
||||
* </p>
|
||||
*/
|
||||
public interface RaceLog extends AbstractLog<RaceLogEvent>, WithID {
|
||||
|
||||
public interface RaceLog extends AbstractLog<RaceLogEvent, RaceLogEventVisitor>, WithID {
|
||||
public static final int DefaultPassId = 0;
|
||||
|
||||
/**
|
||||
* Gets the current pass id.
|
||||
*
|
||||
* @return the pass id.
|
||||
*/
|
||||
int getCurrentPassId();
|
||||
}
|
||||
+15
-47
@@ -1,59 +1,27 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
import com.sap.sailing.domain.base.Timed;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* A {@link RaceLogEvent} is an entry in a race's log (typically a {@link RaceLog}.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Such an entry may influence the state of a race (scheduled, started, finished, ...), contain information about the
|
||||
* current displayed flags (AP, N, X, P, etc.) of a race or indicate some other change regarding the race. See
|
||||
* subclasses of {@link RaceLogEvent} for a full list of possibilities.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* A {@link RaceLogEvent} may be associated to a certain pass. For a race a new pass is initiated whenever a new start
|
||||
* time is proposed (e.g. after the race was aborted).
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Each {@link RaceLogEvent} carries two timestamps.
|
||||
*
|
||||
* The timestamp received with {@link RaceLogEvent#getCreatedAt()} denotes the point in time the event was created.
|
||||
*
|
||||
* The timestamp received with {@link RaceLogEvent#getLogicalTimePoint()} denotes the logical point in time the event
|
||||
* has occurred (sometimes called 'event time'). This timestamp might be different from
|
||||
* {@link RaceLogEvent#getCreatedAt()}. For example setting the start time of race to a point in time in the past,
|
||||
* results in a {@link RaceLogEvent} returning "now" on {@link RaceLogEvent#getCreatedAt()} and such a point in time
|
||||
* that a complete startphase could have occured on {@link RaceLogEvent#getTimePoint()}.
|
||||
*
|
||||
* To ensure an ordering there should be no two {@link RaceLogEvent}s returning the same point in time on
|
||||
* {@link RaceLogEvent#getCreatedAt()} <b>per pass</b>.
|
||||
*
|
||||
* The {@link RaceLogEvent}'s {@link Timed} interface redirects to {@link RaceLogEvent#getCreatedAt()} (was
|
||||
* {@link RaceLogEvent#getLogicalTimePoint()}!).
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Race log events have an author that has a name and a priority assigned. This can be used to represent multiple
|
||||
* concurrent race log authors such as a device used on a starting vessel, another device used at the finish line and
|
||||
* yet another device used on shore. In case more than one device make a statement about something, such as the start
|
||||
* time or the start procedure, the statement from the device with the highest priority needs to take precedence.
|
||||
* </p>
|
||||
*/
|
||||
public interface RaceLogEvent extends AbstractLogEvent {
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
|
||||
public interface RaceLogEvent extends AbstractLogEvent<RaceLogEventVisitor> {
|
||||
|
||||
/**
|
||||
* Gets the event's pass identifier.
|
||||
*
|
||||
* Each {@link RaceLogEvent} is associated to a certain pass. A pass is every attempt to start and run a race. A new
|
||||
* pass is initiated when a new start time is proposed (e.g. after the race was aborted). There might be certain
|
||||
* Each {@link RaceLogEvent} is associated to a certain pass. A pass is every attempt to start and run a race. A
|
||||
* new pass is initiated when a new start time is proposed (e.g. after the race was aborted). There might be certain
|
||||
* event type that are not strictly bound to its pass.
|
||||
*
|
||||
*/
|
||||
int getPassId();
|
||||
|
||||
|
||||
/**
|
||||
* Gets the list of associated {@link Competitor}s.
|
||||
*
|
||||
* A {@link RaceLogEvent} might be associated with a list of competitors, which are somehow relevant for this
|
||||
* kind of event. An example is a list of competitors who are marked for an individual recall.
|
||||
*/
|
||||
List<Competitor> getInvolvedBoats();
|
||||
}
|
||||
+36
-36
@@ -3,6 +3,7 @@ package com.sap.sailing.domain.abstractlog.race;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventFactoryImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.AdditionalScoringInformationEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.AdditionalScoringInformationType;
|
||||
@@ -27,100 +28,99 @@ import com.sap.sailing.domain.tracking.Wind;
|
||||
public interface RaceLogEventFactory {
|
||||
RaceLogEventFactory INSTANCE = new RaceLogEventFactoryImpl();
|
||||
|
||||
RaceLogFlagEvent createFlagEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, Serializable id, List<Competitor> involvedBoats,
|
||||
RaceLogFlagEvent createFlagEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, Serializable id, List<Competitor> involvedBoats,
|
||||
int passId, Flags upperFlag, Flags lowerFlag, boolean isDisplayed);
|
||||
|
||||
RaceLogFlagEvent createFlagEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId, Flags upperFlag,
|
||||
RaceLogFlagEvent createFlagEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId, Flags upperFlag,
|
||||
Flags lowerFlag, boolean isDisplayed);
|
||||
|
||||
RaceLogStartTimeEvent createStartTimeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, Serializable id,
|
||||
RaceLogStartTimeEvent createStartTimeEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, Serializable id,
|
||||
List<Competitor> involvedBoats, int passId, TimePoint startTime);
|
||||
|
||||
RaceLogStartTimeEvent createStartTimeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId, TimePoint startTime);
|
||||
RaceLogStartTimeEvent createStartTimeEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId, TimePoint startTime);
|
||||
|
||||
RaceLogRaceStatusEvent createRaceStatusEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, Serializable id,
|
||||
RaceLogRaceStatusEvent createRaceStatusEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, Serializable id,
|
||||
List<Competitor> competitors, int passId, RaceLogRaceStatus nextStatus);
|
||||
|
||||
RaceLogRaceStatusEvent createRaceStatusEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId, RaceLogRaceStatus nextStatus);
|
||||
RaceLogRaceStatusEvent createRaceStatusEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId, RaceLogRaceStatus nextStatus);
|
||||
|
||||
RaceLogPassChangeEvent createPassChangeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, Serializable id,
|
||||
RaceLogPassChangeEvent createPassChangeEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, Serializable id,
|
||||
List<Competitor> competitors, int passId);
|
||||
|
||||
RaceLogPassChangeEvent createPassChangeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId);
|
||||
RaceLogPassChangeEvent createPassChangeEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId);
|
||||
|
||||
RaceLogCourseAreaChangedEvent createCourseAreaChangedEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
RaceLogCourseAreaChangedEvent createCourseAreaChangedEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable id, List<Competitor> competitors, int passId, Serializable courseAreaId);
|
||||
|
||||
RaceLogCourseAreaChangedEvent createCourseAreaChangedEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
RaceLogCourseAreaChangedEvent createCourseAreaChangedEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
int passId, Serializable courseAreaId);
|
||||
|
||||
RaceLogCourseDesignChangedEvent createCourseDesignChangedEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
RaceLogCourseDesignChangedEvent createCourseDesignChangedEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable id, List<Competitor> competitors, int passId, CourseBase courseData);
|
||||
|
||||
RaceLogCourseDesignChangedEvent createCourseDesignChangedEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
RaceLogCourseDesignChangedEvent createCourseDesignChangedEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
int passId, CourseBase courseData);
|
||||
|
||||
RaceLogFinishPositioningListChangedEvent createFinishPositioningListChangedEvent(TimePoint logicalTimePoint,
|
||||
RaceLogEventAuthor author, Serializable id, List<Competitor> competitors,
|
||||
AbstractLogEventAuthor author, Serializable id, List<Competitor> competitors,
|
||||
int passId, CompetitorResults positionedCompetitors);
|
||||
|
||||
RaceLogFinishPositioningListChangedEvent createFinishPositioningListChangedEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
RaceLogFinishPositioningListChangedEvent createFinishPositioningListChangedEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
int passId, CompetitorResults positionedCompetitors);
|
||||
|
||||
RaceLogFinishPositioningConfirmedEvent createFinishPositioningConfirmedEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
RaceLogFinishPositioningConfirmedEvent createFinishPositioningConfirmedEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable id, List<Competitor> competitors, int passId, CompetitorResults positionedCompetitors);
|
||||
|
||||
RaceLogFinishPositioningConfirmedEvent createFinishPositioningConfirmedEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
RaceLogFinishPositioningConfirmedEvent createFinishPositioningConfirmedEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
int passId, CompetitorResults positionedCompetitors);
|
||||
|
||||
RaceLogPathfinderEvent createPathfinderEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, Serializable id,
|
||||
RaceLogPathfinderEvent createPathfinderEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, Serializable id,
|
||||
List<Competitor> competitors, int passId, String pathfinderId);
|
||||
|
||||
RaceLogPathfinderEvent createPathfinderEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId, String pathfinderId);
|
||||
RaceLogPathfinderEvent createPathfinderEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId, String pathfinderId);
|
||||
|
||||
RaceLogGateLineOpeningTimeEvent createGateLineOpeningTimeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
RaceLogGateLineOpeningTimeEvent createGateLineOpeningTimeEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable id, List<Competitor> competitors, int passId, Long gateLaunchStopTime, Long golfDownTime);
|
||||
|
||||
RaceLogGateLineOpeningTimeEvent createGateLineOpeningTimeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
RaceLogGateLineOpeningTimeEvent createGateLineOpeningTimeEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
int passId, Long gateLaunchStopTime, Long golfDownTime);
|
||||
|
||||
RaceLogStartProcedureChangedEvent createStartProcedureChangedEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
RaceLogStartProcedureChangedEvent createStartProcedureChangedEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable id, List<Competitor> competitors, int passId, RacingProcedureType type);
|
||||
|
||||
RaceLogStartProcedureChangedEvent createStartProcedureChangedEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
RaceLogStartProcedureChangedEvent createStartProcedureChangedEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
int passId, RacingProcedureType type);
|
||||
|
||||
RaceLogProtestStartTimeEvent createProtestStartTimeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
RaceLogProtestStartTimeEvent createProtestStartTimeEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable id, List<Competitor> competitors, int passId, TimePoint protestStartTime);
|
||||
|
||||
RaceLogProtestStartTimeEvent createProtestStartTimeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId, TimePoint protestStartTime);
|
||||
RaceLogProtestStartTimeEvent createProtestStartTimeEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId, TimePoint protestStartTime);
|
||||
|
||||
RaceLogWindFixEvent createWindFixEvent(TimePoint eventTime, RaceLogEventAuthor author, int currentPassId, Wind wind);
|
||||
RaceLogWindFixEvent createWindFixEvent(TimePoint eventTime, AbstractLogEventAuthor author, int currentPassId, Wind wind);
|
||||
|
||||
RaceLogWindFixEvent createWindFixEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
RaceLogWindFixEvent createWindFixEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable id, List<Competitor> competitors, int passId, Wind wind);
|
||||
|
||||
DeviceCompetitorMappingEvent createDeviceCompetitorMappingEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
DeviceCompetitorMappingEvent createDeviceCompetitorMappingEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
DeviceIdentifier device, Competitor mappedTo, int passId, TimePoint from, TimePoint to);
|
||||
|
||||
DeviceMarkMappingEvent createDeviceMarkMappingEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
DeviceMarkMappingEvent createDeviceMarkMappingEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
DeviceIdentifier device, Mark mappedTo, int passId, TimePoint from, TimePoint to);
|
||||
|
||||
DenoteForTrackingEvent createDenoteForTrackingEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId,
|
||||
DenoteForTrackingEvent createDenoteForTrackingEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId,
|
||||
String raceName, BoatClass boatClass, Serializable raceId);
|
||||
|
||||
StartTrackingEvent createStartTrackingEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId);
|
||||
StartTrackingEvent createStartTrackingEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId);
|
||||
|
||||
RevokeEvent createRevokeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId, Serializable revokedEventId,
|
||||
String revokedEventType, String revokedEventShortInfo, String reason);
|
||||
RaceLogRevokeEvent createRevokeEvent(AbstractLogEventAuthor author, int passId, RaceLogEvent toRevoke, String reason);
|
||||
|
||||
RegisterCompetitorEvent createRegisterCompetitorEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId, Competitor competitor);
|
||||
RegisterCompetitorEvent createRegisterCompetitorEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId, Competitor competitor);
|
||||
|
||||
DefineMarkEvent createDefineMarkEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId, Mark mark);
|
||||
DefineMarkEvent createDefineMarkEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId, Mark mark);
|
||||
|
||||
CloseOpenEndedDeviceMappingEvent createCloseOpenEndedDeviceMappingEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId,
|
||||
CloseOpenEndedDeviceMappingEvent createCloseOpenEndedDeviceMappingEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId,
|
||||
Serializable deviceMappingEventId, TimePoint closingTimePoint);
|
||||
|
||||
AdditionalScoringInformationEvent createAdditionalScoringInformationEvent(TimePoint timePoint, Serializable id, RaceLogEventAuthor author, int currentPassId,
|
||||
AdditionalScoringInformationEvent createAdditionalScoringInformationEvent(TimePoint timePoint, Serializable id, AbstractLogEventAuthor author, int currentPassId,
|
||||
AdditionalScoringInformationType informationType);
|
||||
}
|
||||
+23
-22
@@ -3,6 +3,7 @@ package com.sap.sailing.domain.abstractlog.race;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventRestoreFactoryImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.AdditionalScoringInformationEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.AdditionalScoringInformationType;
|
||||
@@ -27,74 +28,74 @@ import com.sap.sailing.domain.tracking.Wind;
|
||||
public interface RaceLogEventRestoreFactory extends RaceLogEventFactory {
|
||||
RaceLogEventRestoreFactory INSTANCE = new RaceLogEventRestoreFactoryImpl();
|
||||
|
||||
RaceLogFlagEvent createFlagEvent(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
RaceLogFlagEvent createFlagEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable id, List<Competitor> involvedBoats, int passId, Flags upperFlag, Flags lowerFlag, boolean isDisplayed);
|
||||
|
||||
RaceLogStartTimeEvent createStartTimeEvent(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
RaceLogStartTimeEvent createStartTimeEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable id, List<Competitor> involvedBoats, int passId, TimePoint startTime);
|
||||
|
||||
RaceLogRaceStatusEvent createRaceStatusEvent(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
RaceLogRaceStatusEvent createRaceStatusEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable id, List<Competitor> competitors, int passId, RaceLogRaceStatus nextStatus);
|
||||
|
||||
RaceLogPassChangeEvent createPassChangeEvent(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
RaceLogPassChangeEvent createPassChangeEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable id, List<Competitor> competitors, int passId);
|
||||
|
||||
RaceLogCourseAreaChangedEvent createCourseAreaChangedEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
RaceLogCourseAreaChangedEvent createCourseAreaChangedEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, Serializable courseAreaId);
|
||||
|
||||
RaceLogCourseDesignChangedEvent createCourseDesignChangedEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
RaceLogCourseDesignChangedEvent createCourseDesignChangedEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, CourseBase courseData);
|
||||
|
||||
RaceLogFinishPositioningListChangedEvent createFinishPositioningListChangedEvent(TimePoint createdAt,
|
||||
RaceLogEventAuthor author, TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors,
|
||||
AbstractLogEventAuthor author, TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors,
|
||||
int passId, CompetitorResults positionedCompetitors);
|
||||
|
||||
RaceLogFinishPositioningConfirmedEvent createFinishPositioningConfirmedEvent(TimePoint createdAt,
|
||||
RaceLogEventAuthor author, TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors,
|
||||
AbstractLogEventAuthor author, TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors,
|
||||
int passId, CompetitorResults positionedCompetitors);
|
||||
|
||||
RaceLogPathfinderEvent createPathfinderEvent(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
RaceLogPathfinderEvent createPathfinderEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable id, List<Competitor> competitors, int passId, String pathfinderId);
|
||||
|
||||
RaceLogGateLineOpeningTimeEvent createGateLineOpeningTimeEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
RaceLogGateLineOpeningTimeEvent createGateLineOpeningTimeEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, Long gateLaunchStopTime,
|
||||
Long golfDownTime);
|
||||
|
||||
RaceLogStartProcedureChangedEvent createStartProcedureChangedEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
RaceLogStartProcedureChangedEvent createStartProcedureChangedEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, RacingProcedureType type);
|
||||
|
||||
RaceLogProtestStartTimeEvent createProtestStartTimeEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
RaceLogProtestStartTimeEvent createProtestStartTimeEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, TimePoint protestStartTime);
|
||||
|
||||
RaceLogWindFixEvent createWindFixEvent(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
RaceLogWindFixEvent createWindFixEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable id, List<Competitor> competitors, Integer passId, Wind wind);
|
||||
|
||||
DeviceCompetitorMappingEvent createDeviceCompetitorMappingEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
DeviceCompetitorMappingEvent createDeviceCompetitorMappingEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable pId, DeviceIdentifier device, Competitor mappedTo, int passId, TimePoint from, TimePoint to);
|
||||
|
||||
DeviceMarkMappingEvent createDeviceMarkMappingEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
DeviceMarkMappingEvent createDeviceMarkMappingEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable pId, DeviceIdentifier device, Mark mappedTo, int passId, TimePoint from, TimePoint to);
|
||||
|
||||
DenoteForTrackingEvent createDenoteForTrackingEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
DenoteForTrackingEvent createDenoteForTrackingEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable pId, int passId, String raceName, BoatClass boatClass, Serializable raceId);
|
||||
|
||||
StartTrackingEvent createStartTrackingEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
StartTrackingEvent createStartTrackingEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable pId, int passId);
|
||||
|
||||
RevokeEvent createRevokeEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
RaceLogRevokeEvent createRevokeEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable pId, int passId, Serializable revokedEventId,
|
||||
String revokedEventType, String revokedEventShortInfo, String reason);
|
||||
|
||||
RegisterCompetitorEvent createRegisterCompetitorEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
RegisterCompetitorEvent createRegisterCompetitorEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable pId, int passId, Competitor competitor);
|
||||
|
||||
DefineMarkEvent createDefineMarkEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
DefineMarkEvent createDefineMarkEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable pId, int passId, Mark mark);
|
||||
|
||||
CloseOpenEndedDeviceMappingEvent createCloseOpenEndedDeviceMappingEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
CloseOpenEndedDeviceMappingEvent createCloseOpenEndedDeviceMappingEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable pId, int passId, Serializable deviceMappingEventId, TimePoint closingTimePoint);
|
||||
|
||||
AdditionalScoringInformationEvent createAdditionalScoringInformationEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
AdditionalScoringInformationEvent createAdditionalScoringInformationEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable pId, List<Competitor> competitors, int passId,
|
||||
AdditionalScoringInformationType informationType);
|
||||
}
|
||||
+2
-2
@@ -11,6 +11,8 @@ import com.sap.sailing.domain.abstractlog.race.tracking.StartTrackingEvent;
|
||||
|
||||
|
||||
public interface RaceLogEventVisitor {
|
||||
public void visit(RaceLogRevokeEvent event);
|
||||
|
||||
public void visit(RaceLogFlagEvent event);
|
||||
|
||||
public void visit(RaceLogPassChangeEvent event);
|
||||
@@ -45,8 +47,6 @@ public interface RaceLogEventVisitor {
|
||||
|
||||
public void visit(StartTrackingEvent event);
|
||||
|
||||
public void visit(RevokeEvent event);
|
||||
|
||||
public void visit(RegisterCompetitorEvent event);
|
||||
|
||||
public void visit(DefineMarkEvent event);
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.RevokeEvent;
|
||||
|
||||
public interface RaceLogRevokeEvent extends RaceLogEvent, RevokeEvent<RaceLogEventVisitor> {
|
||||
|
||||
}
|
||||
+2
-2
@@ -12,10 +12,10 @@ import com.sap.sailing.domain.abstractlog.race.RaceLogPassChangeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogPathfinderEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogProtestStartTimeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRaceStatusEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRevokeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartProcedureChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogWindFixEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RevokeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.AdditionalScoringInformationEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.CloseOpenEndedDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DefineMarkEvent;
|
||||
@@ -108,7 +108,7 @@ public abstract class AbstractRaceLogChangedVisitor implements RaceLogEventVisit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(RevokeEvent event) {
|
||||
public void visit(RaceLogRevokeEvent event) {
|
||||
notifyListenerAboutEventAdded(event);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -11,10 +11,10 @@ import com.sap.sailing.domain.abstractlog.race.RaceLogPassChangeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogPathfinderEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogProtestStartTimeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRaceStatusEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRevokeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartProcedureChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogWindFixEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RevokeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.AdditionalScoringInformationEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.CloseOpenEndedDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DefineMarkEvent;
|
||||
@@ -115,7 +115,7 @@ public abstract class BaseRaceLogEventVisitor implements RaceLogEventVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(RevokeEvent event) {
|
||||
public void visit(RaceLogRevokeEvent event) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
+14
-1
@@ -10,11 +10,13 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLog;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.common.Duration;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.NotRevokableException;
|
||||
|
||||
/**
|
||||
* Wrapper for a {@link RaceLog} which will ignore all calls trying to add an {@link RaceLogEvent}. All other
|
||||
@@ -228,7 +230,18 @@ public class NoAddingRaceLogWrapper implements RaceLog {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void merge(AbstractLog<RaceLogEvent> other) {
|
||||
public void merge(AbstractLog<RaceLogEvent, RaceLogEventVisitor> other) {
|
||||
innerRaceLog.merge(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revokeEvent(AbstractLogEventAuthor author, RaceLogEvent toRevoke, String reason)
|
||||
throws NotRevokableException {
|
||||
innerRaceLog.revokeEvent(author, toRevoke, reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revokeEvent(AbstractLogEventAuthor author, RaceLogEvent toRevoke) throws NotRevokableException {
|
||||
innerRaceLog.revokeEvent(author, toRevoke);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -3,8 +3,8 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseAreaChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
@@ -16,7 +16,7 @@ RaceLogCourseAreaChangedEvent {
|
||||
private final Serializable courseAreaId;
|
||||
|
||||
public RaceLogCourseAreaChangeEventImpl(TimePoint createdAt,
|
||||
RaceLogEventAuthor author, TimePoint pTimePoint, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, Serializable courseAreaId) {
|
||||
AbstractLogEventAuthor author, TimePoint pTimePoint, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, Serializable courseAreaId) {
|
||||
super(createdAt, author, pTimePoint, pId, pInvolvedBoats, pPassId);
|
||||
this.courseAreaId = courseAreaId;
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseDesignChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.CourseBase;
|
||||
@@ -16,7 +16,7 @@ public class RaceLogCourseDesignChangedEventImpl extends RaceLogEventImpl implem
|
||||
private final CourseBase courseDesign;
|
||||
|
||||
public RaceLogCourseDesignChangedEventImpl(TimePoint createdAt,
|
||||
RaceLogEventAuthor author, TimePoint pTimePoint, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, CourseBase courseDesign) {
|
||||
AbstractLogEventAuthor author, TimePoint pTimePoint, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, CourseBase courseDesign) {
|
||||
super(createdAt, author, pTimePoint, pId, pInvolvedBoats, pPassId);
|
||||
this.courseDesign = courseDesign;
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,13 +1,13 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sse.common.impl.NamedImpl;
|
||||
|
||||
public class RaceLogEventAuthorImpl extends NamedImpl implements RaceLogEventAuthor {
|
||||
public class RaceLogEventAuthorImpl extends NamedImpl implements AbstractLogEventAuthor {
|
||||
private static final long serialVersionUID = -5602802911563685812L;
|
||||
private final int priority;
|
||||
|
||||
public static RaceLogEventAuthor createCompatibilityAuthor() {
|
||||
public static AbstractLogEventAuthor createCompatibilityAuthor() {
|
||||
return new RaceLogEventAuthorImpl(NAME_COMPATIBILITY, PRIORITY_COMPATIBILITY);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class RaceLogEventAuthorImpl extends NamedImpl implements RaceLogEventAut
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(RaceLogEventAuthor other) {
|
||||
public int compareTo(AbstractLogEventAuthor other) {
|
||||
/** as '0' has a higher priority than '1' the compare method ranks a '0' priority higher than a '1' priority */
|
||||
Integer result = new Integer(getPriority()).compareTo(other.getPriority());
|
||||
return -result;
|
||||
|
||||
+11
-43
@@ -3,57 +3,25 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.impl.AbstractLogEventComparator;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.base.Timed;
|
||||
import com.sap.sailing.domain.tracking.impl.TimedComparator;
|
||||
|
||||
/**
|
||||
* Comparator sorting by pass, then by {@link RaceLogEventAuthor}, then by {@link RaceLogEvent#getCreatedAt()}
|
||||
* Comparator sorting by pass, then by {@link AbstractLogEventAuthor}, then by {@link RaceLogEvent#getCreatedAt()}
|
||||
* timestamp.
|
||||
*
|
||||
* If one of the passed objects is not a {@link RaceLogEvent}, sorting is done by {@link Timed#getTimePoint()}.
|
||||
*/
|
||||
public enum RaceLogEventComparator implements Comparator<Timed>, Serializable {
|
||||
INSTANCE;
|
||||
public class RaceLogEventComparator extends AbstractLogEventComparator implements Comparator<Timed>, Serializable {
|
||||
private static final long serialVersionUID = 6146135178558781346L;
|
||||
|
||||
private Comparator<Timed> timedComparator;
|
||||
|
||||
private RaceLogEventComparator() {
|
||||
this.timedComparator = TimedComparator.INSTANCE;
|
||||
protected int compareEvents(RaceLogEvent e1, RaceLogEvent e2) {
|
||||
//compare passes
|
||||
int result = e1.getPassId() - e2.getPassId();
|
||||
if (result != 0) return result;
|
||||
|
||||
return super.compareEvents(e1, e2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(Timed o1, Timed o2) {
|
||||
if (o1 instanceof RaceLogEvent && o2 instanceof RaceLogEvent) {
|
||||
return compareEvents((RaceLogEvent) o1, (RaceLogEvent) o2);
|
||||
}
|
||||
|
||||
// fallback to timed comparison
|
||||
return timedComparator.compare(o1, o2);
|
||||
}
|
||||
|
||||
private int compareEvents(RaceLogEvent e1, RaceLogEvent e2) {
|
||||
int result = comparePasses(e1, e2);
|
||||
return result == 0 ? compareAuthorPriorities(e1, e2) : result;
|
||||
}
|
||||
|
||||
private int comparePasses(RaceLogEvent e1, RaceLogEvent e2) {
|
||||
return e1.getPassId() - e2.getPassId();
|
||||
}
|
||||
|
||||
private int compareAuthorPriorities(RaceLogEvent e1, RaceLogEvent e2) {
|
||||
int result = e1.getAuthor().compareTo(e2.getAuthor());
|
||||
return result == 0 ? compareCreatedAtTimes(e1, e2) : result;
|
||||
}
|
||||
|
||||
private int compareCreatedAtTimes(RaceLogEvent e1, RaceLogEvent e2) {
|
||||
int result = e1.getCreatedAt().compareTo(e2.getCreatedAt());
|
||||
return result == 0 ? compareIds(e1, e2) : result;
|
||||
}
|
||||
|
||||
private int compareIds(RaceLogEvent e1, RaceLogEvent e2) {
|
||||
return e1.getId().toString().compareTo(e2.getId().toString());
|
||||
}
|
||||
|
||||
}
|
||||
+40
-41
@@ -6,10 +6,11 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.CompetitorResults;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseAreaChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseDesignChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFinishPositioningConfirmedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFlagEvent;
|
||||
@@ -18,10 +19,10 @@ import com.sap.sailing.domain.abstractlog.race.RaceLogPassChangeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogPathfinderEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogProtestStartTimeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRaceStatusEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRevokeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartProcedureChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogWindFixEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RevokeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.AdditionalScoringInformationEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.AdditionalScoringInformationType;
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.impl.AdditionalScoringInformationEventImpl;
|
||||
@@ -39,7 +40,6 @@ import com.sap.sailing.domain.abstractlog.race.tracking.events.DenoteForTracking
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.events.DeviceCompetitorMappingEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.events.DeviceMarkMappingEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.events.RegisterCompetitorEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.events.RevokeEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.events.StartTrackingEventImpl;
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
@@ -55,77 +55,77 @@ import com.sap.sailing.domain.tracking.Wind;
|
||||
public class RaceLogEventFactoryImpl implements RaceLogEventFactory {
|
||||
|
||||
@Override
|
||||
public RaceLogFlagEvent createFlagEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, Serializable id,
|
||||
public RaceLogFlagEvent createFlagEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, Serializable id,
|
||||
List<Competitor> involvedBoats, int passId, Flags upperFlag, Flags lowerFlag, boolean isDisplayed) {
|
||||
return new RaceLogFlagEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, id, involvedBoats, passId,
|
||||
upperFlag, lowerFlag, isDisplayed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogFlagEvent createFlagEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId, Flags upperFlag,
|
||||
public RaceLogFlagEvent createFlagEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId, Flags upperFlag,
|
||||
Flags lowerFlag, boolean isDisplayed) {
|
||||
return createFlagEvent(logicalTimePoint, author, UUID.randomUUID(), new ArrayList<Competitor>(), passId, upperFlag,
|
||||
lowerFlag, isDisplayed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogStartTimeEvent createStartTimeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public RaceLogStartTimeEvent createStartTimeEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable id, List<Competitor> involvedBoats, int passId, TimePoint startTime) {
|
||||
return new RaceLogStartTimeEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, id, involvedBoats,
|
||||
passId, startTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogStartTimeEvent createStartTimeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId, TimePoint startTime) {
|
||||
public RaceLogStartTimeEvent createStartTimeEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId, TimePoint startTime) {
|
||||
return createStartTimeEvent(logicalTimePoint, author, UUID.randomUUID(), new ArrayList<Competitor>(), passId, startTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogRaceStatusEvent createRaceStatusEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public RaceLogRaceStatusEvent createRaceStatusEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable id, List<Competitor> competitors, int passId, RaceLogRaceStatus nextStatus) {
|
||||
return new RaceLogRaceStatusEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, id, competitors,
|
||||
passId, nextStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogRaceStatusEvent createRaceStatusEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId, RaceLogRaceStatus nextStatus) {
|
||||
public RaceLogRaceStatusEvent createRaceStatusEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId, RaceLogRaceStatus nextStatus) {
|
||||
return createRaceStatusEvent(logicalTimePoint, author, UUID.randomUUID(), new ArrayList<Competitor>(), passId, nextStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogPassChangeEvent createPassChangeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public RaceLogPassChangeEvent createPassChangeEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable id, List<Competitor> competitors, int passId) {
|
||||
return new RaceLogPassChangeEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, id, competitors, passId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogPassChangeEvent createPassChangeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId) {
|
||||
public RaceLogPassChangeEvent createPassChangeEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId) {
|
||||
return createPassChangeEvent(logicalTimePoint, author, UUID.randomUUID(), new ArrayList<Competitor>(), passId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogCourseAreaChangedEvent createCourseAreaChangedEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public RaceLogCourseAreaChangedEvent createCourseAreaChangedEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable id, List<Competitor> competitors, int passId, Serializable courseAreaId) {
|
||||
return new RaceLogCourseAreaChangeEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, id, competitors,
|
||||
passId, courseAreaId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogCourseAreaChangedEvent createCourseAreaChangedEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public RaceLogCourseAreaChangedEvent createCourseAreaChangedEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
int passId, Serializable courseAreaId) {
|
||||
return createCourseAreaChangedEvent(logicalTimePoint, author, UUID.randomUUID(), new ArrayList<Competitor>(),
|
||||
passId, courseAreaId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogCourseDesignChangedEvent createCourseDesignChangedEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public RaceLogCourseDesignChangedEvent createCourseDesignChangedEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable id, List<Competitor> competitors, int passId, CourseBase courseData) {
|
||||
return new RaceLogCourseDesignChangedEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, id, competitors,
|
||||
passId, courseData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogCourseDesignChangedEvent createCourseDesignChangedEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public RaceLogCourseDesignChangedEvent createCourseDesignChangedEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
int passId, CourseBase courseData) {
|
||||
return createCourseDesignChangedEvent(logicalTimePoint, author, UUID.randomUUID(), new ArrayList<Competitor>(),
|
||||
passId, courseData);
|
||||
@@ -133,7 +133,7 @@ public class RaceLogEventFactoryImpl implements RaceLogEventFactory {
|
||||
|
||||
@Override
|
||||
public RaceLogFinishPositioningListChangedEventImpl createFinishPositioningListChangedEvent(TimePoint logicalTimePoint,
|
||||
RaceLogEventAuthor author, Serializable id, List<Competitor> competitors,
|
||||
AbstractLogEventAuthor author, Serializable id, List<Competitor> competitors,
|
||||
int passId, CompetitorResults positionedCompetitors) {
|
||||
return new RaceLogFinishPositioningListChangedEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint,
|
||||
id, competitors, passId, positionedCompetitors);
|
||||
@@ -141,143 +141,142 @@ public class RaceLogEventFactoryImpl implements RaceLogEventFactory {
|
||||
|
||||
@Override
|
||||
public RaceLogFinishPositioningListChangedEventImpl createFinishPositioningListChangedEvent(TimePoint logicalTimePoint,
|
||||
RaceLogEventAuthor author, int passId, CompetitorResults positionedCompetitors) {
|
||||
AbstractLogEventAuthor author, int passId, CompetitorResults positionedCompetitors) {
|
||||
return createFinishPositioningListChangedEvent(logicalTimePoint, author, UUID.randomUUID(),
|
||||
new ArrayList<Competitor>(), passId, positionedCompetitors);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogFinishPositioningConfirmedEvent createFinishPositioningConfirmedEvent(TimePoint logicalTimePoint,
|
||||
RaceLogEventAuthor author, Serializable id, List<Competitor> competitors, int passId, CompetitorResults positionedCompetitors) {
|
||||
AbstractLogEventAuthor author, Serializable id, List<Competitor> competitors, int passId, CompetitorResults positionedCompetitors) {
|
||||
return new RaceLogFinishPositioningConfirmedEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, id,
|
||||
competitors, passId, positionedCompetitors);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogFinishPositioningConfirmedEvent createFinishPositioningConfirmedEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public RaceLogFinishPositioningConfirmedEvent createFinishPositioningConfirmedEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
int passId, CompetitorResults positionedCompetitors) {
|
||||
return createFinishPositioningConfirmedEvent(logicalTimePoint, author, UUID.randomUUID(), new ArrayList<Competitor>(), passId, positionedCompetitors);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogPathfinderEvent createPathfinderEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public RaceLogPathfinderEvent createPathfinderEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable id, List<Competitor> competitors, int passId, String pathfinderId) {
|
||||
return new RaceLogPathfinderEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, id, competitors,
|
||||
passId, pathfinderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogPathfinderEvent createPathfinderEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId, String pathfinderId) {
|
||||
public RaceLogPathfinderEvent createPathfinderEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId, String pathfinderId) {
|
||||
return createPathfinderEvent(logicalTimePoint, author, UUID.randomUUID(), new ArrayList<Competitor>(), passId, pathfinderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogGateLineOpeningTimeEvent createGateLineOpeningTimeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public RaceLogGateLineOpeningTimeEvent createGateLineOpeningTimeEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable id, List<Competitor> competitors, int passId, Long gateLaunchStopTime, Long golfDownTime) {
|
||||
return new RaceLogGateLineOpeningTimeEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, id, competitors,
|
||||
passId, gateLaunchStopTime, golfDownTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogGateLineOpeningTimeEvent createGateLineOpeningTimeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public RaceLogGateLineOpeningTimeEvent createGateLineOpeningTimeEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
int passId, Long gateLaunchStopTime, Long golfDownTime) {
|
||||
return createGateLineOpeningTimeEvent(logicalTimePoint, author, UUID.randomUUID(), new ArrayList<Competitor>(),
|
||||
passId, gateLaunchStopTime, golfDownTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogStartProcedureChangedEvent createStartProcedureChangedEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public RaceLogStartProcedureChangedEvent createStartProcedureChangedEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable id, List<Competitor> competitors, int passId, RacingProcedureType type) {
|
||||
return new RaceLogStartProcedureChangedEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, id,
|
||||
competitors, passId, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogStartProcedureChangedEvent createStartProcedureChangedEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public RaceLogStartProcedureChangedEvent createStartProcedureChangedEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
int passId, RacingProcedureType type) {
|
||||
return createStartProcedureChangedEvent(logicalTimePoint, author, UUID.randomUUID(), new ArrayList<Competitor>(), passId, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogProtestStartTimeEvent createProtestStartTimeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public RaceLogProtestStartTimeEvent createProtestStartTimeEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable id, List<Competitor> competitors, int passId, TimePoint protestStartTime) {
|
||||
return new RaceLogProtestStartTimeEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, id,
|
||||
competitors, passId, protestStartTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogProtestStartTimeEvent createProtestStartTimeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public RaceLogProtestStartTimeEvent createProtestStartTimeEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
int passId, TimePoint protestStartTime) {
|
||||
return createProtestStartTimeEvent(logicalTimePoint, author, UUID.randomUUID(), new ArrayList<Competitor>(),
|
||||
passId, protestStartTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogWindFixEvent createWindFixEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId, Wind wind) {
|
||||
public RaceLogWindFixEvent createWindFixEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId, Wind wind) {
|
||||
return createWindFixEvent(logicalTimePoint, author, UUID.randomUUID(), new ArrayList<Competitor>(), passId, wind);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogWindFixEvent createWindFixEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, Serializable id,
|
||||
public RaceLogWindFixEvent createWindFixEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, Serializable id,
|
||||
List<Competitor> competitors, int passId, Wind wind) {
|
||||
return new RaceLogWindFixEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, id, competitors, passId, wind);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceCompetitorMappingEvent createDeviceCompetitorMappingEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public DeviceCompetitorMappingEvent createDeviceCompetitorMappingEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
DeviceIdentifier device, Competitor mappedTo, int passId, TimePoint from, TimePoint to) {
|
||||
return new DeviceCompetitorMappingEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, UUID.randomUUID(),
|
||||
passId, mappedTo, device, from, to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceMarkMappingEvent createDeviceMarkMappingEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public DeviceMarkMappingEvent createDeviceMarkMappingEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
DeviceIdentifier device, Mark mappedTo, int passId, TimePoint from, TimePoint to) {
|
||||
return new DeviceMarkMappingEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, UUID.randomUUID(),
|
||||
passId, mappedTo, device, from, to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DenoteForTrackingEvent createDenoteForTrackingEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId,
|
||||
public DenoteForTrackingEvent createDenoteForTrackingEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId,
|
||||
String raceName, BoatClass boatClass, Serializable raceId) {
|
||||
return new DenoteForTrackingEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, UUID.randomUUID(), passId, raceName,
|
||||
boatClass, raceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StartTrackingEvent createStartTrackingEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId) {
|
||||
public StartTrackingEvent createStartTrackingEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId) {
|
||||
return new StartTrackingEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, UUID.randomUUID(), passId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RevokeEvent createRevokeEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author, int passId, Serializable revokedEventId,
|
||||
String revokedEventType, String revokedEventShortInfo, String reason) {
|
||||
return new RevokeEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, UUID.randomUUID(),
|
||||
passId, revokedEventId, revokedEventType, revokedEventShortInfo, reason);
|
||||
public RaceLogRevokeEvent createRevokeEvent(AbstractLogEventAuthor author, int passId, RaceLogEvent toRevoke, String reason) {
|
||||
return new RaceLogRevokeEventImpl(MillisecondsTimePoint.now(), author, MillisecondsTimePoint.now(), UUID.randomUUID(),
|
||||
passId, toRevoke.getId(), toRevoke.getClass().getName(), toRevoke.getShortInfo(), reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegisterCompetitorEvent createRegisterCompetitorEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public RegisterCompetitorEvent createRegisterCompetitorEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
int passId, Competitor competitor) {
|
||||
return new RegisterCompetitorEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, UUID.randomUUID(), passId, competitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefineMarkEvent createDefineMarkEvent(TimePoint logicalTimePoint, RaceLogEventAuthor author,
|
||||
public DefineMarkEvent createDefineMarkEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
int passId, Mark mark) {
|
||||
return new DefineMarkEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, UUID.randomUUID(), passId, mark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloseOpenEndedDeviceMappingEvent createCloseOpenEndedDeviceMappingEvent(TimePoint logicalTimePoint,
|
||||
RaceLogEventAuthor author, int passId, Serializable deviceMappingEventId, TimePoint closingTimePoint) {
|
||||
AbstractLogEventAuthor author, int passId, Serializable deviceMappingEventId, TimePoint closingTimePoint) {
|
||||
return new CloseOpenEndedDeviceMappingEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint,
|
||||
UUID.randomUUID(), passId, deviceMappingEventId, closingTimePoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdditionalScoringInformationEvent createAdditionalScoringInformationEvent(TimePoint timePoint, Serializable id,
|
||||
RaceLogEventAuthor author, int currentPassId, AdditionalScoringInformationType informationType) {
|
||||
AbstractLogEventAuthor author, int currentPassId, AdditionalScoringInformationType informationType) {
|
||||
return new AdditionalScoringInformationEventImpl(MillisecondsTimePoint.now(), author, timePoint, id, Collections.<Competitor>emptyList(), currentPassId,
|
||||
informationType);
|
||||
}
|
||||
|
||||
+24
-4
@@ -3,18 +3,38 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.impl.AbstractLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
|
||||
public abstract class RaceLogEventImpl extends AbstractLogEventImpl implements RaceLogEvent {
|
||||
public abstract class RaceLogEventImpl extends AbstractLogEventImpl<RaceLogEventVisitor> implements RaceLogEvent {
|
||||
private final List<Competitor> involvedBoats;
|
||||
private final int passId;
|
||||
|
||||
private static final long serialVersionUID = -2557594972618769182L;
|
||||
|
||||
public RaceLogEventImpl(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
public RaceLogEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, List<Competitor> pInvolvedBoats, int pPassId) {
|
||||
super(createdAt, author, logicalTimePoint, pId, pInvolvedBoats, pPassId);
|
||||
super(createdAt, author, logicalTimePoint, pId);
|
||||
this.involvedBoats = pInvolvedBoats;
|
||||
this.passId = pPassId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Competitor> getInvolvedBoats() {
|
||||
return involvedBoats;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPassId() {
|
||||
return passId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + ", involvedBoats: " + getInvolvedBoats() + ", passId: " + getPassId();
|
||||
}
|
||||
}
|
||||
+25
-26
@@ -3,10 +3,10 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.CompetitorResults;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseAreaChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseDesignChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventRestoreFactory;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFinishPositioningConfirmedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFinishPositioningListChangedEvent;
|
||||
@@ -16,10 +16,10 @@ import com.sap.sailing.domain.abstractlog.race.RaceLogPassChangeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogPathfinderEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogProtestStartTimeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRaceStatusEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRevokeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartProcedureChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogWindFixEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RevokeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.AdditionalScoringInformationEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.AdditionalScoringInformationType;
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.impl.AdditionalScoringInformationEventImpl;
|
||||
@@ -37,7 +37,6 @@ import com.sap.sailing.domain.abstractlog.race.tracking.events.DenoteForTracking
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.events.DeviceCompetitorMappingEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.events.DeviceMarkMappingEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.events.RegisterCompetitorEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.events.RevokeEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.events.StartTrackingEventImpl;
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
@@ -52,61 +51,61 @@ import com.sap.sailing.domain.tracking.Wind;
|
||||
public class RaceLogEventRestoreFactoryImpl extends RaceLogEventFactoryImpl implements RaceLogEventRestoreFactory {
|
||||
|
||||
@Override
|
||||
public RaceLogFlagEvent createFlagEvent(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
public RaceLogFlagEvent createFlagEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable id, List<Competitor> involvedBoats, int passId, Flags upperFlag, Flags lowerFlag, boolean isDisplayed) {
|
||||
return new RaceLogFlagEventImpl(createdAt, author, logicalTimePoint, id, involvedBoats, passId, upperFlag, lowerFlag, isDisplayed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogStartTimeEvent createStartTimeEvent(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
public RaceLogStartTimeEvent createStartTimeEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable id, List<Competitor> involvedBoats, int passId, TimePoint startTime) {
|
||||
return new RaceLogStartTimeEventImpl(createdAt, author, logicalTimePoint, id, involvedBoats, passId, startTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogRaceStatusEvent createRaceStatusEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
public RaceLogRaceStatusEvent createRaceStatusEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, RaceLogRaceStatus nextStatus) {
|
||||
return new RaceLogRaceStatusEventImpl(createdAt, author, logicalTimePoint, id, competitors, passId, nextStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogPassChangeEvent createPassChangeEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
public RaceLogPassChangeEvent createPassChangeEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId) {
|
||||
return new RaceLogPassChangeEventImpl(createdAt, author, logicalTimePoint, id, competitors, passId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogCourseAreaChangedEvent createCourseAreaChangedEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
public RaceLogCourseAreaChangedEvent createCourseAreaChangedEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, Serializable courseAreaId) {
|
||||
return new RaceLogCourseAreaChangeEventImpl(createdAt, author, logicalTimePoint, id, competitors, passId, courseAreaId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogCourseDesignChangedEvent createCourseDesignChangedEvent(TimePoint createdAt,
|
||||
RaceLogEventAuthor author, TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, CourseBase courseData) {
|
||||
AbstractLogEventAuthor author, TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, CourseBase courseData) {
|
||||
return new RaceLogCourseDesignChangedEventImpl(createdAt, author, logicalTimePoint, id, competitors, passId, courseData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogFinishPositioningListChangedEvent createFinishPositioningListChangedEvent(TimePoint createdAt,
|
||||
RaceLogEventAuthor author, TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, CompetitorResults positionedCompetitors) {
|
||||
AbstractLogEventAuthor author, TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, CompetitorResults positionedCompetitors) {
|
||||
return new RaceLogFinishPositioningListChangedEventImpl(createdAt, author, logicalTimePoint, id, competitors, passId, positionedCompetitors);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogFinishPositioningConfirmedEvent createFinishPositioningConfirmedEvent(TimePoint createdAt,
|
||||
RaceLogEventAuthor author, TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, CompetitorResults positionedCompetitors) {
|
||||
AbstractLogEventAuthor author, TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, CompetitorResults positionedCompetitors) {
|
||||
return new RaceLogFinishPositioningConfirmedEventImpl(createdAt, author, logicalTimePoint, id, competitors, passId, positionedCompetitors);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogPathfinderEvent createPathfinderEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
public RaceLogPathfinderEvent createPathfinderEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, String pathfinderId) {
|
||||
return new RaceLogPathfinderEventImpl(createdAt, author, logicalTimePoint, id, competitors, passId, pathfinderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogGateLineOpeningTimeEvent createGateLineOpeningTimeEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
public RaceLogGateLineOpeningTimeEvent createGateLineOpeningTimeEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, Long gateLaunchStopTime,
|
||||
Long golfDownTime) {
|
||||
return new RaceLogGateLineOpeningTimeEventImpl(createdAt, author, logicalTimePoint, id, competitors, passId, gateLaunchStopTime,
|
||||
@@ -114,69 +113,69 @@ public class RaceLogEventRestoreFactoryImpl extends RaceLogEventFactoryImpl impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogStartProcedureChangedEvent createStartProcedureChangedEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
public RaceLogStartProcedureChangedEvent createStartProcedureChangedEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, RacingProcedureType type) {
|
||||
return new RaceLogStartProcedureChangedEventImpl(createdAt, author, logicalTimePoint, id, competitors, passId, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogProtestStartTimeEvent createProtestStartTimeEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
public RaceLogProtestStartTimeEvent createProtestStartTimeEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, TimePoint protestStartTime) {
|
||||
return new RaceLogProtestStartTimeEventImpl(createdAt, author, logicalTimePoint, id, competitors, passId, protestStartTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogWindFixEvent createWindFixEvent(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
public RaceLogWindFixEvent createWindFixEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable id, List<Competitor> competitors, Integer passId, Wind wind) {
|
||||
return new RaceLogWindFixEventImpl(createdAt, author, logicalTimePoint, id, competitors, passId, wind);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceCompetitorMappingEvent createDeviceCompetitorMappingEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
public DeviceCompetitorMappingEvent createDeviceCompetitorMappingEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable pId, DeviceIdentifier device, Competitor mappedTo, int passId, TimePoint from, TimePoint to) {
|
||||
return new DeviceCompetitorMappingEventImpl(createdAt, author, logicalTimePoint, pId, passId, mappedTo, device, from, to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceMarkMappingEvent createDeviceMarkMappingEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
public DeviceMarkMappingEvent createDeviceMarkMappingEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable pId, DeviceIdentifier device, Mark mappedTo, int passId, TimePoint from,
|
||||
TimePoint to) {
|
||||
return new DeviceMarkMappingEventImpl(createdAt, author, logicalTimePoint, pId, passId, mappedTo, device, from, to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DenoteForTrackingEvent createDenoteForTrackingEvent(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
public DenoteForTrackingEvent createDenoteForTrackingEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable pId, int passId, String raceName, BoatClass boatClass, Serializable raceId) {
|
||||
return new DenoteForTrackingEventImpl(createdAt, author, logicalTimePoint, pId, passId, raceName, boatClass, raceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StartTrackingEvent createStartTrackingEvent(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
public StartTrackingEvent createStartTrackingEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, int passId) {
|
||||
return new StartTrackingEventImpl(createdAt, author, logicalTimePoint, pId, passId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RevokeEvent createRevokeEvent(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
public RaceLogRevokeEvent createRevokeEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, int passId, Serializable revokedEventId, String revokedEventType, String revokedEventShortInfo, String reason) {
|
||||
return new RevokeEventImpl(createdAt, author, logicalTimePoint, pId, passId, revokedEventId, revokedEventType, revokedEventShortInfo, reason);
|
||||
return new RaceLogRevokeEventImpl(createdAt, author, logicalTimePoint, pId, passId, revokedEventId, revokedEventType, revokedEventShortInfo, reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegisterCompetitorEvent createRegisterCompetitorEvent(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
public RegisterCompetitorEvent createRegisterCompetitorEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, int passId, Competitor competitor) {
|
||||
return new RegisterCompetitorEventImpl(createdAt, author, logicalTimePoint, pId, passId, competitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefineMarkEvent createDefineMarkEvent(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
public DefineMarkEvent createDefineMarkEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, int passId, Mark mark) {
|
||||
return new DefineMarkEventImpl(createdAt, author, logicalTimePoint, pId, passId, mark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloseOpenEndedDeviceMappingEvent createCloseOpenEndedDeviceMappingEvent(TimePoint createdAt,
|
||||
RaceLogEventAuthor author, TimePoint logicalTimePoint, Serializable pId, int passId,
|
||||
AbstractLogEventAuthor author, TimePoint logicalTimePoint, Serializable pId, int passId,
|
||||
Serializable deviceMappingEventId, TimePoint closingTimePoint) {
|
||||
return new CloseOpenEndedDeviceMappingEventImpl(createdAt, author, logicalTimePoint, pId, passId,
|
||||
deviceMappingEventId, closingTimePoint);
|
||||
@@ -184,7 +183,7 @@ public class RaceLogEventRestoreFactoryImpl extends RaceLogEventFactoryImpl impl
|
||||
|
||||
@Override
|
||||
public AdditionalScoringInformationEvent createAdditionalScoringInformationEvent(TimePoint createdAt,
|
||||
RaceLogEventAuthor author, TimePoint logicalTimePoint, Serializable pId, List<Competitor> competitors, int passId,
|
||||
AbstractLogEventAuthor author, TimePoint logicalTimePoint, Serializable pId, List<Competitor> competitors, int passId,
|
||||
AdditionalScoringInformationType informationType) {
|
||||
return new AdditionalScoringInformationEventImpl(createdAt, author, logicalTimePoint, pId, competitors, passId, informationType);
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.CompetitorResults;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFinishPositioningConfirmedEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
@@ -15,7 +15,7 @@ public class RaceLogFinishPositioningConfirmedEventImpl extends RaceLogFinishPos
|
||||
private static final long serialVersionUID = 5028181339200048499L;
|
||||
|
||||
public RaceLogFinishPositioningConfirmedEventImpl(TimePoint createdAt,
|
||||
RaceLogEventAuthor author, TimePoint pTimePoint, Serializable pId, List<Competitor> pCompetitors, int pPassId, CompetitorResults positionedCompetitors) {
|
||||
AbstractLogEventAuthor author, TimePoint pTimePoint, Serializable pId, List<Competitor> pCompetitors, int pPassId, CompetitorResults positionedCompetitors) {
|
||||
super(createdAt, author, pTimePoint, pId, pCompetitors, pPassId, positionedCompetitors);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.CompetitorResults;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFinishPositioningEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
@@ -15,7 +15,7 @@ public abstract class RaceLogFinishPositioningEventImpl extends RaceLogEventImpl
|
||||
|
||||
private final CompetitorResults positionedCompetitors;
|
||||
|
||||
public RaceLogFinishPositioningEventImpl(TimePoint createdAt, RaceLogEventAuthor author, TimePoint pTimePoint,
|
||||
public RaceLogFinishPositioningEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint pTimePoint,
|
||||
Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, CompetitorResults positionedCompetitors) {
|
||||
super(createdAt, author, pTimePoint, pId, pInvolvedBoats, pPassId);
|
||||
this.positionedCompetitors = positionedCompetitors;
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.CompetitorResults;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFinishPositioningListChangedEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
@@ -15,7 +15,7 @@ public class RaceLogFinishPositioningListChangedEventImpl extends RaceLogFinishP
|
||||
private static final long serialVersionUID = -8167472925561954739L;
|
||||
|
||||
public RaceLogFinishPositioningListChangedEventImpl(TimePoint createdAt,
|
||||
RaceLogEventAuthor author, TimePoint pTimePoint, Serializable pId, List<Competitor> competitors, int pPassId, CompetitorResults positionedCompetitors) {
|
||||
AbstractLogEventAuthor author, TimePoint pTimePoint, Serializable pId, List<Competitor> competitors, int pPassId, CompetitorResults positionedCompetitors) {
|
||||
super(createdAt, author, pTimePoint, pId, competitors, pPassId, positionedCompetitors);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFlagEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
@@ -17,7 +17,7 @@ public class RaceLogFlagEventImpl extends RaceLogEventImpl implements RaceLogFla
|
||||
private final Flags lowerFlag;
|
||||
private final boolean isDisplayed;
|
||||
|
||||
public RaceLogFlagEventImpl(TimePoint createdAt, RaceLogEventAuthor author, TimePoint pTimePoint, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, Flags pUpperFlag, Flags pLowerFlag, boolean pIsDisplayed) {
|
||||
public RaceLogFlagEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint pTimePoint, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, Flags pUpperFlag, Flags pLowerFlag, boolean pIsDisplayed) {
|
||||
super(createdAt, author, pTimePoint, pId, pInvolvedBoats, pPassId);
|
||||
this.upperFlag = pUpperFlag;
|
||||
this.lowerFlag = pLowerFlag;
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogGateLineOpeningTimeEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
@@ -15,7 +15,7 @@ public class RaceLogGateLineOpeningTimeEventImpl extends RaceLogEventImpl implem
|
||||
private final GateLineOpeningTimes gateLineOpeningTimes;
|
||||
|
||||
public RaceLogGateLineOpeningTimeEventImpl(TimePoint createdAt,
|
||||
RaceLogEventAuthor author, TimePoint pTimePoint, Serializable pId, List<Competitor> pCompetitors, int pPassId,
|
||||
AbstractLogEventAuthor author, TimePoint pTimePoint, Serializable pId, List<Competitor> pCompetitors, int pPassId,
|
||||
long gateLaunchStopTime, long golfDownTime) {
|
||||
super(createdAt, author, pTimePoint, pId, pCompetitors, pPassId);
|
||||
this.gateLineOpeningTimes = new GateLineOpeningTimes(gateLaunchStopTime, golfDownTime);
|
||||
|
||||
+64
-3
@@ -1,11 +1,17 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.NavigableSet;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.impl.AbstractLogImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.tracking.Track;
|
||||
import com.sap.sailing.domain.tracking.impl.PartialNavigableSetView;
|
||||
import com.sap.sailing.domain.tracking.impl.TrackImpl;
|
||||
|
||||
/**
|
||||
@@ -22,15 +28,70 @@ import com.sap.sailing.domain.tracking.impl.TrackImpl;
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public class RaceLogImpl extends AbstractLogImpl<RaceLogEvent> implements RaceLog {
|
||||
public class RaceLogImpl extends AbstractLogImpl<RaceLogEvent, RaceLogEventVisitor> implements RaceLog {
|
||||
private final static Logger logger = Logger.getLogger(RaceLogImpl.class.getName());
|
||||
|
||||
private static final long serialVersionUID = 98032278604708475L;
|
||||
private int currentPassId;
|
||||
|
||||
public RaceLogImpl(Serializable identifier) {
|
||||
super(identifier);
|
||||
super(identifier, new RaceLogEventComparator());
|
||||
this.currentPassId = DefaultPassId;
|
||||
}
|
||||
|
||||
public RaceLogImpl(String nameForReadWriteLock, Serializable identifier) {
|
||||
super(nameForReadWriteLock, identifier);
|
||||
super(nameForReadWriteLock, identifier, new RaceLogEventComparator());
|
||||
this.currentPassId = DefaultPassId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentPassId() {
|
||||
return currentPassId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a new active pass id. Ignored if new and current are equal.
|
||||
*
|
||||
* @param newPassId
|
||||
* to be set.
|
||||
*/
|
||||
public void setCurrentPassId(int newPassId) {
|
||||
if (newPassId != this.currentPassId) {
|
||||
logger.finer(String.format("Changing pass id to %d", newPassId));
|
||||
this.currentPassId = newPassId;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(RaceLogEvent event) {
|
||||
boolean isAdded = super.add(event);
|
||||
if (isAdded) {
|
||||
setCurrentPassId(Math.max(event.getPassId(), this.currentPassId));
|
||||
}
|
||||
return isAdded;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean load(RaceLogEvent event) {
|
||||
boolean isAdded = super.load(event);
|
||||
if (isAdded) {
|
||||
setCurrentPassId(Math.max(event.getPassId(), this.currentPassId));
|
||||
}
|
||||
return isAdded;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RaceLogEvent createRevokeEvent(AbstractLogEventAuthor author, RaceLogEvent toRevoke, String reason) {
|
||||
return RaceLogEventFactory.INSTANCE.createRevokeEvent(author, getCurrentPassId(), toRevoke, reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NavigableSet<RaceLogEvent> getInternalFixes() {
|
||||
return new PartialNavigableSetView<RaceLogEvent>(super.getInternalFixes()) {
|
||||
@Override
|
||||
protected boolean isValid(RaceLogEvent e) {
|
||||
return e.getPassId() == getCurrentPassId();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogPassChangeEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
@@ -12,7 +12,7 @@ import com.sap.sailing.domain.common.TimePoint;
|
||||
public class RaceLogPassChangeEventImpl extends RaceLogEventImpl implements RaceLogPassChangeEvent {
|
||||
private static final long serialVersionUID = -3737606977320640630L;
|
||||
|
||||
public RaceLogPassChangeEventImpl(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
public RaceLogPassChangeEventImpl(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint pTimePoint, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId) {
|
||||
super(createdAt, author, pTimePoint, pId, pInvolvedBoats, pPassId);
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogPathfinderEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
@@ -15,7 +15,7 @@ public class RaceLogPathfinderEventImpl extends RaceLogEventImpl implements Race
|
||||
private final String pathfinderId;
|
||||
|
||||
public RaceLogPathfinderEventImpl(TimePoint createdAt,
|
||||
RaceLogEventAuthor author, TimePoint pTimePoint, Serializable pId, List<Competitor> pCompetitors, int pPassId, String pathfinderId) {
|
||||
AbstractLogEventAuthor author, TimePoint pTimePoint, Serializable pId, List<Competitor> pCompetitors, int pPassId, String pathfinderId) {
|
||||
super(createdAt, author, pTimePoint, pId, pCompetitors, pPassId);
|
||||
this.pathfinderId = pathfinderId;
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogProtestStartTimeEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
@@ -14,7 +14,7 @@ public class RaceLogProtestStartTimeEventImpl extends RaceLogEventImpl implement
|
||||
|
||||
private final TimePoint protestStartTime;
|
||||
|
||||
public RaceLogProtestStartTimeEventImpl(TimePoint createdAt, RaceLogEventAuthor author, TimePoint pTimePoint,
|
||||
public RaceLogProtestStartTimeEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint pTimePoint,
|
||||
Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, TimePoint protestStartTime) {
|
||||
super(createdAt, author, pTimePoint, pId, pInvolvedBoats, pPassId);
|
||||
this.protestStartTime = protestStartTime;
|
||||
|
||||
+2
-2
@@ -3,12 +3,12 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRaceStatusEvent;
|
||||
|
||||
/**
|
||||
* Comparator sorting by pass, then by state order number, then by {@link RaceLogEventAuthor}, then by {@link RaceLogEvent#getCreatedAt()} timestamp.
|
||||
* Comparator sorting by pass, then by state order number, then by {@link AbstractLogEventAuthor}, then by {@link RaceLogEvent#getCreatedAt()} timestamp.
|
||||
*/
|
||||
public enum RaceLogRaceStatusEventComparator implements Comparator<RaceLogRaceStatusEvent>, Serializable {
|
||||
INSTANCE;
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRaceStatusEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
@@ -15,7 +15,7 @@ public class RaceLogRaceStatusEventImpl extends RaceLogEventImpl implements Race
|
||||
|
||||
private final RaceLogRaceStatus nextStatus;
|
||||
|
||||
public RaceLogRaceStatusEventImpl(TimePoint createdAt, RaceLogEventAuthor author, TimePoint pTimePoint,
|
||||
public RaceLogRaceStatusEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint pTimePoint,
|
||||
Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, RaceLogRaceStatus nextStatus) {
|
||||
super(createdAt, author, pTimePoint, pId, pInvolvedBoats, pPassId);
|
||||
this.nextStatus = nextStatus;
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.impl.RevokeEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRevokeEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
|
||||
public class RaceLogRevokeEventImpl extends RevokeEventImpl<RaceLogEventVisitor> implements RaceLogRevokeEvent {
|
||||
private final int passId;
|
||||
|
||||
public RaceLogRevokeEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, int passId, Serializable revokedEventId, String revokedEventType, String revokedEventShortInfo,
|
||||
String reason) {
|
||||
super(createdAt, author, logicalTimePoint, pId, revokedEventId, revokedEventType, revokedEventShortInfo, reason);
|
||||
this.passId = passId;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1886722815573499311L;
|
||||
|
||||
@Override
|
||||
public int getPassId() {
|
||||
return passId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Competitor> getInvolvedBoats() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartProcedureChangedEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
@@ -17,7 +17,7 @@ public class RaceLogStartProcedureChangedEventImpl extends RaceLogEventImpl impl
|
||||
|
||||
private final RacingProcedureType startProcedureType;
|
||||
|
||||
public RaceLogStartProcedureChangedEventImpl(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
public RaceLogStartProcedureChangedEventImpl(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint pTimePoint, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, RacingProcedureType startProcedureType) {
|
||||
super(createdAt, author, pTimePoint, pId, pInvolvedBoats, pPassId);
|
||||
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
@@ -15,7 +15,7 @@ public class RaceLogStartTimeEventImpl extends RaceLogRaceStatusEventImpl implem
|
||||
private static final long serialVersionUID = 8185811395997196162L;
|
||||
private final TimePoint startTime;
|
||||
|
||||
public RaceLogStartTimeEventImpl(TimePoint createdAt, RaceLogEventAuthor author, TimePoint pTimePoint,
|
||||
public RaceLogStartTimeEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint pTimePoint,
|
||||
Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, TimePoint pStartTime) {
|
||||
super(createdAt, author, pTimePoint, pId, pInvolvedBoats, pPassId, RaceLogRaceStatus.SCHEDULED);
|
||||
this.startTime = pStartTime;
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogWindFixEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
@@ -15,7 +15,7 @@ public class RaceLogWindFixEventImpl extends RaceLogEventImpl implements RaceLog
|
||||
|
||||
private final Wind windFix;
|
||||
|
||||
public RaceLogWindFixEventImpl(TimePoint createdAt, RaceLogEventAuthor author, TimePoint pTimePoint,
|
||||
public RaceLogWindFixEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint pTimePoint,
|
||||
Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, Wind windFix) {
|
||||
super(createdAt, author, pTimePoint, pId, pInvolvedBoats, pPassId);
|
||||
this.windFix = windFix;
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.scoring;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.InvalidatesLeaderboardCache;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.Revokable;
|
||||
|
||||
/**
|
||||
* Event that could possibly overwrite scoring for a leaderboard column. The idea
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.domain.abstractlog.race.scoring.impl;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.AdditionalScoringInformationEvent;
|
||||
@@ -16,7 +16,7 @@ public class AdditionalScoringInformationEventImpl extends RaceLogEventImpl impl
|
||||
|
||||
private final AdditionalScoringInformationType informationType;
|
||||
|
||||
public AdditionalScoringInformationEventImpl(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
public AdditionalScoringInformationEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, List<Competitor> competitors, int pPassId, AdditionalScoringInformationType informationType) {
|
||||
super(createdAt, author, logicalTimePoint, pId, competitors, pPassId);
|
||||
this.informationType = informationType;
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.state;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.CompetitorResults;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.AdditionalScoringInformationEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.AdditionalScoringInformationType;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.racingprocedure.RacingProcedure;
|
||||
@@ -29,9 +29,9 @@ import com.sap.sailing.domain.tracking.Wind;
|
||||
public interface RaceState extends ReadonlyRaceState {
|
||||
|
||||
/**
|
||||
* Gets the {@link RaceLogEventAuthor} that is used for all created {@link RaceLogEvent}s.
|
||||
* Gets the {@link AbstractLogEventAuthor} that is used for all created {@link RaceLogEvent}s.
|
||||
*/
|
||||
RaceLogEventAuthor getAuthor();
|
||||
AbstractLogEventAuthor getAuthor();
|
||||
|
||||
/**
|
||||
* Gets the currently attached {@link RacingProcedure}.
|
||||
|
||||
+16
-9
@@ -1,10 +1,12 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.state.impl;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.CompetitorResults;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.AdditionalScoringInformationFinder;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.RaceStatusAnalyzer;
|
||||
@@ -15,7 +17,6 @@ import com.sap.sailing.domain.abstractlog.race.state.racingprocedure.RacingProce
|
||||
import com.sap.sailing.domain.abstractlog.race.state.racingprocedure.RacingProcedureFactory;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.racingprocedure.RacingProcedurePrerequisite;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.racingprocedure.impl.RacingProcedureFactoryImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.events.RevokeEventImpl;
|
||||
import com.sap.sailing.domain.base.CourseBase;
|
||||
import com.sap.sailing.domain.base.configuration.ConfigurationLoader;
|
||||
import com.sap.sailing.domain.base.configuration.RegattaConfiguration;
|
||||
@@ -24,38 +25,40 @@ import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.racelog.Flags;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sailing.domain.common.racelog.RacingProcedureType;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.NotRevokableException;
|
||||
import com.sap.sailing.domain.tracking.Wind;
|
||||
|
||||
/**
|
||||
* Write-enabled {@link RaceState}.
|
||||
*/
|
||||
public class RaceStateImpl extends ReadonlyRaceStateImpl implements RaceState {
|
||||
private static final Logger logger = Logger.getLogger(RaceStateImpl.class.getName());
|
||||
|
||||
private final RaceLogEventAuthor author;
|
||||
private final AbstractLogEventAuthor author;
|
||||
private final RaceLogEventFactory factory;
|
||||
|
||||
/**
|
||||
* Creates a {@link RaceState} with the initial racing procedure type set to a fallback value and an empty configuration.
|
||||
*/
|
||||
public static RaceState create(RaceLog raceLog, RaceLogEventAuthor author) {
|
||||
public static RaceState create(RaceLog raceLog, AbstractLogEventAuthor author) {
|
||||
return create(raceLog, author, new EmptyRegattaConfiguration());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link RaceState}.
|
||||
*/
|
||||
public static RaceState create(RaceLog raceLog, RaceLogEventAuthor author, ConfigurationLoader<RegattaConfiguration> configuration) {
|
||||
public static RaceState create(RaceLog raceLog, AbstractLogEventAuthor author, ConfigurationLoader<RegattaConfiguration> configuration) {
|
||||
return new RaceStateImpl(raceLog, author,
|
||||
RaceLogEventFactory.INSTANCE,
|
||||
new RacingProcedureFactoryImpl(author, RaceLogEventFactory.INSTANCE, configuration));
|
||||
}
|
||||
|
||||
public RaceStateImpl(RaceLog raceLog, RaceLogEventAuthor author, RaceLogEventFactory eventFactory,
|
||||
public RaceStateImpl(RaceLog raceLog, AbstractLogEventAuthor author, RaceLogEventFactory eventFactory,
|
||||
RacingProcedureFactory procedureFactory) {
|
||||
this(raceLog, author, eventFactory, new RaceStatusAnalyzer.StandardClock(), procedureFactory);
|
||||
}
|
||||
|
||||
private RaceStateImpl(RaceLog raceLog, RaceLogEventAuthor author, RaceLogEventFactory eventFactory, RaceStatusAnalyzer.Clock analyzersClock,
|
||||
private RaceStateImpl(RaceLog raceLog, AbstractLogEventAuthor author, RaceLogEventFactory eventFactory, RaceStatusAnalyzer.Clock analyzersClock,
|
||||
RacingProcedureFactory procedureFactory) {
|
||||
super(raceLog, analyzersClock, procedureFactory, /* update */ true);
|
||||
this.author = author;
|
||||
@@ -85,7 +88,7 @@ public class RaceStateImpl extends ReadonlyRaceStateImpl implements RaceState {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogEventAuthor getAuthor() {
|
||||
public AbstractLogEventAuthor getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
@@ -174,7 +177,11 @@ public class RaceStateImpl extends ReadonlyRaceStateImpl implements RaceState {
|
||||
} else {
|
||||
if (event != null) {
|
||||
// revoke the newest one
|
||||
raceLog.add(RevokeEventImpl.create(raceLog, author, event));
|
||||
try {
|
||||
raceLog.revokeEvent(author, event, "disable additional scoring information");
|
||||
} catch (NotRevokableException e) {
|
||||
logger.log(Level.WARNING, "Could not disable scoring information by adding RevokeEvent", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.RaceStateEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.impl.RaceStateEventImpl;
|
||||
@@ -24,7 +24,7 @@ import com.sap.sailing.domain.common.racelog.RacingProcedureType;
|
||||
|
||||
public class BasicRacingProcedureImpl extends BaseRacingProcedure {
|
||||
|
||||
public BasicRacingProcedureImpl(RaceLog raceLog, RaceLogEventAuthor author, RaceLogEventFactory factory,
|
||||
public BasicRacingProcedureImpl(RaceLog raceLog, AbstractLogEventAuthor author, RaceLogEventFactory factory,
|
||||
RacingProcedureConfiguration configuration) {
|
||||
super(raceLog, author, factory, configuration);
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.FinishingTimeFinder;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.RaceStateEvent;
|
||||
@@ -36,7 +36,7 @@ public class ESSRacingProcedureImpl extends BaseRacingProcedure implements ESSRa
|
||||
@SuppressWarnings("unused")
|
||||
private final ESSConfiguration configuration;
|
||||
|
||||
public ESSRacingProcedureImpl(RaceLog raceLog, RaceLogEventAuthor author,
|
||||
public ESSRacingProcedureImpl(RaceLog raceLog, AbstractLogEventAuthor author,
|
||||
RaceLogEventFactory factory, ESSConfiguration configuration) {
|
||||
super(raceLog, author, factory, configuration);
|
||||
this.configuration = configuration;
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@ package com.sap.sailing.domain.abstractlog.race.state.racingprocedure.gate.impl;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogGateLineOpeningTimeEvent.GateLineOpeningTimes;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.GateLineOpeningTimeFinder;
|
||||
@@ -42,7 +42,7 @@ public class GateStartRacingProcedureImpl extends BaseRacingProcedure implements
|
||||
private boolean gateLineOpeningTimesHasBeenSet;
|
||||
private String cachedPathfinder;
|
||||
|
||||
public GateStartRacingProcedureImpl(RaceLog raceLog, RaceLogEventAuthor author, RaceLogEventFactory factory,
|
||||
public GateStartRacingProcedureImpl(RaceLog raceLog, AbstractLogEventAuthor author, RaceLogEventFactory factory,
|
||||
GateStartConfiguration configuration) {
|
||||
super(raceLog, author, factory, configuration);
|
||||
this.gateLineOpeningTimeAnalyzer = new GateLineOpeningTimeFinder(raceLog);
|
||||
|
||||
+3
-3
@@ -3,10 +3,10 @@ package com.sap.sailing.domain.abstractlog.race.state.racingprocedure.impl;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogChangedListener;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.FinishedTimeFinder;
|
||||
@@ -44,7 +44,7 @@ public abstract class BaseRacingProcedure extends BaseRaceStateChangedListener i
|
||||
private RaceStateEventScheduler scheduler;
|
||||
|
||||
protected final RaceLog raceLog;
|
||||
protected final RaceLogEventAuthor author;
|
||||
protected final AbstractLogEventAuthor author;
|
||||
protected final RaceLogEventFactory factory;
|
||||
private final RacingProcedureConfiguration configuration;
|
||||
|
||||
@@ -61,7 +61,7 @@ public abstract class BaseRacingProcedure extends BaseRaceStateChangedListener i
|
||||
/**
|
||||
* When calling me, call {@link BaseRacingProcedure#update()} afterwards!
|
||||
*/
|
||||
public BaseRacingProcedure(RaceLog raceLog, RaceLogEventAuthor author, RaceLogEventFactory factory,
|
||||
public BaseRacingProcedure(RaceLog raceLog, AbstractLogEventAuthor author, RaceLogEventFactory factory,
|
||||
RacingProcedureConfiguration configuration) {
|
||||
if (configuration == null) {
|
||||
throw new IllegalArgumentException("configuration must not be null");
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.state.racingprocedure.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.racingprocedure.RacingProcedureFactory;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.racingprocedure.ReadonlyRacingProcedure;
|
||||
@@ -11,10 +11,10 @@ import com.sap.sailing.domain.common.racelog.RacingProcedureType;
|
||||
|
||||
public class RacingProcedureFactoryImpl extends ReadonlyRacingProcedureFactory implements RacingProcedureFactory {
|
||||
|
||||
private final RaceLogEventAuthor author;
|
||||
private final AbstractLogEventAuthor author;
|
||||
private final RaceLogEventFactory factory;
|
||||
|
||||
public RacingProcedureFactoryImpl(RaceLogEventAuthor author, RaceLogEventFactory factory,
|
||||
public RacingProcedureFactoryImpl(AbstractLogEventAuthor author, RaceLogEventFactory factory,
|
||||
ConfigurationLoader<RegattaConfiguration> configuration) {
|
||||
super(configuration);
|
||||
this.author = author;
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.state.racingprocedure.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.NoAddingRaceLogWrapper;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventAuthorImpl;
|
||||
@@ -36,7 +36,7 @@ public class ReadonlyRacingProcedureFactory implements RacingProcedureFactory {
|
||||
}
|
||||
|
||||
protected ReadonlyRacingProcedure createProcedure(RacingProcedureType type, RaceLog raceLog,
|
||||
RaceLogEventAuthor author, RaceLogEventFactory factory) {
|
||||
AbstractLogEventAuthor author, RaceLogEventFactory factory) {
|
||||
RegattaConfiguration loadedConfiguration = configuration.load();
|
||||
switch (type) {
|
||||
case ESS:
|
||||
@@ -56,7 +56,7 @@ public class ReadonlyRacingProcedureFactory implements RacingProcedureFactory {
|
||||
@Override
|
||||
public ReadonlyRacingProcedure createRacingProcedure(RacingProcedureType type, RaceLog raceLog) {
|
||||
// Just a mock author since we will never add anything to the racelog
|
||||
RaceLogEventAuthor author = new RaceLogEventAuthorImpl("Illegal Author", 128);
|
||||
AbstractLogEventAuthor author = new RaceLogEventAuthorImpl("Illegal Author", 128);
|
||||
// Wrap the racelog to disable adding...
|
||||
RaceLog wrappedRaceLog = new NoAddingRaceLogWrapper(raceLog);
|
||||
return createProcedure(type, wrappedRaceLog, author, RaceLogEventFactory.INSTANCE);
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.RRS26StartModeFlagFinder;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.RacingProcedureTypeAnalyzer;
|
||||
@@ -38,7 +38,7 @@ public class RRS26RacingProcedureImpl extends BaseRacingProcedure implements RRS
|
||||
private Flags cachedStartmodeFlag;
|
||||
private boolean startmodeFlagHasBeenSet;
|
||||
|
||||
public RRS26RacingProcedureImpl(RaceLog raceLog, RaceLogEventAuthor author,
|
||||
public RRS26RacingProcedureImpl(RaceLog raceLog, AbstractLogEventAuthor author,
|
||||
RaceLogEventFactory factory, RRS26Configuration configuration) {
|
||||
super(raceLog, author, factory, configuration);
|
||||
|
||||
|
||||
+1
-1
@@ -2,8 +2,8 @@ package com.sap.sailing.domain.abstractlog.race.tracking;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.Revokable;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.Revokable;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -2,9 +2,9 @@ package com.sap.sailing.domain.abstractlog.race.tracking;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.Revokable;
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl.DefinedMarkFinder;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.Revokable;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.IsManagedBySharedDomainFactory;
|
||||
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.events.DeviceCompetitorMappingEventImpl;
|
||||
|
||||
/**
|
||||
|
||||
+3
-3
@@ -4,8 +4,8 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.RaceLogAnalyzer;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.CloseOpenEndedDeviceMappingEvent;
|
||||
@@ -22,10 +22,10 @@ import com.sap.sailing.domain.common.impl.MillisecondsTimePoint;
|
||||
*/
|
||||
public class OpenEndedDeviceMappingCloser extends RaceLogAnalyzer<List<CloseOpenEndedDeviceMappingEvent>> {
|
||||
private final DeviceMapping<?> mapping;
|
||||
private final RaceLogEventAuthor author;
|
||||
private final AbstractLogEventAuthor author;
|
||||
private final TimePoint closingTimePoint;
|
||||
|
||||
public OpenEndedDeviceMappingCloser(RaceLog raceLog, DeviceMapping<?> mapping, RaceLogEventAuthor author,
|
||||
public OpenEndedDeviceMappingCloser(RaceLog raceLog, DeviceMapping<?> mapping, AbstractLogEventAuthor author,
|
||||
TimePoint closingTimePoint) {
|
||||
super(raceLog);
|
||||
this.mapping = mapping;
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.domain.abstractlog.race.tracking.events;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DeviceIdentifier;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DeviceMappingEvent;
|
||||
@@ -20,7 +20,7 @@ DeviceMappingEvent<ItemType> {
|
||||
private final TimePoint from;
|
||||
private final TimePoint to;
|
||||
|
||||
public AbstractDeviceMappingEventImpl(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
public AbstractDeviceMappingEventImpl(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable pId, int pPassId, ItemType mappedTo,
|
||||
DeviceIdentifier device, TimePoint from, TimePoint to) {
|
||||
super(createdAt, author, logicalTimePoint, pId, Collections.<Competitor>emptyList(), pPassId);
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.domain.abstractlog.race.tracking.events;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.CloseOpenEndedDeviceMappingEvent;
|
||||
@@ -16,7 +16,7 @@ public class CloseOpenEndedDeviceMappingEventImpl extends RaceLogEventImpl imple
|
||||
private final Serializable deviceMappingEventId;
|
||||
private final TimePoint closingTimePoint;
|
||||
|
||||
public CloseOpenEndedDeviceMappingEventImpl(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
public CloseOpenEndedDeviceMappingEventImpl(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable pId, int pPassId,
|
||||
Serializable deviceMappingEventId, TimePoint closingTimePoint) {
|
||||
super(createdAt, author, logicalTimePoint, pId, Collections.<Competitor>emptyList(), pPassId);
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.domain.abstractlog.race.tracking.events;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DefineMarkEvent;
|
||||
@@ -16,7 +16,7 @@ public class DefineMarkEventImpl extends RaceLogEventImpl implements DefineMarkE
|
||||
|
||||
private final Mark mark;
|
||||
|
||||
public DefineMarkEventImpl(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
public DefineMarkEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, int pPassId, Mark mark) {
|
||||
super(createdAt, author, logicalTimePoint, pId, Collections.<Competitor>emptyList(), pPassId);
|
||||
this.mark = mark;
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.domain.abstractlog.race.tracking.events;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DenoteForTrackingEvent;
|
||||
@@ -20,7 +20,7 @@ DenoteForTrackingEvent {
|
||||
private final Serializable raceId;
|
||||
|
||||
public DenoteForTrackingEventImpl(TimePoint createdAt,
|
||||
RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, int pPassId,
|
||||
String raceName, BoatClass boatClass, Serializable raceId) {
|
||||
super(createdAt, author, logicalTimePoint, pId, Collections.<Competitor>emptyList(), pPassId);
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package com.sap.sailing.domain.abstractlog.race.tracking.events;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DeviceCompetitorMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DeviceIdentifier;
|
||||
@@ -11,7 +11,7 @@ import com.sap.sailing.domain.common.TimePoint;
|
||||
|
||||
public class DeviceCompetitorMappingEventImpl extends AbstractDeviceMappingEventImpl<Competitor>
|
||||
implements DeviceCompetitorMappingEvent {
|
||||
public DeviceCompetitorMappingEventImpl(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
public DeviceCompetitorMappingEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, int pPassId, Competitor mappedTo, DeviceIdentifier device, TimePoint from, TimePoint to) {
|
||||
super(createdAt, author, logicalTimePoint, pId, pPassId, mappedTo, device, from, to);
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package com.sap.sailing.domain.abstractlog.race.tracking.events;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DeviceIdentifier;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DeviceMarkMappingEvent;
|
||||
@@ -11,7 +11,7 @@ import com.sap.sailing.domain.common.TimePoint;
|
||||
|
||||
public class DeviceMarkMappingEventImpl extends AbstractDeviceMappingEventImpl<Mark>
|
||||
implements DeviceMarkMappingEvent {
|
||||
public DeviceMarkMappingEventImpl(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
public DeviceMarkMappingEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, int pPassId, Mark mappedTo, DeviceIdentifier device, TimePoint from, TimePoint to) {
|
||||
super(createdAt, author, logicalTimePoint, pId, pPassId, mappedTo, device, from, to);
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.domain.abstractlog.race.tracking.events;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RegisterCompetitorEvent;
|
||||
@@ -13,7 +13,7 @@ import com.sap.sailing.domain.common.TimePoint;
|
||||
public class RegisterCompetitorEventImpl extends RaceLogEventImpl implements RegisterCompetitorEvent {
|
||||
private static final long serialVersionUID = -30864810737555657L;
|
||||
|
||||
public RegisterCompetitorEventImpl(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
public RegisterCompetitorEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, int pPassId, Competitor competitor) {
|
||||
super(createdAt, author, logicalTimePoint, pId, Collections.singletonList(competitor), pPassId);
|
||||
}
|
||||
|
||||
-78
@@ -1,78 +0,0 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking.events;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLog;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RevokeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventImpl;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.impl.MillisecondsTimePoint;
|
||||
|
||||
public class RevokeEventImpl extends RaceLogEventImpl implements RevokeEvent {
|
||||
private static final long serialVersionUID = -30864810737555657L;
|
||||
|
||||
private final Serializable revokedEventId;
|
||||
private final String reason;
|
||||
private final String revokedEventType;
|
||||
private final String revokedEventShortInfo;
|
||||
|
||||
public RevokeEventImpl(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, int pPassId, Serializable revokedEventId, String revokedEventType,
|
||||
String revokedEventShortInfo, String reason) {
|
||||
super(createdAt, author, logicalTimePoint, pId, Collections.<Competitor>emptyList(), pPassId);
|
||||
this.revokedEventId = revokedEventId;
|
||||
this.reason = reason;
|
||||
this.revokedEventType = revokedEventType;
|
||||
this.revokedEventShortInfo = revokedEventShortInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getRevokedEventId() {
|
||||
return revokedEventId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
if (revokedEventShortInfo == null) {
|
||||
return "No event revoked";
|
||||
} else {
|
||||
return "Revoked " + revokedEventType + "(" + revokedEventShortInfo + ")"
|
||||
+ reason == null ? "" : (" due to " + reason);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRevokedEventType() {
|
||||
return revokedEventType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRevokedEventShortInfo() {
|
||||
return revokedEventShortInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public static RevokeEvent create(AbstractLog<?> log, RaceLogEventAuthor author, AbstractLogEvent toRevoke, String reason) {
|
||||
return new RevokeEventImpl(MillisecondsTimePoint.now(), author, MillisecondsTimePoint.now(), UUID.randomUUID(),
|
||||
log.getCurrentPassId(), toRevoke.getId(), toRevoke.getClass().getName(), toRevoke.getShortInfo(), reason);
|
||||
}
|
||||
|
||||
public static RevokeEvent create(AbstractLog<?> log, RaceLogEventAuthor author, AbstractLogEvent toRevoke) {
|
||||
return create(log, author, toRevoke, null);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.domain.abstractlog.race.tracking.events;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.StartTrackingEvent;
|
||||
@@ -14,7 +14,7 @@ public class StartTrackingEventImpl extends RaceLogEventImpl implements
|
||||
StartTrackingEvent {
|
||||
private static final long serialVersionUID = 6017954368580125221L;
|
||||
|
||||
public StartTrackingEventImpl(TimePoint createdAt, RaceLogEventAuthor author,
|
||||
public StartTrackingEventImpl(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable pId, int pPassId) {
|
||||
super(createdAt, author, logicalTimePoint, pId, Collections.<Competitor>emptyList(), pPassId);
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,6 +16,6 @@ import com.sap.sailing.domain.tracking.Track;
|
||||
* Implementations should use the {@link RegattaLogEventComparator} for sorting its content.
|
||||
* </p>
|
||||
*/
|
||||
public interface RegattaLog extends AbstractLog<RegattaLogEvent>, WithID {
|
||||
public interface RegattaLog extends AbstractLog<RegattaLogEvent, RegattaLogEventVisitor>, WithID {
|
||||
|
||||
}
|
||||
+1
-44
@@ -1,50 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.base.Timed;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* A {@link RegattaLogEvent} is an entry in a race's log (typically a {@link RaceLog}.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Such an entry may influence the state of a race (scheduled, started, finished, ...), contain information about the
|
||||
* current displayed flags (AP, N, X, P, etc.) of a race or indicate some other change regarding the race. See
|
||||
* subclasses of {@link RegattaLogEvent} for a full list of possibilities.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* A {@link RegattaLogEvent} may be associated to a certain pass. For a race a new pass is initiated whenever a new start
|
||||
* time is proposed (e.g. after the race was aborted).
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Each {@link RegattaLogEvent} carries two timestamps.
|
||||
*
|
||||
* The timestamp received with {@link RegattaLogEvent#getCreatedAt()} denotes the point in time the event was created.
|
||||
*
|
||||
* The timestamp received with {@link RegattaLogEvent#getLogicalTimePoint()} denotes the logical point in time the event
|
||||
* has occurred (sometimes called 'event time'). This timestamp might be different from
|
||||
* {@link RegattaLogEvent#getCreatedAt()}. For example setting the start time of race to a point in time in the past,
|
||||
* results in a {@link RegattaLogEvent} returning "now" on {@link RegattaLogEvent#getCreatedAt()} and such a point in time
|
||||
* that a complete startphase could have occured on {@link RegattaLogEvent#getTimePoint()}.
|
||||
*
|
||||
* To ensure an ordering there should be no two {@link RegattaLogEvent}s returning the same point in time on
|
||||
* {@link RegattaLogEvent#getCreatedAt()} <b>per pass</b>.
|
||||
*
|
||||
* The {@link RegattaLogEvent}'s {@link Timed} interface redirects to {@link RegattaLogEvent#getCreatedAt()} (was
|
||||
* {@link RegattaLogEvent#getLogicalTimePoint()}!).
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Race log events have an author that has a name and a priority assigned. This can be used to represent multiple
|
||||
* concurrent race log authors such as a device used on a starting vessel, another device used at the finish line and
|
||||
* yet another device used on shore. In case more than one device make a statement about something, such as the start
|
||||
* time or the start procedure, the statement from the device with the highest priority needs to take precedence.
|
||||
* </p>
|
||||
*/
|
||||
public interface RegattaLogEvent extends AbstractLogEvent {
|
||||
public interface RegattaLogEvent extends AbstractLogEvent<RegattaLogEventVisitor> {
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.impl.RegattaLogEventFactoryImpl;
|
||||
|
||||
public interface RegattaLogEventFactory {
|
||||
RegattaLogEventFactory INSTANCE = new RegattaLogEventFactoryImpl();
|
||||
|
||||
RegattaLogRevokeEvent createRevokeEvent(AbstractLogEventAuthor author, RegattaLogEvent toRevoke, String reason);
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.impl.RegattaLogEventRestoreFactoryImpl;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
|
||||
public interface RegattaLogEventRestoreFactory extends RegattaLogEventFactory {
|
||||
RegattaLogEventRestoreFactory INSTANCE = new RegattaLogEventRestoreFactoryImpl();
|
||||
|
||||
RegattaLogRevokeEvent createRevokeEvent(TimePoint createdAt, AbstractLogEventAuthor author,
|
||||
TimePoint logicalTimePoint, Serializable pId, Serializable revokedEventId,
|
||||
String revokedEventType, String revokedEventShortInfo, String reason);
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta;
|
||||
|
||||
|
||||
|
||||
public interface RegattaLogEventVisitor {
|
||||
void visit(RegattaLogRevokeEvent event);
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.RevokeEvent;
|
||||
|
||||
public interface RegattaLogRevokeEvent extends RevokeEvent<RegattaLogEventVisitor>, RegattaLogEvent {
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.impl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventFactory;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogRevokeEvent;
|
||||
import com.sap.sailing.domain.common.impl.MillisecondsTimePoint;
|
||||
|
||||
public class RegattaLogEventFactoryImpl implements RegattaLogEventFactory {
|
||||
|
||||
@Override
|
||||
public RegattaLogRevokeEvent createRevokeEvent(AbstractLogEventAuthor author, RegattaLogEvent toRevoke, String reason) {
|
||||
return new RegattaLogRevokeEventImpl(MillisecondsTimePoint.now(), author, MillisecondsTimePoint.now(),
|
||||
UUID.randomUUID(), toRevoke.getId(), toRevoke.getClass().getName(), toRevoke.getShortInfo(), reason);
|
||||
}
|
||||
}
|
||||
+6
-7
@@ -1,20 +1,19 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.impl.AbstractLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
|
||||
public abstract class RegattaLogEventImpl extends AbstractLogEventImpl implements RegattaLogEvent {
|
||||
public abstract class RegattaLogEventImpl extends AbstractLogEventImpl<RegattaLogEventVisitor> implements RegattaLogEvent {
|
||||
|
||||
private static final long serialVersionUID = -2557594972618769182L;
|
||||
|
||||
public RegattaLogEventImpl(TimePoint createdAt, RaceLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, List<Competitor> pInvolvedBoats, int pPassId) {
|
||||
super(createdAt, author, logicalTimePoint, pId, pInvolvedBoats, pPassId);
|
||||
public RegattaLogEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId) {
|
||||
super(createdAt, author, logicalTimePoint, pId);
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventRestoreFactory;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogRevokeEvent;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
|
||||
public class RegattaLogEventRestoreFactoryImpl extends RegattaLogEventFactoryImpl implements RegattaLogEventRestoreFactory {
|
||||
@Override
|
||||
public RegattaLogRevokeEvent createRevokeEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, Serializable revokedEventId, String revokedEventType, String revokedEventShortInfo, String reason) {
|
||||
return new RegattaLogRevokeEventImpl(createdAt, author, logicalTimePoint, pId, revokedEventId, revokedEventType, revokedEventShortInfo, reason);
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -2,11 +2,15 @@ package com.sap.sailing.domain.abstractlog.regatta.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.impl.AbstractLogEventComparator;
|
||||
import com.sap.sailing.domain.abstractlog.impl.AbstractLogImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventComparator;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventFactory;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
import com.sap.sailing.domain.tracking.Track;
|
||||
import com.sap.sailing.domain.tracking.impl.TrackImpl;
|
||||
|
||||
@@ -24,15 +28,20 @@ import com.sap.sailing.domain.tracking.impl.TrackImpl;
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public class RegattaLogImpl extends AbstractLogImpl<RegattaLogEvent> implements RegattaLog {
|
||||
public class RegattaLogImpl extends AbstractLogImpl<RegattaLogEvent, RegattaLogEventVisitor> implements RegattaLog {
|
||||
|
||||
private static final long serialVersionUID = 98032278604708475L;
|
||||
|
||||
public RegattaLogImpl(Serializable identifier) {
|
||||
super(identifier);
|
||||
super(identifier, new AbstractLogEventComparator());
|
||||
}
|
||||
|
||||
public RegattaLogImpl(String nameForReadWriteLock, Serializable identifier) {
|
||||
super(nameForReadWriteLock, identifier);
|
||||
super(nameForReadWriteLock, identifier, new AbstractLogEventComparator());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RegattaLogEvent createRevokeEvent(AbstractLogEventAuthor author, RegattaLogEvent toRevoke, String reason) {
|
||||
return RegattaLogEventFactory.INSTANCE.createRevokeEvent(author, toRevoke, reason);
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.impl.RevokeEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogRevokeEvent;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
|
||||
public class RegattaLogRevokeEventImpl extends RevokeEventImpl<RegattaLogEventVisitor> implements RegattaLogRevokeEvent {
|
||||
private static final long serialVersionUID = -3470191515219206588L;
|
||||
|
||||
public RegattaLogRevokeEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
|
||||
Serializable pId, Serializable revokedEventId, String revokedEventType, String revokedEventShortInfo,
|
||||
String reason) {
|
||||
super(createdAt, author, logicalTimePoint, pId, revokedEventId, revokedEventType, revokedEventShortInfo, reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RegattaLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user