do not allow competitor to be null in RegisterCompetitorEvent

This commit is contained in:
Fredrik Teschke committed 2015-01-05 09:45:58 +01:00
1 parent 636c654700
commit 8cb4cf7ffc
3 files changed
+30 -14

No files matched your search

@@ -12,17 +12,22 @@ import com.sap.sailing.domain.abstractlog.shared.events.impl.BaseRegisterCompeti
import com.sap.sailing.domain.base.Competitor;
import com.sap.sse.common.TimePoint;
public class RaceLogRegisterCompetitorEventImpl extends BaseRegisterCompetitorEventImpl<RaceLogEventVisitor>
implements RaceLogRegisterCompetitorEvent {
public class RaceLogRegisterCompetitorEventImpl extends BaseRegisterCompetitorEventImpl<RaceLogEventVisitor> implements
RaceLogRegisterCompetitorEvent {
private static final long serialVersionUID = -5114645637316367845L;
private final RaceLogEventData raceLogEventData;
/**
* @throws IllegalArgumentException
* if {@code competitor} is null
*/
public RaceLogRegisterCompetitorEventImpl(TimePoint createdAt, AbstractLogEventAuthor author,
TimePoint logicalTimePoint, Serializable id, int passId, Competitor competitor) {
TimePoint logicalTimePoint, Serializable id, int passId, Competitor competitor)
throws IllegalArgumentException {
super(createdAt, author, logicalTimePoint, id, competitor);
this.raceLogEventData = new RaceLogEventDataImpl(null, passId);
}
@Override
public int getPassId() {
return raceLogEventData.getPassId();
@@ -10,11 +10,15 @@ import com.sap.sailing.domain.base.Competitor;
import com.sap.sse.common.TimePoint;
public class RegattaLogRegisterCompetitorEventImpl extends BaseRegisterCompetitorEventImpl<RegattaLogEventVisitor>
implements RegattaLogRegisterCompetitorEvent {
implements RegattaLogRegisterCompetitorEvent {
private static final long serialVersionUID = -5114645637316367845L;
/**
* @throws IllegalArgumentException
* if {@code competitor} is null
*/
public RegattaLogRegisterCompetitorEventImpl(TimePoint createdAt, AbstractLogEventAuthor author,
TimePoint logicalTimePoint, Serializable id, Competitor competitor) {
TimePoint logicalTimePoint, Serializable id, Competitor competitor) throws IllegalArgumentException {
super(createdAt, author, logicalTimePoint, id, competitor);
}
@@ -8,21 +8,28 @@ import com.sap.sailing.domain.abstractlog.shared.events.RegisterCompetitorEvent;
import com.sap.sailing.domain.base.Competitor;
import com.sap.sse.common.TimePoint;
public abstract class BaseRegisterCompetitorEventImpl<VisitorT> extends AbstractLogEventImpl<VisitorT>
implements RegisterCompetitorEvent<VisitorT> {
public abstract class BaseRegisterCompetitorEventImpl<VisitorT> extends AbstractLogEventImpl<VisitorT> implements
RegisterCompetitorEvent<VisitorT> {
private static final long serialVersionUID = -30864810737555657L;
private final Competitor competitor;
public BaseRegisterCompetitorEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
Serializable pId, Competitor competitor) {
/**
* @throws IllegalArgumentException
* if {@code competitor} is null
*/
public BaseRegisterCompetitorEventImpl(TimePoint createdAt, AbstractLogEventAuthor author,
TimePoint logicalTimePoint, Serializable pId, Competitor competitor) throws IllegalArgumentException {
super(createdAt, author, logicalTimePoint, pId);
if (competitor == null) {
throw new IllegalArgumentException("Competitor may not be null");
}
this.competitor = competitor;
}
@Override
public Competitor getCompetitor() {
return competitor;
}
}
@Override
public String getShortInfo() {