@@ -0,0 +1,3320 @@
+/*%0A * Copyright 2018, TeamDev. All rights reserved.%0A *%0A * Redistribution and use in source and/or binary forms, with or without%0A * modification, must retain the above copyright notice and the following%0A * disclaimer.%0A *%0A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS%0A * %22AS IS%22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT%0A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR%0A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT%0A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,%0A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT%0A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,%0A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY%0A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT%0A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE%0A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.%0A */%0A%0Apackage io.spine.system.server;%0A%0Aimport io.spine.core.Subscribe;%0Aimport io.spine.server.entity.LifecycleFlags;%0Aimport io.spine.server.projection.Projection;%0A%0A/**%0A * @author Dmytro Dashenkov%0A */%0Apublic class MirrorProjection extends Projection%3CMirrorId, Mirror, MirrorVBuilder%3E %7B%0A%0A    private MirrorProjection(MirrorId id) %7B%0A        super(id);%0A    %7D%0A%0A    @Subscribe%0A    public void on(EntityStateChanged event) %7B%0A        getBuilder().setId(getId())%0A                    .setState(event.getNewState());%0A    %7D%0A%0A    @Subscribe%0A    public void on(@SuppressWarnings(%22unused%22)%0A                   EntityArchived event) %7B%0A        LifecycleFlags flags = getBuilder().getLifecycle()%0A                                           .toBuilder()%0A                                           .setArchived(true)%0A                                           .build();%0A        getBuilder().setId(getId())%0A                    .setLifecycle(flags);%0A        setArchived(true);%0A    %7D%0A%0A    @Subscribe%0A    public void on(@SuppressWarnings(%22unused%22)%0A                   EntityDeleted event) %7B%0A        LifecycleFlags flags = getBuilder().getLifecycle()%0A                                           .toBuilder()%0A                                           .setDeleted(true)%0A                                           .build();%0A        getBuilder().setId(getId())%0A                    .setLifecycle(flags);%0A        setDeleted(true);%0A    %7D%0A%0A    @Subscribe%0A    public void on(@SuppressWarnings(%22unused%22)%0A                   EntityExtractedFromArchive event) %7B%0A        LifecycleFlags flags = getBuilder().getLifecycle()%0A                                           .toBuilder()%0A                                           .setArchived(false)%0A                                           .build();%0A        getBuilder().setId(getId())%0A                    .setLifecycle(flags);%0A        setArchived(false);%0A    %7D%0A%0A    @Subscribe%0A    public void on(@SuppressWarnings(%22unused%22)%0A                   EntityRestored event) %7B%0A        LifecycleFlags flags = getBuilder().getLifecycle()%0A                                           .toBuilder()%0A                                           .setDeleted(false)%0A                                           .build();%0A        getBuilder().setId(getId())%0A                    .setLifecycle(flags);%0A        setDeleted(false);%0A    %7D%0A%7D%0A

Implement MirrorProjection.