// Path: src/main/java/com/cqrs/appengine/core/exceptions/HydrationException.java
// public class HydrationException extends AggregateException {
// 
//     private static final String ERROR_TEXT = "Loading the data failed";
// 
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * Default constructor
//      * 
//      * @param aggregateId
//      */
//     public HydrationException(UUID aggregateId){
//         super(aggregateId, ERROR_TEXT);
//     }
// 
//     /**
//      * Constructor to provide specific error reason for the hydration exception
//      * 
//      * @param aggregateId
//      * @param error
//      */
//     public HydrationException(UUID aggregateId, String error){
//         super(aggregateId, error);
//     }
// }
// 
// Path: src/main/java/com/cqrs/appengine/core/messaging/Event.java
// public interface Event {
// 
// }


import java.util.UUID;
import com.cqrs.appengine.core.exceptions.HydrationException;
import com.cqrs.appengine.core.messaging.Event;
package com.cqrs.appengine.core.domain;



/**
 * Simple interface to an aggregate root
 */
public interface AggregateRoot {

    /**
     * get the Id
     * 
     * @return
     */
    UUID getId();

    /**
     * Gets all change events since the
     * original hydration. If there are no
     * changes then null is returned
     * 
     * @return
     */
    Iterable<Event> getUncommittedChanges();

    /**
     * Mark all changes a committed
     */
    void markChangesAsCommitted();

    /**
     * load the aggregate root
     * 
     * @param history
     * @throws HydrationException 
     */
// Path: src/main/java/com/cqrs/appengine/core/exceptions/HydrationException.java
// public class HydrationException extends AggregateException {
// 
//     private static final String ERROR_TEXT = "Loading the data failed";
// 
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * Default constructor
//      * 
//      * @param aggregateId
//      */
//     public HydrationException(UUID aggregateId){
//         super(aggregateId, ERROR_TEXT);
//     }
// 
//     /**
//      * Constructor to provide specific error reason for the hydration exception
//      * 
//      * @param aggregateId
//      * @param error
//      */
//     public HydrationException(UUID aggregateId, String error){
//         super(aggregateId, error);
//     }
// }
// 
// Path: src/main/java/com/cqrs/appengine/core/messaging/Event.java
// public interface Event {
// 
// }


// Path: src/main/java/com/cqrs/appengine/core/domain/AggregateRoot.java
import java.util.UUID;
import com.cqrs.appengine.core.exceptions.HydrationException;
import com.cqrs.appengine.core.messaging.Event;

package com.cqrs.appengine.core.domain;



/**
 * Simple interface to an aggregate root
 */
public interface AggregateRoot {

    /**
     * get the Id
     * 
     * @return
     */
    UUID getId();

    /**
     * Gets all change events since the
     * original hydration. If there are no
     * changes then null is returned
     * 
     * @return
     */
    Iterable<Event> getUncommittedChanges();

    /**
     * Mark all changes a committed
     */
    void markChangesAsCommitted();

    /**
     * load the aggregate root
     * 
     * @param history
     * @throws HydrationException 
     */
    void loadFromHistory(Iterable<Event> history) throws HydrationException;