/*
 * Copyright 2021, TeamDev. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * 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 io.spine.server.aggregate.given.repo;

import com.google.common.collect.ImmutableSet;
import io.spine.core.EventContext;
import io.spine.server.aggregate.AggregateRepository;
import io.spine.server.route.EventRoute;
import io.spine.server.route.EventRouting;
import io.spine.test.aggregate.ParentState;
import io.spine.test.aggregate.ProjectId;
import io.spine.test.aggregate.event.AggProjectArchived;

import java.util.Set;

/**
 * The repository of {@link io.spine.server.aggregate.given.repo.ReactingAggregate}.
 */
public class ReactingRepository
        extends AggregateRepository<ProjectId, ReactingAggregate, ParentState> {

    @SuppressWarnings("SerializableInnerClassWithNonSerializableOuterClass")
    @Override
    protected void setupEventRouting(EventRouting<ProjectId> routing) {
        super.setupEventRouting(routing);
        routing.route(AggProjectArchived.class,
                      new EventRoute<ProjectId, AggProjectArchived>() {
                          private static final long serialVersionUID = 0L;

                          @Override
                          public Set<ProjectId> apply(AggProjectArchived message,
                                                      EventContext context) {
                              return ImmutableSet.copyOf(message.getChildProjectIdList());
                          }
                      });
    }
}

@@ -1334,43 +1334,8 @@
 et;%0A
-import io.spine.core.EventContext;%0A
 impo
@@ -1388,49 +1388,8 @@
 ry;%0A
-import io.spine.server.route.EventRoute;%0A
 impo
@@ -1575,31 +1575,8 @@
 d;%0A%0A
-import java.util.Set;%0A%0A
 /**%0A
@@ -1782,85 +1782,8 @@
  %7B%0A%0A
-    @SuppressWarnings(%22SerializableInnerClassWithNonSerializableOuterClass%22)%0A
     
@@ -1980,366 +1980,21 @@
     
-new EventRoute%3CProjectId, AggProjectArchived%3E() %7B%0A                          private static final long serialVersionUID = 0L;%0A%0A                          @Override%0A                          public Set%3CProjectId%3E apply(AggProjectArchived message,%0A                                                      EventContext context) %7B%0A                              return
+(msg, ctx) -%3E
  Imm
@@ -2015,14 +2015,10 @@
 Of(m
-essage
+sg
 .get
@@ -2042,61 +2042,8 @@
 t())
-;%0A                          %7D%0A                      %7D
 );%0A 

Simplify the routing expression.