@@ -0,0 +1,1394 @@
+package flyway.pti3d;%0A%0Aimport fi.nls.oskari.domain.map.view.Bundle;%0Aimport fi.nls.oskari.util.FlywayHelper;%0Aimport fi.nls.oskari.util.JSONHelper;%0Aimport org.flywaydb.core.api.migration.jdbc.JdbcMigration;%0A%0Aimport java.sql.Connection;%0Aimport java.sql.SQLException;%0Aimport java.util.List;%0A%0Apublic class V1_8__setup_dimension_change_to_2d implements JdbcMigration %7B%0A%0A    private static final String BUNDLE_NAME = %22dimension-change%22;%0A    private static final String APPLICATION_2D_NAME = %22geoportal%22;%0A    private static final String APPLICATION_3D_NAME = %22geoportal-3D%22;%0A%0A    public void migrate(Connection connection) throws SQLException %7B%0A        // with 2D application name gets default view's uuid if there is only on default view%0A        String uuid = FlywayHelper3D.get3DViewUuid(connection, APPLICATION_2D_NAME);%0A        final List%3CLong%3E viewIds = FlywayHelper.getUserAndDefaultViewIds(connection, APPLICATION_3D_NAME);%0A%0A        for (Long id : viewIds) %7B%0A            if (!FlywayHelper.viewContainsBundle(connection, BUNDLE_NAME, id)) %7B%0A                FlywayHelper.addBundleWithDefaults(connection, id, BUNDLE_NAME);%0A            %7D%0A            Bundle bundle = FlywayHelper.getBundleFromView(connection, BUNDLE_NAME, id);%0A            bundle.setConfig(JSONHelper.createJSONObject(%22uuid%22, uuid).toString());%0A            FlywayHelper.updateBundleInView(connection, bundle, id);%0A        %7D%0A    %7D%0A%7D%0A

add default view's uuid to 3D views' dimension-change config