All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.rahulsom.grooves.grails.RxGormJoinSupport Maven / Gradle / Ivy

There is a newer version: 0.6.1
Show newest version
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.groovy.transformations.Query;
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 grails.gorm.rx.RxEntity;
import rx.Observable;

import java.util.Date;
import java.util.List;

/**
 * RxGorm 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 RxEventSource} and {@link RxSnapshotSource} instead
 */
@Deprecated
public interface RxGormJoinSupport<
        AggregateIdT,
        AggregateT extends AggregateType & RxEntity,
        EventIdT,
        EventT extends BaseEvent & RxEntity,
        JoinedAggregateIdT,
        JoinedAggregateT extends AggregateType & RxEntity,
        SnapshotIdT,
        SnapshotT extends Join & RxEntity,
        JoinEventT extends JoinEvent,
        DisjoinEventT extends DisjoinEvent,
        QueryT extends BaseQuery
        > extends
        JoinSupport,
        RxEventSource,
        RxSnapshotSource {

    @Override
    default Executor getExecutor() {
        //noinspection unchecked
        return new JoinExecutor<>(getJoinEventClass(), getDisjoinEventClass());
    }

    @Override
    default Observable getSnapshot(long maxPosition, AggregateT aggregate) {
        return RxSnapshotSource.super.getSnapshot(maxPosition, aggregate);
    }

    @Override
    default Observable getSnapshot(Date maxTimestamp, AggregateT aggregate) {
        return RxSnapshotSource.super.getSnapshot(maxTimestamp, aggregate);
    }

    @Override
    default Observable getUncomputedEvents(
            AggregateT aggregate, SnapshotT lastSnapshot, long version) {
        return RxEventSource.super.getUncomputedEvents(aggregate, lastSnapshot, version);
    }

    @Override
    default Observable getUncomputedEvents(
            AggregateT aggregate, SnapshotT lastSnapshot, Date snapshotTime) {
        return RxEventSource.super.getUncomputedEvents(aggregate, lastSnapshot, snapshotTime);
    }

    @Override
    default Observable findEventsBefore(EventT event) {
        return JoinSupport.super.findEventsBefore(event);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy