// Path: cqrs-lib/src/main/java/se/citerus/cqrs/bookstore/event/DomainEventListener.java
// public interface DomainEventListener {
// 
//   boolean supportsReplay();
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/OrderId.java
// public class OrderId extends GenericId {
// 
//   public OrderId(@JsonProperty("id") String id) {
//     super(id);
//   }
// 
//   public static OrderId randomId() {
//     return new OrderId(UUID.randomUUID().toString());
//   }
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/OrderLine.java
// public class OrderLine extends TransportObject {
// 
//   public final ProductId productId;
//   public final String title;
//   public final int quantity;
//   public final long unitPrice;
// 
//   public OrderLine(@JsonProperty("productId") ProductId productId,
//                    @JsonProperty("title") String title,
//                    @JsonProperty("quantity") int quantity,
//                    @JsonProperty("unitPrice") long unitPrice) {
//     this.productId = productId;
//     this.title = title;
//     this.quantity = quantity;
//     this.unitPrice = unitPrice;
//   }
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/event/OrderActivatedEvent.java
// public class OrderActivatedEvent extends DomainEvent<OrderId> {
// 
//   public OrderActivatedEvent(@JsonProperty("aggregateId") OrderId aggregateId,
//                              @JsonProperty("version") int version,
//                              @JsonProperty("timestamp") long timestamp) {
//     super(aggregateId, version, timestamp);
//   }
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/event/OrderPlacedEvent.java
// public class OrderPlacedEvent extends DomainEvent<OrderId> {
// 
//   public final CustomerInformation customerInformation;
//   public final List<OrderLine> orderLines;
//   public final long orderAmount;
// 
//   public OrderPlacedEvent(@JsonProperty("aggregateId") OrderId id,
//                           @JsonProperty("version") int version,
//                           @JsonProperty("timestamp") long timestamp,
//                           @JsonProperty("customerInformation") CustomerInformation customerInformation,
//                           @JsonProperty("orderLines") List<OrderLine> orderLines,
//                           @JsonProperty("orderAmount") long orderAmount) {
//     super(id, version, timestamp);
//     this.customerInformation = customerInformation;
//     this.orderLines = Collections.unmodifiableList(orderLines);
//     this.orderAmount = orderAmount;
//   }
// 
// }


import com.google.common.eventbus.Subscribe;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import se.citerus.cqrs.bookstore.event.DomainEventListener;
import se.citerus.cqrs.bookstore.ordercontext.order.OrderId;
import se.citerus.cqrs.bookstore.ordercontext.order.OrderLine;
import se.citerus.cqrs.bookstore.ordercontext.order.event.OrderActivatedEvent;
import se.citerus.cqrs.bookstore.ordercontext.order.event.OrderPlacedEvent;
import java.util.LinkedList;
import java.util.List;
import static se.citerus.cqrs.bookstore.ordercontext.order.OrderStatus.ACTIVATED;
import static se.citerus.cqrs.bookstore.ordercontext.order.OrderStatus.PLACED;
package se.citerus.cqrs.bookstore.ordercontext.query.orderlist;




/**
 * Listens to order events and stores projections of orders and their status as read models in the
 * {@link OrderProjectionRepository}. Supports retrieving lists of orders as well as individual orders by id.
 */
public class OrderListDenormalizer implements DomainEventListener {

  private final Logger logger = LoggerFactory.getLogger(getClass());
  private final OrderProjectionRepository repository;

  public OrderListDenormalizer(OrderProjectionRepository repository) {
    this.repository = repository;
  }

// Path: cqrs-lib/src/main/java/se/citerus/cqrs/bookstore/event/DomainEventListener.java
// public interface DomainEventListener {
// 
//   boolean supportsReplay();
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/OrderId.java
// public class OrderId extends GenericId {
// 
//   public OrderId(@JsonProperty("id") String id) {
//     super(id);
//   }
// 
//   public static OrderId randomId() {
//     return new OrderId(UUID.randomUUID().toString());
//   }
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/OrderLine.java
// public class OrderLine extends TransportObject {
// 
//   public final ProductId productId;
//   public final String title;
//   public final int quantity;
//   public final long unitPrice;
// 
//   public OrderLine(@JsonProperty("productId") ProductId productId,
//                    @JsonProperty("title") String title,
//                    @JsonProperty("quantity") int quantity,
//                    @JsonProperty("unitPrice") long unitPrice) {
//     this.productId = productId;
//     this.title = title;
//     this.quantity = quantity;
//     this.unitPrice = unitPrice;
//   }
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/event/OrderActivatedEvent.java
// public class OrderActivatedEvent extends DomainEvent<OrderId> {
// 
//   public OrderActivatedEvent(@JsonProperty("aggregateId") OrderId aggregateId,
//                              @JsonProperty("version") int version,
//                              @JsonProperty("timestamp") long timestamp) {
//     super(aggregateId, version, timestamp);
//   }
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/event/OrderPlacedEvent.java
// public class OrderPlacedEvent extends DomainEvent<OrderId> {
// 
//   public final CustomerInformation customerInformation;
//   public final List<OrderLine> orderLines;
//   public final long orderAmount;
// 
//   public OrderPlacedEvent(@JsonProperty("aggregateId") OrderId id,
//                           @JsonProperty("version") int version,
//                           @JsonProperty("timestamp") long timestamp,
//                           @JsonProperty("customerInformation") CustomerInformation customerInformation,
//                           @JsonProperty("orderLines") List<OrderLine> orderLines,
//                           @JsonProperty("orderAmount") long orderAmount) {
//     super(id, version, timestamp);
//     this.customerInformation = customerInformation;
//     this.orderLines = Collections.unmodifiableList(orderLines);
//     this.orderAmount = orderAmount;
//   }
// 
// }


// Path: order-context-parent/order-query/src/main/java/se/citerus/cqrs/bookstore/ordercontext/query/orderlist/OrderListDenormalizer.java
import com.google.common.eventbus.Subscribe;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import se.citerus.cqrs.bookstore.event.DomainEventListener;
import se.citerus.cqrs.bookstore.ordercontext.order.OrderId;
import se.citerus.cqrs.bookstore.ordercontext.order.OrderLine;
import se.citerus.cqrs.bookstore.ordercontext.order.event.OrderActivatedEvent;
import se.citerus.cqrs.bookstore.ordercontext.order.event.OrderPlacedEvent;
import java.util.LinkedList;
import java.util.List;
import static se.citerus.cqrs.bookstore.ordercontext.order.OrderStatus.ACTIVATED;
import static se.citerus.cqrs.bookstore.ordercontext.order.OrderStatus.PLACED;

package se.citerus.cqrs.bookstore.ordercontext.query.orderlist;




/**
 * Listens to order events and stores projections of orders and their status as read models in the
 * {@link OrderProjectionRepository}. Supports retrieving lists of orders as well as individual orders by id.
 */
public class OrderListDenormalizer implements DomainEventListener {

  private final Logger logger = LoggerFactory.getLogger(getClass());
  private final OrderProjectionRepository repository;

  public OrderListDenormalizer(OrderProjectionRepository repository) {
    this.repository = repository;
  }

  @Subscribe