/*
 * Copyright 2017, TeamDev Ltd. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package org.spine3.server.event;

import org.spine3.base.Event;
import org.spine3.base.EventId;
import org.spine3.base.Events;
import org.spine3.server.entity.AbstractEntity;

import java.util.Comparator;

/**
 * Stores an event.
 *
 * @author Alexander Yevsyukov
 */
class EventEntity extends AbstractEntity<EventId, Event> {

    /**
     * Compares event entities by timestamps of events.
     */
    private static final Comparator<EventEntity> comparator = new Comparator<EventEntity>() {
        @Override
        public int compare(EventEntity e1, EventEntity e2) {
            final Event event1 = e1.getState();
            final Event event2 = e2.getState();
            final int result = Events.eventComparator()
                                     .compare(event1, event2);
            return result;
        }
    };

    EventEntity(EventId id) {
        super(id);
    }

    EventEntity(Event event) {
        this(event.getId());
        updateState(event);
    }

    /**
     * Returns comparator which sorts event entities chronologically.
     */
    static Comparator<EventEntity> comparator() {
        return comparator;
    }
}

@@ -1044,16 +1044,55 @@
 event;%0A%0A
+import org.spine3.annotation.Internal;%0A
 import o
@@ -1113,16 +1113,16 @@
 .Event;%0A
-
 import o
@@ -1282,16 +1282,233 @@
 ent.%0A *%0A
+ * %3Cp%3E%7B@code EventEntity%7D is a Spine internal %7B@link org.spine3.server.entity.Entity Entity%7D type,%0A * which is not designed for the direct usage. Both API and behaviour of this class may are subjects%0A * of change.%0A *%0A
  * @auth
@@ -1534,16 +1534,33 @@
 kov%0A */%0A
+@Internal%0Apublic 
 class Ev

Make EventEntity public.