@@ -0,0 +1,2187 @@
+package flyway.paikkis;%0A%0Aimport fi.nls.oskari.domain.map.view.Bundle;%0Aimport fi.nls.oskari.log.LogFactory;%0Aimport fi.nls.oskari.log.Logger;%0Aimport fi.nls.oskari.map.view.AppSetupServiceMybatisImpl;%0Aimport fi.nls.oskari.map.view.ViewService;%0Aimport fi.nls.oskari.util.FlywayHelper;%0Aimport org.flywaydb.core.api.migration.jdbc.JdbcMigration;%0Aimport org.json.JSONArray;%0Aimport org.json.JSONObject;%0A%0Aimport java.sql.Connection;%0Aimport java.util.List;%0A%0A/**%0A * Replaces transport based wfs plugin with vector implementation%0A */%0Apublic class V2_36__use_wfs_vector_layer_plugin implements JdbcMigration %7B%0A%0A    private static final Logger LOG = LogFactory.getLogger(V2_36__use_wfs_vector_layer_plugin.class);%0A    private static final String BUNDLE_NAME = %22mapfull%22;%0A    private static final String WFS_TRANSPORT_PLUGIN_ID = %22Oskari.mapframework.bundle.mapwfs2.plugin.WfsLayerPlugin%22;%0A    private static final String WFS_VECTOR_PLUGIN_ID = %22Oskari.wfsvector.WfsVectorLayerPlugin%22;%0A%0A    private ViewService viewService;%0A%0A    public void migrate(Connection connection) throws Exception %7B%0A        viewService = new AppSetupServiceMybatisImpl();%0A        List%3CLong%3E viewIds = FlywayHelper.getViewIdsForTypes(connection, %22DEFAULT%22, %22USER%22, %22PUBLISHED%22);%0A        for (long id : viewIds) %7B%0A            updateView(connection, id);%0A        %7D%0A    %7D%0A%0A    private void updateView (Connection connection, long viewId) throws Exception %7B%0A        Bundle mapfull = FlywayHelper.getBundleFromView(connection, BUNDLE_NAME, viewId);%0A        JSONObject config = mapfull.getConfigJSON();%0A        if (config == null) %7B%0A            return;%0A        %7D%0A        JSONArray plugins = config.optJSONArray(%22plugins%22);%0A        if (plugins == null) %7B%0A            return;%0A        %7D%0A        for (int i = 0; i %3C plugins.length(); i++) %7B%0A            JSONObject plugin = plugins.getJSONObject(i);%0A            String id = plugin.optString(%22id%22);%0A            if (id == null %7C%7C !id.equals(WFS_TRANSPORT_PLUGIN_ID)) %7B%0A                continue;%0A            %7D%0A            plugin.put(%22id%22, WFS_VECTOR_PLUGIN_ID);%0A        %7D%0A        mapfull.setConfig(config.toString());%0A        viewService.updateBundleSettingsForView(viewId, mapfull);%0A    %7D%0A%7D%0A

Migrate to mvt and vector based wfs plugin