/*
 * 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 io.spine.server.storage.jdbc.query.dsl;

import com.google.protobuf.Timestamp;
import com.querydsl.core.dml.StoreClause;
import com.querydsl.core.types.dsl.PathBuilder;
import io.spine.annotation.Internal;
import io.spine.server.storage.jdbc.query.LastHandledEventTimeQueryFactory;

import static io.spine.server.storage.jdbc.LastHandledEventTimeTable.Column.nanos;
import static io.spine.server.storage.jdbc.LastHandledEventTimeTable.Column.projection_type;
import static io.spine.server.storage.jdbc.LastHandledEventTimeTable.Column.seconds;
import static io.spine.server.storage.jdbc.Sql.BuildingBlock.COMMA;
import static io.spine.server.storage.jdbc.Sql.BuildingBlock.EQUAL;
import static io.spine.server.storage.jdbc.Sql.BuildingBlock.SEMICOLON;
import static io.spine.server.storage.jdbc.Sql.Query.PLACEHOLDER;
import static io.spine.server.storage.jdbc.Sql.Query.SET;
import static io.spine.server.storage.jdbc.Sql.Query.UPDATE;
import static io.spine.server.storage.jdbc.Sql.Query.WHERE;
import static java.lang.String.format;

/**
 * Query that updates {@link Timestamp} in the {@link LastHandledEventTimeQueryFactory}.
 *
 * @author Alexander Litus
 * @author Andrey Lavrov
 */
class UpdateTimestampQuery extends WriteTimestampQuery {

    private UpdateTimestampQuery(Builder builder) {
        super(builder);
    }

    @Override
    StoreClause<?> createClause() {
        final PathBuilder<Object> id = pathOf(projection_type);
        final String idValue = getId();
        return factory().update(table())
                        .where(id.eq(idValue));
    }

    static Builder newBuilder() {
        return new Builder();
    }

    @SuppressWarnings("ClassNameSameAsAncestorName")
    static class Builder extends WriteTimestampQuery.Builder<Builder, UpdateTimestampQuery> {

        @Override
        UpdateTimestampQuery build() {
            return new UpdateTimestampQuery(this);
        }

        @Override
        Builder getThis() {
            return this;
        }
    }
}

@@ -1191,873 +1191,100 @@
 er;%0A
-import io.spine.annotation.Internal;%0Aimport io.spine.server.storage.jdbc.query.LastHandledEventTimeQueryFactory;%0A%0Aimport static io.spine.server.storage.jdbc.LastHandledEventTimeTable.Column.nanos;%0Aimport static io.spine.server.storage.jdbc.LastHandledEventTimeTable.Column.projection_type;%0Aimport static io.spine.server.storage.jdbc.LastHandledEventTimeTable.Column.seconds;%0Aimport static io.spine.server.storage.jdbc.Sql.BuildingBlock.COMMA;%0Aimport static io.spine.server.storage.jdbc.Sql.BuildingBlock.EQUAL;%0Aimport static io.spine.server.storage.jdbc.Sql.BuildingBlock.SEMICOLON;%0Aimport static io.spine.server.storage.jdbc.Sql.Query.PLACEHOLDER;%0Aimport static io.spine.server.storage.jdbc.Sql.Query.SET;%0Aimport static io.spine.server.storage.jdbc.Sql.Query.UPDATE;%0Aimport static io.spine.server.storage.jdbc.Sql.Query.WHERE;%0Aimport static java.lang.String.format
+%0Aimport static io.spine.server.storage.jdbc.LastHandledEventTimeTable.Column.projection_type
 ;%0A%0A/

Remove unused imports and update a Javadoc link