/**
 *
 * Copyright (c) 2006-2016, Speedment, Inc. 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
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.speedment.internal.core.config.dbms;

import com.speedment.Speedment;
import com.speedment.config.db.Dbms;
import com.speedment.config.db.parameters.DbmsType;
import com.speedment.db.DbmsHandler;
import com.speedment.internal.core.db.MySqlDbmsHandler;
import com.speedment.internal.core.manager.sql.MySqlSpeedmentPredicateView;
import com.speedment.internal.core.manager.sql.SpeedmentPredicateView;

import java.util.Collections;
import java.util.Optional;
import java.util.function.BiFunction;
import java.util.function.Function;

import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.toSet;

import java.util.stream.Stream;

import static com.speedment.internal.core.stream.OptionalUtil.unwrap;
import static com.speedment.internal.core.stream.OptionalUtil.unwrap;
import static com.speedment.internal.core.stream.OptionalUtil.unwrap;
import static com.speedment.internal.core.stream.OptionalUtil.unwrap;
import static com.speedment.internal.core.stream.OptionalUtil.unwrap;
import static com.speedment.internal.core.stream.OptionalUtil.unwrap;
import static com.speedment.internal.core.stream.OptionalUtil.unwrap;
import static com.speedment.internal.core.stream.OptionalUtil.unwrap;

/**
 *
 * @author pemi
 */
public final class MySqlDbmsType  {

    private static final String QUOTE = "`";

    private static final Function<Dbms, String> CONNECTION_URL_GENERATOR = dbms -> {
        final StringBuilder result = new StringBuilder()
        .append("jdbc:mysql://")
        .append(dbms.getIpAddress().orElse(""));
        dbms.getPort().ifPresent(p -> result.append(":").append(p));
        result.append("/?useUnicode=true&characterEncoding=UTF-8&useServerPrepStmts=true&useCursorFetch=true&zeroDateTimeBehavior=convertToNull");
        return result.toString();
    };

    private static final SpeedmentPredicateView VIEW = new MySqlSpeedmentPredicateView(QUOTE, QUOTE);    
    
    public static final DbmsType INSTANCE = DbmsType.builder()
            // Mandatory parameters
            .withName("MySQL")
            .withDriverManagerName("MySQL-AB JDBC Driver")
            .withDefaultPort(3306)
            .withDbmsNameMeaning("Just a name")
            .withDriverName("com.mysql.jdbc.Driver")
            .withFieldEncloserStart(QUOTE)
            .withFieldEncloserEnd(QUOTE)
            .withDbmsMapper(MySqlDbmsHandler::new)
            .withConnectionUrlGenerator(CONNECTION_URL_GENERATOR)
            .withSpeedmentPredicateView(VIEW)
            // Optional parameters
            .build();
    
}

@@ -678,40 +678,8 @@
 s;%0A%0A
-import com.speedment.Speedment;%0A
 impo
@@ -767,45 +767,8 @@
 pe;%0A
-import com.speedment.db.DbmsHandler;%0A
 impo
@@ -988,826 +988,27 @@
 til.
-Collections;%0Aimport java.util.Optional;%0Aimport java.util.function.BiFunction;%0Aimport java.util.function.Function;%0A%0Aimport static java.util.stream.Collectors.collectingAndThen;%0Aimport static java.util.stream.Collectors.toSet;%0A%0Aimport java.util.stream.Stream;%0A%0Aimport static com.speedment.internal.core.stream.OptionalUtil.unwrap;%0Aimport static com.speedment.internal.core.stream.OptionalUtil.unwrap;%0Aimport static com.speedment.internal.core.stream.OptionalUtil.unwrap;%0Aimport static com.speedment.internal.core.stream.OptionalUtil.unwrap;%0Aimport static com.speedment.internal.core.stream.OptionalUtil.unwrap;%0Aimport static com.speedment.internal.core.stream.OptionalUtil.unwrap;%0Aimport static com.speedment.internal.core.stream.OptionalUtil.unwrap;%0Aimport static com.speedment.internal.core.stream.OptionalUtil.unwrap;
+function.Function;%0A
 %0A%0A/*

Fix import