package org.coner.core;

import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import org.coner.core.domain.Event;
import org.coner.core.domain.Registration;
import org.coner.core.gateway.EventGateway;
import org.coner.core.gateway.RegistrationGateway;

import java.util.List;

/**
 *
 */
public class ConerCoreService {

    private final EventGateway eventGateway;
    private final RegistrationGateway registrationGateway;

    public ConerCoreService(EventGateway eventGateway, RegistrationGateway registrationGateway) {
        this.eventGateway = eventGateway;
        this.registrationGateway = registrationGateway;
    }

    public List<Event> getEvents() {
        return eventGateway.getAll();
    }

    public void addEvent(Event event) {
        Preconditions.checkNotNull(event);
        eventGateway.create(event);
    }

    public Event getEvent(String id) {
        Preconditions.checkArgument(!Strings.isNullOrEmpty(id));
        return eventGateway.findById(id);
    }

    public List<Registration> getRegistrations(Event event) {
        Preconditions.checkNotNull(event);
        return registrationGateway.getAllWith(event);
    }
}

@@ -307,17 +307,121 @@
 %0A%0A/**%0A *
+ The ConerCoreService is the domain level implementation of all functionality in the Coner core project.
 %0A
-
  */%0Apubl
@@ -554,16 +554,188 @@
 teway;%0A%0A
+    /**%0A     * Constructor for ConerCoreService%0A     *%0A     * @param eventGateway        the EventGateway%0A     * @param registrationGateway the RegistrationGateway%0A     */%0A
     publ
@@ -921,32 +921,113 @@
 Gateway;%0A    %7D%0A%0A
+    /**%0A     * Get all events%0A     *%0A     * @return a list of all events%0A     */%0A
     public List%3C
@@ -1084,32 +1084,119 @@
 etAll();%0A    %7D%0A%0A
+    /**%0A     * Add an event%0A     *%0A     * @param event the Event entity to add%0A     */%0A
     public void 
@@ -1297,32 +1297,172 @@
 (event);%0A    %7D%0A%0A
+    /**%0A     * Get an event by id%0A     *%0A     * @param id the id of the event%0A     * @return the event with id or null if not found%0A     */%0A
     public Event
@@ -1594,24 +1594,197 @@
 id);%0A    %7D%0A%0A
+    /**%0A     * Get all registrations for an event%0A     *%0A     * @param event the event to get registrations%0A     * @return a list of all registrations for the event%0A     */%0A
     public L

Add ConerCoreService javadocs