com.github.rahulsom.grooves.grails.GormJoinSupport Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grooves-gorm Show documentation
Show all versions of grooves-gorm Show documentation
Integration with Grails' GORM API
package com.github.rahulsom.grooves.grails;
import com.github.rahulsom.grooves.api.AggregateType;
import com.github.rahulsom.grooves.api.events.BaseEvent;
import com.github.rahulsom.grooves.api.events.DisjoinEvent;
import com.github.rahulsom.grooves.api.events.JoinEvent;
import com.github.rahulsom.grooves.api.snapshots.Join;
import com.github.rahulsom.grooves.queries.JoinSupport;
import com.github.rahulsom.grooves.queries.internal.BaseQuery;
import com.github.rahulsom.grooves.queries.internal.Executor;
import com.github.rahulsom.grooves.queries.internal.JoinExecutor;
import org.grails.datastore.gorm.GormEntity;
import rx.Observable;
import java.util.Date;
import java.util.List;
/**
* Gorm implementation of Join Support.
*
* @param The Aggregate this join represents
* @param The type for the {@link EventT}'s id field
* @param The base type for events that apply to {@link AggregateT}
* @param The type for the join's id field
* @param The type for the other id of aggregate that {@link AggregateT} joins
* to
* @param The type for the other aggregate that {@link AggregateT} joins to
* @param The type of Snapshot that is computed
* @param The type of the Join Event
* @param The type of the disjoin event
*
* @author Rahul Somasunderam
* @deprecated Use {@link BlockingEventSource} and {@link BlockingSnapshotSource} instead
*/
@Deprecated
public interface GormJoinSupport<
AggregateIdT,
AggregateT extends AggregateType & GormEntity,
EventIdT,
EventT extends BaseEvent & GormEntity,
JoinedAggregateIdT,
JoinedAggregateT extends AggregateType & GormEntity,
SnapshotIdT,
SnapshotT extends Join & GormEntity,
JoinEventT extends JoinEvent,
DisjoinEventT extends DisjoinEvent,
QueryT extends BaseQuery & Join
> extends
JoinSupport,
BlockingEventSource,
BlockingSnapshotSource {
@Override
default Executor getExecutor() {
//noinspection unchecked
return new JoinExecutor<>(getJoinEventClass(), getDisjoinEventClass());
}
@Override
default Observable findEventsBefore(EventT event) {
return JoinSupport.super.findEventsBefore(event);
}
@Override
default Observable getSnapshot(long maxPosition, AggregateT aggregate) {
return BlockingSnapshotSource.super.getSnapshot(maxPosition, aggregate);
}
@Override
default Observable getSnapshot(Date maxTimestamp, AggregateT aggregate) {
return BlockingSnapshotSource.super.getSnapshot(maxTimestamp, aggregate);
}
@Override
default Observable getUncomputedEvents(
AggregateT aggregate, SnapshotT lastSnapshot, long version) {
return BlockingEventSource.super.getUncomputedEvents(aggregate, lastSnapshot, version);
}
@Override
default Observable getUncomputedEvents(
AggregateT aggregate, SnapshotT lastSnapshot, Date snapshotTime) {
return BlockingEventSource.super.getUncomputedEvents(aggregate, lastSnapshot, snapshotTime);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy